hang on exit bug under Linux

Michael michael at bizsystems.com
Wed Dec 12 10:13:01 EST 2001


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

A real example would be a perl program that runs as a daemon
#!/usr/bin/perl
unless ($pid = fork) {
   unless (fork) {
       open(SDOUT,'>/dev/null');
       open(STDERR,'>/dev/null');
       open (X, 'some_process 2>&1 |'); # that generates stdio to X 
       while (X) {   # real program uses select
             do something
       }
     # dies
       exit 0;
   }
   waitpid($pid,0);
   exit 0;
}


This process will hang ssh, it should not. ....or please tell me why 
it should.

Michael
Michael at Insulin-Pumpers.org



More information about the openssh-unix-dev mailing list