Title: #107: WATCHDOG: Avoid non async-signal-safe from the signal_handler
On Mon, Dec 12, 2016 at 07:30:30AM -0800, Simo Sorce wrote:
well you could have a globalk variable for the watchdog and change it
from a custom signal handler, but the point of the watchdog is to go thorugh the tevent
handler instead so that we are sure the machinery is working and not stuck somwhere.
Resetting directly from the singal handler would bypass all processing and therefore
render the watchdog useless I guess.
The problem here (as I understand it, Pavel or Fabiano can correct me if
I'm wrong) is that the watchdog increases the counter inside a POSIX
signal handler, but resets the counter in a tevent timer (to make sure
the mainloop is being processed).
Now, if the time drifts, we still are receiving the monotonic SIGRT
signals into the POSIX handlers, but because the tevent timer never
gets invoked (it's set to be invoked in a time in the future, because
the time drifted), we never reset the counter.
We can detect the time has drifted in the POSIX SIGRT handler, the
question I'm trying to answer is how should we restart the tevent timer
when we receive the SIGRT signal, but we because we are in the POSIX
handler, we are quite restriced in what we can do..
See the full comment at https://github.com/SSSD/sssd/pull/107#issuecomment-266462611