SSH connection hanging on logout

Markus Friedl markus.friedl at informatik.uni-erlangen.de
Thu May 17 06:36:27 EST 2001


On Wed, May 16, 2001 at 08:18:03AM -0000, John Bowman wrote:
> The third item is another type of hanging bug in Openssh, as is
> demonstrated by the following test:
> 
> ssh -2 host
> xterm -e sleep 20 &
> exit
> 
> Even after the xsession terminates, the ssh session is left hanging forever.
> The correct behaviour is to wait 20 seconds for the X application to close
> and then exit.

this is a client bug. try this:

Index: clientloop.c
===================================================================
RCS file: /home/markus/cvs/ssh/clientloop.c,v
retrieving revision 1.70
diff -u -r1.70 clientloop.c
--- clientloop.c	2001/05/11 14:59:55	1.70
+++ clientloop.c	2001/05/16 20:31:44
@@ -346,7 +346,13 @@
 		if (buffer_len(&stderr_buffer) > 0)
 			FD_SET(fileno(stderr), *writesetp);
 	} else {
-		FD_SET(connection_in, *readsetp);
+		/* channel_prepare_select could have closed the last channel */
+		if (session_closed && !channel_still_open()) {
+			if (!packet_have_data_to_write())
+				return;
+		} else {
+			FD_SET(connection_in, *readsetp);
+		}
 	}
 
 	/* Select server connection if have data to write to the server. */



More information about the openssh-unix-dev mailing list