SIGCHLD race condition?

Nicolas Williams Nicolas.Williams at
Thu Oct 4 05:05:56 EST 2001

On Wed, Oct 03, 2001 at 02:01:31PM -0500, mouring at wrote:
> On Wed, 3 Oct 2001, Nicolas Williams wrote:
> > On Wed, Oct 03, 2001 at 01:47:59PM -0500, mouring at wrote:
> > > On Wed, 3 Oct 2001, Nicolas Williams wrote:
> > SSHD would still only exit IFF (child is dead && child fildes are dead).
> >
> > The pipe trick is merely a race avoidance technique.


> > Wrong thread, methinks. This is the sigchld-arrived-before-entering-
> > select()-but-after-checking-child_terminated-and-client-has-nothing-
> > to-send-and-the-child's-fildes-are-closed-therefore-sshd-ends-up-
> > waiting-forever-in-select()-for-the-client-to-send-something thread.
> >
> It is related..  The other thread is
> sigchld-arrived-before-select-not-all-file-descriptors-are-closed-select-
> hangs-until-either-a-bit-of-data-appears (IE sleep 30&exit)
> or-hangs-forever (IE vi file, ctrl-Z, ctrl-d).
> It is the same bug in reality.

Yes. But then, when should SSHD exit? Is the above condition correct?
I.e., (child is dead && child fildes are dead)?

Ultimately, the guy who suggested the pipe technique want to know which
solution you're open to so he knows which to code.

So the question is: would the pipe trick satisfy you OpenSSH gods
[provided it works as advertised, of course], or is it still too
earthly? :)

> - Ben

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

Visit our website at

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

More information about the openssh-unix-dev mailing list