-
Notifications
You must be signed in to change notification settings - Fork 410
Open
Description
The boot time of a container is not stable when running a container in WSL.
For example
sh-4.4# date -d @$(awk '/btime/ {print $2}' /proc/stat)
Thu Jul 10 05:42:14 UTC 2025
sh-4.4# w
09:32:16 up 3:50, 0 users, load average: 0.25, 0.21, 0.18
... Hibernate....
sh-4.4# date -d @$(awk '/btime/ {print $2}' /proc/stat)
Thu Jul 10 06:22:11 UTC 2025
... Boot time increased with 40minutes...
sh-4.4# w
11:31:27 up 5:09, 0 users, load average: 0.19, 0.13, 0.17
... And is stable without hibernate
Problem with this is that a PID file created before the sleep/hibernate may be erased by the truncate_old function:
logg.warning("NLMSCHE: truncating: %s", filename)
filetime = self.get_filetime(filename)
boottime = self.get_boottime()
if filetime >= boottime:
if DEBUG_BOOTTIME:
logg.debug(" file time: %s (%s)", datetime.datetime.fromtimestamp(filetime), o22(filename))
logg.debug(" boot time: %s (%s)", datetime.datetime.fromtimestamp(boottime), "status modified later")
return False # OK
if DEBUG_BOOTTIME:
logg.info(" file time: %s (%s)", datetime.datetime.fromtimestamp(filetime), o22(filename))
logg.info(" boot time: %s (%s)", datetime.datetime.fromtimestamp(boottime), "status TRUNCATED NOW")
try:
shutil_truncate(filename)
In my opinion the code to determine the boot time can be simplified: simply use mtime from /proc directly:
def get_boottime_from_proc(self):
""" detects the latest boot time by looking at the creation time of /proc"""
return os.path.getmtime(_proc_pid_dir)
Metadata
Metadata
Assignees
Labels
No labels