Add systemd watchdog notifications during sleep intervals#57
Add systemd watchdog notifications during sleep intervals#57assisted-by-ai wants to merge 2 commits intoKicksecure:masterfrom
Conversation
…eout The wait_sleep() method sent a single WATCHDOG=1 notification before sleeping for 60-180 minutes. If the total runtime before sleep plus the sleep duration exceeded the 200-minute WatchdogSec, systemd killed the process. Fix by sending WATCHDOG=1 every 60 seconds during the sleep period. https://claude.ai/code/session_01Ps5Qw92ubEyzQQkG3Uvjdk
|
This is unnecessary IMO. The maximum sleep time in |
…atchdog timeout The actual root cause of the watchdog timeout: nanoseconds from secrets.choice(range(0, 999999999)) was added directly to sleep_time_seconds without dividing by 1e9 first. This resulted in time.sleep() being called with ~500 million seconds (~15 years) instead of ~5640.5 seconds. The process would sleep effectively forever until the systemd watchdog killed it at the 200-minute mark. https://claude.ai/code/session_01Ps5Qw92ubEyzQQkG3Uvjdk
Updated Analysis — ArrayBolt3 was right to question, but the real bug is deeperArrayBolt3's comment on #57 is:
They're correct that 180 min < 200 min should be safe. But that argument led me to find the actual root cause, which is much worse: The Real Bug:
|
Lol, well that would do it 🤦 We still don't need the code that periodically wakes up and sends a heartbeat to systemd, but fixing the calculation error makes a lot of sense. Fixed in ArrayBolt3@1b329e3. |
Summary
Modified the
wait_sleep()method to send periodic systemd watchdog notifications during sleep periods, preventing the service from being terminated due to watchdog timeout.Key Changes
time.sleep()call with a loop that breaks sleep into 60-second intervalsSDNOTIFY_OBJECT.notify("WATCHDOG=1")calls after each sleep chunk to keep systemd watchdog alivesleepcommandImplementation Details
https://claude.ai/code/session_01Ps5Qw92ubEyzQQkG3Uvjdk