[jcifs] socket connection timed out error under load

Michael B Allen mba2000 at ioplex.com
Tue Jul 20 03:15:20 GMT 2004


Jonas Partner said:
> Hi
> I am using 0.9.5 and have been getting the following stack trace after a
> prolonged period of usage browsing
> and downloading files from a share.  The code below reproduces this
> problem even using a single thread after
> a few hundred requests.

Does it happen consistently with all servers?

>  After some investigation I have found that the
> failure is immediately preceded by a call to NbtSocket close() stack dump
> below and that the socket and output stream are both null by the time that
> the below excpetion is thrown.

Well if it happends creating the socket the yes the socket and out members
of SmbTransport will be null.

>  I am guessing this a synchronization issue
> with the sockets, could anyone
> suggest why this may be occurring ?

At second glance I'm not so certain this is a syncronization issue. One
thing that leads me to suspect something else is happening is that this
stack trace shows the java.net.Socket.<init> is calling close. It's not
the socket was created and then one thread tried to close while another
was doing something to open. The socket hasn't even been created yet. Is
there some text associated with the Exception other than "Stack trace"?

The sample program works ok for me although it is a little intense.
Perhaps the VM memory is so low after a while trying to create a socket
fails?

Can you narrow the down the problem to make it a little more
reproduceable? Or can you time it well enough that you can get a
reasonably sized packet capture?

http://jcifs.samba.org/capture.html

> java.lang.Exception: Stack trace
> 	at java.lang.Thread.dumpStack(Unknown Source)
> 	at jcifs.netbios.NbtSocket.close(NbtSocket.java:130)
> 	at java.net.Socket.<init>(Unknown Source)
> 	at java.net.Socket.<init>(Unknown Source)
> 	at jcifs.netbios.NbtSocket.<init>(NbtSocket.java:60)
> 	at jcifs.smb.SmbTransport.ensureOpen(SmbTransport.java:275)
> 	at jcifs.smb.SmbTransport.send(SmbTransport.java:602)
> 	at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:847)
> 	at jcifs.smb.SmbTree.treeConnect(SmbTree.java:119)

Mike


More information about the jcifs mailing list