hang on exit bug under Linux

Nicolas Williams Nicolas.Williams at ubsw.com
Tue Dec 11 15:20:14 EST 2001


On Mon, Dec 10, 2001 at 02:09:20PM -0800, Rachit Siamwalla wrote:
> >From what I understand, the problem is due to people's disagreement about what the "correct" behavior should be. I'm pretty sure that the following is the correct behavior from running rsh and ssh often (both fsecure and openssh).

Some people don't get stdio. Hey.

> Called foreverSleep on your remote host:
> 
> rsh remotehost "foreverSleep &"
> 
> Should and does hang (on Linux and Solaris at least).
> 
> HOWEVER,
> 
> rsh remotehost
> # foreverSleep &
> # exit
> 
> does NOT hang.

It should do a killpg() to send SIGHUP to the relevant processes. What
if they don't want to die? Huh?

> ---
> 
> If you run openssh, like the following:
> 
> ssh remotehost "foreverSleep &"
> 
> Should and does hang (fsecure hangs as well).
> 
> HOWEVER,
> 
> ssh remotehost
> # foreverSleep &
> # exit
> 
> DOES hang. (fsecure does not hang) This is where the bug is. If you run ssh with a tty and in interactive mode, if the client decides to disconnect, it disconnects cleanly (I'm not sure about what happens to the remaining processes, you will have to look at rsh code for that -- it may be SIGHUP or something, i dunno -- other posts may be clearer on this).

What if "foreverSleep" needs a forwarded agent/port/x11? Huh? What if it
doesn't exit if sshd sends it SIGHUP when you exit?

I say: with ptys, send SIGHUP when the main process exits and/or when
the client closes the session.

Perhaps there should be an option like -n for the client but which
applies to stdout and stderr for the faint of heart who refuse to
understand '>' and '2>' and '2>&1' and so on.

> I hope I'm not just stating the obvious, and hope this clears things up. If I'm wrong about the behaviours, let me know. I really think we should figure out what the correct behaviour should be before trying to come up with a fix.
> 
> -rchit


Cheers,

Nico
--
-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