When trying to use low values for WatchdogSec attribute, like 2 or 3, tedge-watchdog sends messages with an interval of ~0.001s:
Oct 19 15:35:26 e17ab0835ebd tedge-watchdog[318793]: 2023-10-19T15:35:26.39360965Z WARN tedge_watchdog::systemd_watchdog: No health check response received from device/main/service/tedge-mapper-c8y in time
Oct 19 15:35:26 e17ab0835ebd tedge-watchdog[318793]: 2023-10-19T15:35:26.39486311Z WARN tedge_watchdog::systemd_watchdog: No health check response received from device/main/service/tedge-mapper-c8y in time
Oct 19 15:35:26 e17ab0835ebd tedge-watchdog[318793]: 2023-10-19T15:35:26.39611997Z WARN tedge_watchdog::systemd_watchdog: No health check response received from device/main/service/tedge-mapper-c8y in time
Oct 19 15:35:26 e17ab0835ebd tedge-watchdog[318793]: 2023-10-19T15:35:26.39736915Z WARN tedge_watchdog::systemd_watchdog: No health check response received from device/main/service/tedge-mapper-c8y in time
Oct 19 15:35:26 e17ab0835ebd tedge-watchdog[318793]: 2023-10-19T15:35:26.39863253Z WARN tedge_watchdog::systemd_watchdog: No health check response received from device/main/service/tedge-mapper-c8y in time
Oct 19 15:35:26 e17ab0835ebd tedge-watchdog[318793]: 2023-10-19T15:35:26.399971749Z WARN tedge_watchdog::systemd_watchdog: No health check response received from device/main/service/tedge-mapper-c8y in time
To Reproduce
Connect to c8y
Stop tedge-watchdog and tedge-mapper-c8y services
Add WatchdogSec=3 to /lib/systemd/system/tedge-mapper-c8y.service under [Service] section
Start tedge-watchdog
journalctl -u tedge-watchdog -f should show it sending messages very fast, like in the snippet in the section above
Expected behavior
tedge-watchdog should either forbid a user from setting too low interval, or follow the interval correctly. In the first place, tedge-watchdog using a smaller interval than systemd is unexpected and should be better documented.
The bug is caused by this line. When interval is <4, the result is that 0 is used as a delay between sending messages. Should be an easy fix.
One could argue this low of a timeout makes no sense, and I agree, but I wanted to set it to 2s or 3s only for a test. Still, this behaviour is unexpected and it'd be better for it to be fixed.
Describe the bug
When trying to use low values for
WatchdogSec
attribute, like2
or3
, tedge-watchdog sends messages with an interval of ~0.001s:To Reproduce
tedge-watchdog
andtedge-mapper-c8y
servicesWatchdogSec=3
to/lib/systemd/system/tedge-mapper-c8y.service
under[Service]
sectiontedge-watchdog
journalctl -u tedge-watchdog -f
should show it sending messages very fast, like in the snippet in the section aboveExpected behavior
tedge-watchdog should either forbid a user from setting too low interval, or follow the interval correctly. In the first place, tedge-watchdog using a smaller interval than systemd is unexpected and should be better documented.
Additional context
https://github.com/thin-edge/thin-edge.io/blob/f811fad6e406e6b876059073b2da50fa689dd3c8/crates/core/tedge_watchdog/src/systemd_watchdog.rs#L60
The bug is caused by this line. When
interval
is<4
, the result is that0
is used as a delay between sending messages. Should be an easy fix.One could argue this low of a timeout makes no sense, and I agree, but I wanted to set it to 2s or 3s only for a test. Still, this behaviour is unexpected and it'd be better for it to be fixed.