[jcifs] accumulation of sockets in CLOSE_WAIT state

Michael B Allen mba2000 at ioplex.com
Thu Feb 19 09:57:05 GMT 2004


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



More information about the jcifs mailing list