summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-05-24 09:14:45 +0200
committerThomas Haller <thaller@redhat.com>2019-05-24 09:36:34 +0200
commit0f2cbca649b36d7ff6cfdb05d46038a40c24c78f (patch)
treee2a890dbaf5fc76c0953a5f7211b64cb4885b29c
parentb92452dd69bf178b9d1cdb5f99683d409e87e38b (diff)
downloadNetworkManager-th/dispatcher-cleanup.tar.gz
dispatcher: log warning when nm-dispatcher quits with requests pendingth/dispatcher-cleanup
-rw-r--r--dispatcher/nm-dispatcher.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/dispatcher/nm-dispatcher.c b/dispatcher/nm-dispatcher.c
index 647caa5809..d62ea3f65b 100644
--- a/dispatcher/nm-dispatcher.c
+++ b/dispatcher/nm-dispatcher.c
@@ -1082,6 +1082,21 @@ main (int argc, char **argv)
done:
+ if (gl.num_requests_pending > 0) {
+ /* this only happens when we quit due to SIGTERM (not due to the idle timer).
+ *
+ * Log a warning about pending scripts.
+ *
+ * Maybe we should notify NetworkManager that these scripts are left in an unknown state.
+ * But this is either a bug of a dispatcher script (not terminating in time).
+ *
+ * FIXME(shutdown): Also, currently NetworkManager behaves wrongly on shutdown.
+ * Note that systemd would not terminate NetworkManager-dispatcher before NetworkManager.
+ * It's NetworkManager's responsibility to keep running long enough so that all requests
+ * can complete (with a watchdog timer, and a warning that user provided scripts hang). */
+ _LOG_X_W ("exiting but there are still %u requests pending", gl.num_requests_pending);
+ }
+
if (dbus_own_name_id != 0)
g_bus_unown_name (nm_steal_int (&dbus_own_name_id));