From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 11 14:26:22 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 52B8E106566B for ; Wed, 11 Apr 2012 14:26:22 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from qmta04.emeryville.ca.mail.comcast.net (qmta04.emeryville.ca.mail.comcast.net [76.96.30.40]) by mx1.freebsd.org (Postfix) with ESMTP id 34C818FC16 for ; Wed, 11 Apr 2012 14:26:22 +0000 (UTC) Received: from omta21.emeryville.ca.mail.comcast.net ([76.96.30.88]) by qmta04.emeryville.ca.mail.comcast.net with comcast id wdXe1i0011u4NiLA4eSGVB; Wed, 11 Apr 2012 14:26:16 +0000 Received: from damnhippie.dyndns.org ([24.8.232.202]) by omta21.emeryville.ca.mail.comcast.net with comcast id weSE1i01a4NgCEG8heSF9M; Wed, 11 Apr 2012 14:26:15 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id q3BEQDDd059222; Wed, 11 Apr 2012 08:26:13 -0600 (MDT) (envelope-from freebsd@damnhippie.dyndns.org) From: Ian Lepore To: Mel Flynn In-Reply-To: <4F859112.5070005@acsalaska.net> References: <4F859112.5070005@acsalaska.net> Content-Type: text/plain; charset="us-ascii" Date: Wed, 11 Apr 2012 08:26:13 -0600 Message-ID: <1334154373.1082.110.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers Subject: Re: Debugging zombies: pthread_sigmask and sigwait X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2012 14:26:22 -0000 On Wed, 2012-04-11 at 16:11 +0200, Mel Flynn wrote: > Hi, > > I'm currently stuck on a bug in Zarafa-spooler that creates zombies. and > working around it by claiming that our pthread library isn't "normal" > which uses standard signals rather then a signal thread. > > My limited understanding of these facilities is however not enough to > see the actual problem here and reading of related manpages did not lead > me to a solution either. A test case reproducing the problem is attached. > > What happens is that SIGCHLD is never received by the signal thread and > the child processes turn to zombies. Signal counters never go up, not > even for SIGINFO, which I added specifically to see if anything gets > through at all. > > The signal thread shows being stuck in sigwait. It's reproducible on > 8.3-PRERELEASE of a few days ago (r233768). I'm not able to test it on > anything newer unfortunately, but I suspect this is a bug/linuxism in > the code not in FreeBSD. > > Thanks in advance for any insights. > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" The signal mask for a new thread is inherited from the parent thread. In your example code, the signal handling thread inherits the blocked status of the signals as set up in main(). Try adding this line to signal_handler() before it goes into its while() loop: pthread_sigmask(SIG_UNBLOCK, &signal_mask, NULL); -- Ian