SIGCHLD race condition?
Paul Menage
pmenage at ensim.com
Thu Sep 27 04:07:27 EST 2001
>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
More information about the openssh-unix-dev
mailing list