From: Kees Monshouwer Date: Sun, 31 Aug 2014 10:12:39 +0000 (+0200) Subject: revert setpgrp changes X-Git-Tag: auth-3.4.0-rc2~26^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=882ca9d98631329782c5ad62ceaaada93aa541d8;p=thirdparty%2Fpdns.git revert setpgrp changes Revert "Terminate pdns process after SIGINT" 5c663d99afcdd3c26d5744a47911840e16265b6d. Revert "PDNS should always be the leader of the process group" 1a3bbc1bafea87169a1ed78f78a964ba06231b11. Revert "Clean up after the pdns_server-instance" 6f8e772b634101a19106e23f20c5358357adf6d8. Revert "Clean up after DynListener crash" 233f08a1de5508ca4ee67de9bc90045c2cd0cf63. Revert "pdns: Kill all spawned processes" ee443da2d3ca2f831bbc2347088498890417ec13. Revert "no systemd kill signals required, pdns_control take care of this" efd72fc50f71df4cd7036d960fa1814c15e4f230. --- diff --git a/contrib/systemd-pdns.service b/contrib/systemd-pdns.service index 0238e8a4fd..aab895c70e 100644 --- a/contrib/systemd-pdns.service +++ b/contrib/systemd-pdns.service @@ -6,7 +6,6 @@ After=network-online.target mysqld.service postgresql.service slapd.service Type=forking ExecStart=/usr/sbin/pdns_server --daemon ExecStop=/usr/bin/pdns_control quit -KillMode=none Restart=on-failure RestartSec=2 PrivateTmp=true diff --git a/pdns/dynlistener.cc b/pdns/dynlistener.cc index ad556ee83a..8e6dc142e7 100644 --- a/pdns/dynlistener.cc +++ b/pdns/dynlistener.cc @@ -195,8 +195,6 @@ void *DynListener::theListenerHelper(void *p) DynListener *us=static_cast(p); us->theListener(); L<d_ppid)<<") with it"<d_ppid),SIGKILL); return 0; } diff --git a/pdns/pdns-recursor.init.d b/pdns/pdns-recursor.init.d index df7e7701c4..157a881ab3 100755 --- a/pdns/pdns-recursor.init.d +++ b/pdns/pdns-recursor.init.d @@ -57,7 +57,7 @@ case "$1" in force-stop) echo -n "Stopping PowerDNS recursing nameserver: " - killall -v -g -9 pdns_server + killall -v -9 pdns_server echo "killed" ;; diff --git a/pdns/receiver.cc b/pdns/receiver.cc index af38f2bbae..d2b16fbd39 100644 --- a/pdns/receiver.cc +++ b/pdns/receiver.cc @@ -118,11 +118,9 @@ static void takedown(int i) { if(cpid) { L<&parts, pid_t ppid) { - kill(-getpgid(cpid), SIGKILL); + kill(cpid, SIGKILL); // why? + kill(cpid, SIGKILL); // why? sleep(1); return "ok"; } @@ -196,6 +195,7 @@ static int guardian(int argc, char **argv) string progname=argv[0]; bool first=true; + cpid=0; pthread_mutex_lock(&g_guardian_lock); @@ -215,15 +215,12 @@ static int guardian(int argc, char **argv) setbuf(g_fp,0); // no buffering please, confuses select if(!(pid=fork())) { // child + signal(SIGTERM, SIG_DFL); + signal(SIGHUP, SIG_DFL); signal(SIGUSR1, SIG_DFL); signal(SIGUSR2, SIG_DFL); - // Set different pgrp for this child, - // so we could kill all of it's children - // with one kill call - setpgid(getpid(), 0); - char **const newargv=new char*[argc+2]; int n; @@ -268,6 +265,8 @@ static int guardian(int argc, char **argv) if(first) { first=false; + signal(SIGTERM, takedown); + signal(SIGHUP, SIG_IGN); signal(SIGUSR1, SIG_IGN); signal(SIGUSR2, SIG_IGN); @@ -312,7 +311,8 @@ static int guardian(int argc, char **argv) L<