Sure I'll give that a shot.  I haven't looked at the unit tests so it might 
take me a bit to write a test.

Darren

> On Feb 10, 2014, at 1:49 PM, Guillaume Nodet <[email protected]> wrote:
> 
> Do you think you can raise a JIRA and write a junit test so that I can have
> a look ?
> 
> 
> 2014-02-10 18:13 GMT+01:00 Darren Shepherd <[email protected]>:
> 
>> I'm doing a lot of reverse forwarding and ran into a situation in which I
>> thought I was leaking sockets.  If you do a reverse forward and then just
>> keep connecting and disconnecting to the port the number of open sockets
>> just keeps going up.
>> 
>> What I figured out is that it's not really going up it just takes awhile
>> to close.  If you connect to the port every 5 seconds it will level off at
>> a couple hundred.  The ssh server sends a channel eof but the socket
>> doesn't get released until some other thread comes along that seems to
>> clean up sessions.  I don't fully understand the details of that.
>> 
>> What I've done to work around this issue is just close the sockets on
>> channel eof.  I'm not really sure if that is a generally safe change, but
>> it is working for my use case.
>> 
>> I'm not sure what a proper fix would be or even if this is consider a bug,
>> but the end result of the behavior is that reverse forwarding is not useful
>> when you expect to have connections happening regularly.  You will quickly
>> run out of FDs.
>> 
>> Darren

Reply via email to