- Fix bug in fix for log locks that caused deadlock in signal handler.

git-svn-id: file:///svn/unbound/trunk@3182 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2014-07-12 17:34:37 +00:00
parent 0688d6443f
commit 06bfd7bd22
3 changed files with 9 additions and 12 deletions

View file

@ -109,8 +109,9 @@ int ub_c_lex_destroy(void);
static RETSIGTYPE record_sigh(int sig) static RETSIGTYPE record_sigh(int sig)
{ {
#ifdef LIBEVENT_SIGNAL_PROBLEM #ifdef LIBEVENT_SIGNAL_PROBLEM
verbose(VERB_OPS, "quit on signal, no cleanup and statistics, " /* cannot log, verbose here because locks may be held */
"because installed libevent version is not threadsafe"); /* quit on signal, no cleanup and statistics,
because installed libevent version is not threadsafe */
exit(0); exit(0);
#endif #endif
switch(sig) switch(sig)
@ -135,7 +136,8 @@ static RETSIGTYPE record_sigh(int sig)
break; break;
#endif #endif
default: default:
log_err("ignoring signal %d", sig); /* ignoring signal */
break;
} }
} }

View file

@ -982,37 +982,31 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
void void
worker_sighandler(int sig, void* arg) worker_sighandler(int sig, void* arg)
{ {
/* note that log, print, syscalls here give race conditions. */ /* note that log, print, syscalls here give race conditions.
/* we still print DETAIL logs, because this is extensive per message * And cause hangups if the log-lock is held by the application. */
* logging anyway, and the operator may then have an interest
* in the cause for unbound to exit */
struct worker* worker = (struct worker*)arg; struct worker* worker = (struct worker*)arg;
switch(sig) { switch(sig) {
#ifdef SIGHUP #ifdef SIGHUP
case SIGHUP: case SIGHUP:
verbose(VERB_QUERY, "caught signal SIGHUP");
comm_base_exit(worker->base); comm_base_exit(worker->base);
break; break;
#endif #endif
case SIGINT: case SIGINT:
verbose(VERB_QUERY, "caught signal SIGINT");
worker->need_to_exit = 1; worker->need_to_exit = 1;
comm_base_exit(worker->base); comm_base_exit(worker->base);
break; break;
#ifdef SIGQUIT #ifdef SIGQUIT
case SIGQUIT: case SIGQUIT:
verbose(VERB_QUERY, "caught signal SIGQUIT");
worker->need_to_exit = 1; worker->need_to_exit = 1;
comm_base_exit(worker->base); comm_base_exit(worker->base);
break; break;
#endif #endif
case SIGTERM: case SIGTERM:
verbose(VERB_QUERY, "caught signal SIGTERM");
worker->need_to_exit = 1; worker->need_to_exit = 1;
comm_base_exit(worker->base); comm_base_exit(worker->base);
break; break;
default: default:
log_err("unknown signal: %d, ignored", sig); /* unknown signal, ignored */
break; break;
} }
} }

View file

@ -2,6 +2,7 @@
- Fix getentropy compat code, function refs were not portable. - Fix getentropy compat code, function refs were not portable.
- Fix to check openssl version number only for OpenSSL. - Fix to check openssl version number only for OpenSSL.
- LibreSSL provides compat items, check for that in configure. - LibreSSL provides compat items, check for that in configure.
- Fix bug in fix for log locks that caused deadlock in signal handler.
11 July 2014: Matthijs 11 July 2014: Matthijs
- fake-rfc2553 patch (thanks Benjamin Baier). - fake-rfc2553 patch (thanks Benjamin Baier).