summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorchuck <chuck@NetBSD.org>2006-06-12 16:45:14 +0000
committerchuck <chuck@NetBSD.org>2006-06-12 16:45:14 +0000
commitf4e3e7fe3b81ebbe21992d3a900f002b191fba3e (patch)
tree92c63b08c4d3b21975d1c6d6254773191cbc07dd /lib/libpthread
parent639e2af40a0f08077426e82288a52acb63fdb296 (diff)
sigtimedwait: if we collect a queued signal via pt_siglist, do not
forget to clear it out of pt_siglist, otherwise we will keep getting it over and over again. fixes a problem introduced in rev 1.43. problem observed with mysqld where sending it a SIGHUP after it has set an alarm (e.g. due to some package like rt3 using it) caused the signal handler thread to go into a tight loop (collecting a SIGALRM [via sigwait() in mysqld.cc] that would not go away due to the above issue). mysqld appears to get a SIGHUP when /etc/rc exits, so it can go into this tight loop after a reboot (but not if you restart it by hand). the bad sequence is: /etc/rc runs: - starts mysqld - starts web server with rt3 fastcgi starts - fastcgi/rt3 talks to mysqld (causing it to set an alarm) - /etc/rc exits, SIGHUP goes to mysqld - mysqld catches SIGHUP, signal handler thread gets stuck in loop (database continues to operate, slowly). you can also trigger the problem by sending mysqld a SIGHUP by hand after you've caused it to set an alarm by connecting to it.
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/pthread_sig.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libpthread/pthread_sig.c b/lib/libpthread/pthread_sig.c
index 518a819aad6..17ad6f22adc 100644
--- a/lib/libpthread/pthread_sig.c
+++ b/lib/libpthread/pthread_sig.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_sig.c,v 1.45 2006/04/24 19:00:30 snj Exp $ */
+/* $NetBSD: pthread_sig.c,v 1.46 2006/06/12 16:45:14 chuck Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_sig.c,v 1.45 2006/04/24 19:00:30 snj Exp $");
+__RCSID("$NetBSD: pthread_sig.c,v 1.46 2006/06/12 16:45:14 chuck Exp $");
/* We're interposing a specific version of the signal interface. */
#define __LIBC12_SOURCE__
@@ -326,6 +326,7 @@ sigtimedwait(const sigset_t * __restrict set, siginfo_t * __restrict info,
sig = firstsig(&wset);
if (sig) {
info->si_signo = sig;
+ __sigdelset14(&self->pt_siglist, sig); /* clear it */
pthread_spinunlock(self, &self->pt_siglock);
pthread__testcancel(self);
return 0;