SSH -R problem

Steve Chew
Tue Apr 9 20:51:00 GMT 2002

	I've found a problem when running OpenSSH under Cygwin on Win98.
The problem occurs when using the "ssh -R" option to do port forwarding
from a remote host to my local machine.  The remote machine is a Linux
box running OpenSSH sshd.
	Everything works OK at first but after enough sessions are made
across the SSH tunnel, I can no longer open sockets and other network
programs on the Cygwin system (such as IE) fail.  If I create enough 
sessions the entire system can hang.

    By sessions, I mean the following:  
	- I open a connection with telnet (or whatever) across the SSH tunnel
	- I then close the connection before opening a new connection.
	- So, there should be no open sockets after each session.

	One symptom of the problem is that after each session
I end up with an extra socket in the LISTEN state on the Cygwin box
(use netstat -an to check the socket states).  I don't know why there
would even be any sockets in the LISTEN state on the Cygwin box since
the ssh client shouldn't have to do a listen.
	What ends up happening is that I keep accumulating extra 
sockets in the LISTEN state (one for each session).  I believe that 
Cygwin + "ssh -R" are combining to use up all of the file descriptors 
on the system due to the extra sockets in the LISTEN state.

	I have installed the latest Cygwin binaries and it still
happens.  A similar problem happens on Windows 2000.  But, it only 
happens on Win2k when there is no server listening for connections on 
the Cygwin box.  This problem does *not* happen when using OpenSSH on 
	The results of a cygcheck are at this URL:

	I went ahead and got the source code for OpenSSH and put some
debugging output into it to see if it was inadvertently doing a listen()
but as far as I could tell it wasn't.
	Has anyone else seen this problem?  I find the problem pretty
debilitating since I want to run the tunnel to my local server for a
long period of time and use a lot of connections but it ends up hanging 
the system.
	Any help would be appreciated.  :)


P.S.  Another issue that may be related is that when there is no server
on the Cygwin box listening for connections across the SSH tunnel I 
would expect that a telnet across the tunnel would result in a 
Connection Refused message.  This is what happens when using Solaris
instead of Cygwin.  Instead, the connection just hangs until it is

Unsubscribe info:
Bug reporting:

More information about the Cygwin mailing list