[jcifs] accumulation of sockets in CLOSE_WAIT state

Gary Rambo grambo at aventail.com
Mon Mar 8 20:28:29 GMT 2004


I haven't yet come up with a sample program that accumulates CLOSE_WAIT sockets, and I haven't had time to walk down the differences between a sample program and my code. Part of the difficulty is that it typically take a number of weeks to accumulate a dangerous number of CLOSE_WAITs.

For a while I thought moving to 0.8.1 solved it but it didn't.

I'm continuing to work on it.

Thanks.

Gary

Michael B Allen wrote:
> Gary Rambo said:
> 
>>Greetings!
>>
>>I'm accumulating sockets in CLOSE_WAIT state that result from the
>>SmbTransport.ensureOpen() method: before entering the do{}while() loop
> 
> the
> 
>>address.firstCalledName() returns something like SPUD<20>; in the loop
> 
> I
> 
>>get a new NbtSocket with the calledName; the NBSS session request
>>invariably fails with a "Called name not present" response, and I
> 
> cycle
> 
>>through the loop with address.nextCalledName(), get a new NbtSocket
>>returning *SMBSERVER<20>, which invariably works. However the first
>>NbtSocket is left hanging, and netstat shows a buildup of these
>>netbios-ssn sockets in CLOSE_WAIT state. Eventually I hit the
> 
> per-process
> 
>>file descriptor limit and I begin seeing "Too many open files"
> 
> messages as
> 
>>I try to move about.
>>
>>Closing the failed socket appears to close the good socket as well. My
>>workaround is to ignore the firstCalledName() and begin the loop with
> 
> the
> 
>>nextCalledName(). Should firstCalledName() work for the NBSS session
>>request? What's the downside of ignoring it?
> 
> 
> I don't understand this. What are you doing exactly? Are you trying to
> "scan" the network or is this just general purpose usage? Can you write
> a
> trivial program to reproduce this phenomonon? I might be able to do a
> little cleanup but I don't understand why jCIFS would try to open so
> many
> file descriptors. You would have to open hundreds before reaching the
> limit.
> 
> Mike
> 
> 
> 
>>Thanks.
>>
>>Gary Rambo
>>
>>
> 
> 

-- 
Gary Rambo
Aventail Corporation
Secure access for the real world.
www.aventail.com


More information about the jcifs mailing list