diff options
author | Dan Winship <danw@gnome.org> | 2014-03-31 08:38:06 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-04-18 11:29:14 -0400 |
commit | d9334503d77167463edef8cf98445c3678271c5a (patch) | |
tree | 1f2ae78a0de3ce0b8f7daba88bcc5dfbe09e372d /callouts | |
parent | 1796aae7510e6420bb0c60f9519718ccc85f9c96 (diff) | |
download | NetworkManager-d9334503d77167463edef8cf98445c3678271c5a.tar.gz |
dispatcher: bump script timeout up to 20 seconds (rh #1048345)
The dispatcher would kill scripts after 3 seconds, but on
heavily-loaded machines, that was sometimes too short even for simple
scripts. Bump the timeout up to 20 seconds instead (and change the
10-second quit-on-idle timer to not run when a script is running).
Also change the D-Bus call timeout in the daemon to 30 seconds, so
that it only triggers if something goes really wrong and the action
timeout fails.
Diffstat (limited to 'callouts')
-rw-r--r-- | callouts/nm-dispatcher-action.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c index f48ff0a23a..11aa5dc4f1 100644 --- a/callouts/nm-dispatcher-action.c +++ b/callouts/nm-dispatcher-action.c @@ -149,10 +149,18 @@ quit_timeout_cb (gpointer user_data) } static void -quit_timeout_reschedule (Handler *h) +quit_timeout_cancel (Handler *h) { - if (h->quit_id) + if (h->quit_id) { g_source_remove (h->quit_id); + h->quit_id = 0; + } +} + +static void +quit_timeout_reschedule (Handler *h) +{ + quit_timeout_cancel (h); if (!h->persist) h->quit_id = g_timeout_add_seconds (10, quit_timeout_cb, NULL); } @@ -165,8 +173,6 @@ next_script (gpointer user_data) GValueArray *item; guint i; - quit_timeout_reschedule (request->handler); - request->idx++; if (request->idx < request->scripts->len) { dispatch_one_script (request); @@ -203,9 +209,11 @@ next_script (gpointer user_data) } dbus_g_method_return (request->context, results); + g_ptr_array_unref (results); + quit_timeout_reschedule (request->handler); request_free (request); - g_ptr_array_unref (results); + return FALSE; } @@ -353,7 +361,7 @@ dispatch_one_script (Request *request) if (g_spawn_async ("/", argv, request->envp, G_SPAWN_DO_NOT_REAP_CHILD, child_setup, request, &script->pid, &error)) { request->script_watch_id = g_child_watch_add (script->pid, (GChildWatchFunc) script_watch_cb, script); - request->script_timeout_id = g_timeout_add_seconds (3, script_timeout_cb, script); + request->script_timeout_id = g_timeout_add_seconds (20, script_timeout_cb, script); } else { g_warning ("Failed to execute script '%s': (%d) %s", script->script, error->code, error->message); @@ -435,7 +443,7 @@ impl_dispatch (Handler *h, return; } - quit_timeout_reschedule (h); + quit_timeout_cancel (h); request = g_malloc0 (sizeof (*request)); request->handler = h; |