-
Type:
Change Request
-
Resolution: Unresolved
-
Priority:
Minor
-
None
-
Affects Version/s: 7.0.28, 7.4.12, 8.0.0beta2
-
Component/s: Proxy (P), Server (S)
-
None
With systemd you can configure WatchdogSec=X parameter if application support NOTIFY_SOCKET (env var).
Example:
#include <systemd/sd-daemon.h> // link with -lsystemd
uint64_t usec;
if (sd_watchdog_enabled(0, &usec) > 0) {
// ping at half the interval, from your main loop
// usec = WatchdogSec in microseconds
}
sd_notify(0, "WATCHDOG=1");
Why can be useful - if application hung, systemd is not able to restart it automatically:
- Deadlocks in the main loop (mutex deadlock, stuck blocking syscall, infinite loop)
- Process frozen on unresponsive I/O (NFS hang, stuck DB call — if that call blocks the pinging loop)
- Event loop starvation