SIGCHLD race condition?

Nicolas Williams Nicolas.Williams at ubsw.com
Thu Sep 27 04:20:48 EST 2001


I see. Well, it seems that the fundamental problem is that select()
can't be interrupted when the child exits, no? You can't have SIGCHLD
unblock when select() is called...

The pipe solution looks like it would be the most elegant...

The 10 second select() timeout is not too ugly a solution either.
It's only needed when the child fds are closed and you're waiting for
input from the client and for the child to exit.

Nico


On Wed, Sep 26, 2001 at 11:07:27AM -0700, Paul Menage wrote:
> >How about:
> >
> > - selecting for exceptions -- remove dead fildeses from the read/write
> >   select masks (will this catch ptys where the child has close its
> >   stdio?)
> >
> > - if select() will be called only with the client connection socket,
> >   then the child must have closed its stdio -- either check wether the
> >   child is alive or add a timeout to the select() or plain and simply
> >   exit.
> >
> 
> In the situation in question, both channels to the child have been
> closed, and the server knows this. wait_until_can_do_something() does
> check whether the child has exited, but there's a window between the
> check and the call to select() that can cause lockups.
> 
> The server can't exit until it knows that the child has exited, as
> otherwise it can't return the child's exit status to the client. Adding
> a maximum 10 second timeout to select() is the temporary solution that
> we're using, as the problem occurs rarely enough that waiting 10 seconds
> occasionally isn't a problem.
> 
> Paul
--
-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 http://www.ubswarburg.com

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