[jcifs] accumulation of sockets in CLOSE_WAIT state

Gary Rambo grambo at aventail.com
Thu Feb 19 02:42:11 GMT 2004


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?


Gary Rambo

More information about the jcifs mailing list