From: Edgar Toernig <froese@gmx.de>
To: Michael Harris <mharris@torque.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: Failure to deliver SIGCHLD
Date: Sat, 23 Jul 2005 06:40:36 +0200 [thread overview]
Message-ID: <20050723064036.67407a80.froese@gmx.de> (raw)
In-Reply-To: <42E120BF.6090504@torque.net>
Michael Harris wrote:
>
> [2.] The problem occurs in a forking server similar in function to
> inetd. The server employs a very simple SIGCHLD handler that loops on
> wait(2), until all zombie processes have been collected. For no
> immediately apparent reason, the parent process behaves as if it no
> longer receives SIGCHLD. Manually sending the signal has no effect.
Sounds like a blocked signal.
> [6.] This is the code for the signal handler in the server application.
>
> void reaper_man (int signum)
> {
> int stat;
> while ( waitpid(-1, &stat, WNOHANG) > 0 );
> }
>
> signal (SIGCHLD, reaper_man); /* from main() */
>
> I dare say it contains no bugs (famous last words)
It does - it clobbers errno :-)
My suggestions: use sigaction with defined restart/mask/etc behaviour
instead of signal. Save and restore errno in the signal handler.
Make sure SIGCHLD isn't blocked.
But if your only interest is to get rid of the zombies, the most simple
solution would be to set SIGCHLD to ignore.
Ciao, ET.
prev parent reply other threads:[~2005-07-23 4:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-22 16:37 PROBLEM: Failure to deliver SIGCHLD Michael Harris
2005-07-23 4:40 ` Edgar Toernig [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050723064036.67407a80.froese@gmx.de \
--to=froese@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mharris@torque.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox