I have observed a case when Kamaili debug module try to grab the lock on shutdown and not able to do it. As a result, the Kamailio process is stuck and not able to restart (dead lock).
To resolve such a case i want to utilize systemd watchdog feature https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html#
To use this feature I need send sd_notify(3) with a message string of "WATCHDOG=1" from main process https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html#
According to systemd doc only one process to send watchdog If the $WATCHDOG_USEC environment variable is set, and the $WATCHDOG_PID variable is unset or set to the PID of the current process, the service manager expects notifications from this process. https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html#
Additional info at https://lists.freedesktop.org/archives/systemd-devel/2018-January/040185.htm...
Could you suggest how to embed this systemd call to the main process?
Sergey
As I understand, the application has to periodically send the notification to systemd service manager. I am not sure if this will help with kamailio multiprocesses, when each of them can hung, not only the main process.
Anyhow, there is systemdops module that tries to collect the features related to systemd.
The best would be if there is a shutdown time limit that systemd can watch and if not, do kill -9.
Cheers, Daniel
On 26.06.21 19:08, Sergey Safarov wrote:
I have observed a case when Kamaili debug module try to grab the lock on shutdown and not able to do it. As a result, the Kamailio process is stuck and not able to restart (dead lock).
To resolve such a case i want to utilize systemd watchdog feature https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html# https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html#
To use this feature I need send sd_notify(3) with a message string of "WATCHDOG=1" from main process https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html# https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html#
According to systemd doc only one process to send watchdog If the $WATCHDOG_USEC environment variable is set, and the $WATCHDOG_PID variable is unset or set to the PID of the current process, the service manager expects notifications from this process. https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html# https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html# Additional info at https://lists.freedesktop.org/archives/systemd-devel/2018-January/040185.htm... https://lists.freedesktop.org/archives/systemd-devel/2018-January/040185.html
Could you suggest how to embed this systemd call to the main process?
Sergey
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev