[PATCH] Re: bin/32295: pthread dont dequeue signals

Andrew Belashov bel at orel.ru
Fri Sep 10 03:31:36 PDT 2004


Hello, All!

About one year I use my patch for open PR bin/32295.
No problem detected on high load mysql server. Also, this patch
tested with mozilla and firefox.

Patch in attachment. Alternate location:

<http://www.orel.ru/~bel/patches/uthread_sig.c.diff>

Problem description:

In function _thread_sig_handler() received signal queued (by writing into pipe).

===============================================================================
                 if (_queue_signals != 0) {
                         __sys_write(_thread_kern_pipe[1], &c, 1);
                         DBG_MSG("Got signal %d, queueing to kernel pipe\n", sig);
                 }
===============================================================================

But flag _sigq_check_reqd (Check of queue of signals is required) is not touched
if signal should be ignored:

===============================================================================
                 if (_thread_sigq[sig - 1].blocked == 0) {
                         [.........]

                         /* Indicate that there are queued signals: */
                         _thread_sigq[sig - 1].pending = 1;
                         _sigq_check_reqd = 1;
                 }
                 /* These signals need special handling: */
                 else if (sig == SIGCHLD || sig == SIGTSTP ||
                     sig == SIGTTIN || sig == SIGTTOU) {
                         _thread_sigq[sig - 1].pending = 1;
                         _thread_sigq[sig - 1].signo = sig;
                         _sigq_check_reqd = 1;
                 }
                 else {
                         DBG_MSG("Got signal %d, ignored.\n", sig);
                 }
===============================================================================

In this situation, dequeue signal handler is not executed and signal
does not dequeued from pipe...

This is bug and patch should be commited.

--
With best regards,
Andrew Belashov.
-------------- next part --------------
--- lib/libc_r/uthread/uthread_sig.c.orig	Wed Dec  3 09:54:40 2003
+++ lib/libc_r/uthread/uthread_sig.c	Fri Sep 10 10:50:32 2004
@@ -160,8 +160,10 @@
 			_thread_sigq[sig - 1].signo = sig;
 			_sigq_check_reqd = 1;
 		}
-		else
+		else {
 			DBG_MSG("Got signal %d, ignored.\n", sig);
+			_sigq_check_reqd = 1;
+		}
 	}
 	/*
 	 * The signal handlers should have been installed so that they


More information about the freebsd-threads mailing list