Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Sep 2004 14:31:27 +0400
From:      Andrew Belashov <bel@orel.ru>
To:        freebsd-gnats-submit@FreeBSD.org, freebsd-threads@FreeBSD.org
Subject:   [PATCH] Re: bin/32295: pthread dont dequeue signals
Message-ID:  <4141827F.5000002@orel.ru>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000002020101060604040907
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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.

--------------000002020101060604040907
Content-Type: text/plain;
 name="uthread_sig.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="uthread_sig.c.diff"

--- 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

--------------000002020101060604040907--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4141827F.5000002>