hang on exit bug under Linux

Rachit Siamwalla rachit at ensim.com
Tue Dec 11 09:09:20 EST 2001


>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).

Lets say you have a stupid script that does

while 1
do
   sleep 1
done

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.

---

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).

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

-----Original Message-----
From: Michael [mailto:michael at bizsystems.com]
Sent: Monday, December 10, 2001 1:23 PM
To: openssh-unix-dev at mindrot.org
Subject: Re: hang on exit bug under Linux


> On Mon, Dec 10, 2001 at 10:50:06AM -0800, Dan Kaminsky wrote:
> > Look: ssh user at host "command" needs to never, ever hang.
> 
> wrong.
> 
> it needs to hang.
> 
> it needs to hang until it can be sure that 'command' does not need
> any input.
> 
> it needs to hang until it can be sure that 'command' does not
> produce any output.
> 
> it needs to hang until 'command' exits because sshd needs to tell
> the exit status from 'command' to ssh.
> 

So from a sysadmin's view point, some fool writes a piece of buggy 
software which hundreds of shell users decide to use and they then 
proceed to connect to the host via ssh and leave hundreds of "hung" 
sshd's in the process table, or even just one user with a cron job 
doing a repeated action. That sounds just great. Why on earth should 
anyone use openssh if they can expect it to mess up the operation of 
an entire system because it is BROKEN. This is a problem that will 
not go away. You can assert that script writers should do a better 
job, but they won't and that is why they write scripts.

Your response requesting me to write the code is something I can't 
do. I only have access to Linux boxes and have no clue (and would not 
presume to know) what the implications are for sun, aix, hp, 
bsd, etc... Closing off discussion on the issue won't fix it either. 
I don't mean to be a pest, but I consider openssh to be an excellent 
tool that does a lot to promote security in general and security at 
our site in particular. I'd like to see it work well. It seems to 
have one glaring flaw this one glaring flaw that needs to be fixed to 
make it generally acceptable as a replacement for virtually all other 
remote shell access programs. Saying that rsh is broken also simply 
doesnt' justify why a program under active development by a very 
bright group of people has to be broken also.

Michael
Michael at Insulin-Pumpers.org



More information about the openssh-unix-dev mailing list