From 452c224656ca6129d4ae34eee86e6ecea02fa8c2 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 14 Jan 2015 16:30:39 -0600 Subject: [PATCH] dns: kill plugin child synchronously to avoid restart race (rh #1161232) (bgo #728342) NM was killing the dnsmasq local caching nameserver process and immediately starting a new one, and new process couldn't bind to 127.0.0.1 because the old one hadn't quit yet. Thus the new process quit, and the user was left with no split DNS at all. While this does introduce more synchronous waiting into the connection process, it's not that much time and NM will kill dnsmasq if it hasn't quit after 1 second. The longer-term fix is to use dnsmasq's D-Bus interface to update DNS without respawning it. https://bugzilla.gnome.org/show_bug.cgi?id=728342 https://bugzilla.redhat.com/show_bug.cgi?id=1161232 --- src/dns-manager/nm-dns-plugin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dns-manager/nm-dns-plugin.c b/src/dns-manager/nm-dns-plugin.c index 3d593cce8d..5b95d1c50a 100644 --- a/src/dns-manager/nm-dns-plugin.c +++ b/src/dns-manager/nm-dns-plugin.c @@ -183,7 +183,8 @@ nm_dns_plugin_child_spawn (NMDnsPlugin *self, return priv->pid; } -gboolean nm_dns_plugin_child_kill (NMDnsPlugin *self) +gboolean +nm_dns_plugin_child_kill (NMDnsPlugin *self) { NMDnsPluginPrivate *priv = NM_DNS_PLUGIN_GET_PRIVATE (self); @@ -193,7 +194,7 @@ gboolean nm_dns_plugin_child_kill (NMDnsPlugin *self) } if (priv->pid) { - nm_utils_kill_child_async (priv->pid, SIGTERM, LOGD_DNS, priv->progname, 2000, NULL, NULL); + nm_utils_kill_child_sync (priv->pid, SIGTERM, LOGD_DNS, priv->progname, NULL, 1000, 0); priv->pid = 0; g_free (priv->progname); priv->progname = NULL;