Skip to content

Add systemd watchdog notifications during sleep intervals#57

Open
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
assisted-by-ai:claude/investigate-sdwdate-bug-oKU75
Open

Add systemd watchdog notifications during sleep intervals#57
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
assisted-by-ai:claude/investigate-sdwdate-bug-oKU75

Conversation

@assisted-by-ai
Copy link
Copy Markdown

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

  • Replaced single time.sleep() call with a loop that breaks sleep into 60-second intervals
  • Added SDNOTIFY_OBJECT.notify("WATCHDOG=1") calls after each sleep chunk to keep systemd watchdog alive
  • Removed large block of commented-out legacy code that documented previous attempts to use shell sleep command
  • Maintains the same total sleep duration while improving service reliability under systemd supervision

Implementation Details

  • Sleep intervals are capped at 60 seconds to ensure watchdog notifications occur frequently enough
  • The loop calculates remaining sleep time and uses the minimum of the watchdog interval or remaining time for each chunk
  • This approach is compatible with the existing nanosecond precision in sleep calculations

https://claude.ai/code/session_01Ps5Qw92ubEyzQQkG3Uvjdk

…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
@ArrayBolt3
Copy link
Copy Markdown
Contributor

This is unnecessary IMO. The maximum sleep time in wait_sleep() is 180 minutes, the WatchdogSec value in /usr/lib/systemd/system/sdwdate.service is 200 minutes. Unless sdwdate takes 20 minutes to do whatever it does between sleeps, systemd shouldn't terminate it (and if sdwdate does take 20 minutes to do whatever it does between sleeps, systemd probably should terminate it to let us know there's a bug causing extremely slow operation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants