From: Wouter Wijngaards Date: Mon, 12 Nov 2007 11:10:11 +0000 (+0000) Subject: Fixup for signal handling. No more dangling unbound processes after X-Git-Tag: release-0.6~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0ee55323964a5e5d067ada4ccdf9033b34bff072;p=thirdparty%2Funbound.git Fixup for signal handling. No more dangling unbound processes after test suite. git-svn-id: file:///svn/unbound/trunk@739 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/daemon.c b/daemon/daemon.c index 1ef5f6cd3..7a59974ee 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -108,10 +108,10 @@ signal_handling_record() static void signal_handling_playback(struct worker* wrk) { - if(sig_record_quit) - worker_sighandler(SIGTERM, wrk); if(sig_record_reload) worker_sighandler(SIGHUP, wrk); + if(sig_record_quit) + worker_sighandler(SIGTERM, wrk); sig_record_quit = 0; sig_record_reload = 0; } @@ -425,9 +425,7 @@ daemon_fork(struct daemon* daemon) /* we exited! a signal happened! Stop other threads */ daemon_stop_others(daemon); - if(daemon->workers[0]->need_to_restart) - daemon->need_to_exit = 0; - else daemon->need_to_exit = 1; + daemon->need_to_exit = daemon->workers[0]->need_to_exit; } void diff --git a/daemon/worker.c b/daemon/worker.c index 64ee700a3..73cd24b70 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -790,22 +790,21 @@ worker_sighandler(int sig, void* arg) switch(sig) { case SIGHUP: verbose(VERB_DETAIL, "caught signal SIGHUP"); - worker->need_to_restart = 1; comm_base_exit(worker->base); break; case SIGINT: verbose(VERB_DETAIL, "caught signal SIGINT"); - worker->need_to_restart = 0; + worker->need_to_exit = 1; comm_base_exit(worker->base); break; case SIGQUIT: verbose(VERB_DETAIL, "caught signal SIGQUIT"); - worker->need_to_restart = 0; + worker->need_to_exit = 1; comm_base_exit(worker->base); break; case SIGTERM: verbose(VERB_DETAIL, "caught signal SIGTERM"); - worker->need_to_restart = 0; + worker->need_to_exit = 1; comm_base_exit(worker->base); break; default: @@ -851,7 +850,7 @@ worker_init(struct worker* worker, struct config_file *cfg, { unsigned int seed; int startport; - worker->need_to_restart = 0; + worker->need_to_exit = 0; worker->base = comm_base_create(); if(!worker->base) { log_err("could not create event handling base"); diff --git a/daemon/worker.h b/daemon/worker.h index 94d1c65e6..2fbdb9e5d 100644 --- a/daemon/worker.h +++ b/daemon/worker.h @@ -99,8 +99,8 @@ struct worker { /** random() table for this worker. */ struct ub_randstate* rndstate; - /** do we need to restart (instead of exit) ? */ - int need_to_restart; + /** do we need to restart or quit (on signal) */ + int need_to_exit; /** allocation cache for this thread */ struct alloc_cache alloc; /** per thread statistics */ diff --git a/doc/Changelog b/doc/Changelog index a1676d7dd..42390527a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +12 November 2007: Wouter + - fixup signal handling where SIGTERM could be ignored if a SIGHUP + arrives later on. + 9 November 2007: Wouter - took ldns snapshot in repo. - default config file is /etc/unbound/unbound.conf. diff --git a/testdata/fwd_compress_c00c.tpkg b/testdata/fwd_compress_c00c.tpkg index 905bb1b3c..372d25556 100644 Binary files a/testdata/fwd_compress_c00c.tpkg and b/testdata/fwd_compress_c00c.tpkg differ