core: add and use NM_SHUTDOWN_TIMEOUT_MS as duration that we plan for shutdown

System Internals / NetworkManager - Thomas Haller [redhat.com] - 25 May 2018 10:35 EDT

nm_ppp_manager_stop() wants to ensure that the pppd process is really gone. For that it uses nm_utils_kill_child_async() to first send SIGTERM, and sending SIGKILL after a timeout.

Later, we want to fix shutdown of NetworkManager to iterate the mainloop during shutdown, so that such operations are still handled. However, we can only delay shutdown for a certain time. After a timeout (NM_SHUTDOWN_TIMEOUT_MS plus NM_SHUTDOWN_TIMEOUT_MS_GRACE) we really have to give up and terminate.

That means, the right amount of time between sending SIGTERM and SIGKILL is exactly NM_SHUTDOWN_TIMEOUT_MS. Hopefully that is of course sufficient in the first place. If not, send SIGKILL afterwards, and give a bit more time (NM_SHUTDOWN_TIMEOUT_MS_GRACE) to reap the child. And if all this time is still not enough, something is really odd and we abort waiting, with a warning in the logfile.

Since we don't properly handle shutdown yet, the description above is not really true. But with this patch, we fix it from point of view of NMPPPManager.

eaf36db68 core: add and use NM_SHUTDOWN_TIMEOUT_MS as duration that we plan for shutdown
src/NetworkManagerUtils.h | 19 +++++++++++++++++++
src/ppp/nm-ppp-manager.c | 3 ++-
2 files changed, 21 insertions(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share