[jcifs] Connection timeout, then the transport stays "in error"

Tom Shaw tomisfaraway at gmail.com
Tue Nov 15 07:19:53 GMT 2005


Hi folks

We've been running into a problem with jCIFS where a connect() times
out, and then every subsequent attempt to connect to that particular
server fails.

Our application is trying to call listFiles() on a SmbFile directory.

It's possible that the initial exception is reasonable, because we
only find it happening to one of our servers which is 1000km away, so
packet loss may be occurring. The main problem though is that once the
initial error has occured, jCIFS can't recover from the situation.

The initial exception is:
jcifs.smb.SmbException:
jcifs.util.transport.TransportException: Transport2 timedout waiting
for response to
SmbComSessionSetupAndX[command=SMB_COM_SESSION_SETUP_ANDX,received=false,errorCode=0,flags=0x0018,flags2=0xC003,signSeq=0,tid=0,pid=28490,uid=0,mid=920,wordCount=13,byteCount=95,andxCommand=0x75,andxOffset=156,snd_buf_size=16644,maxMpxCount=10,VC_NUMBER=1,sessionKey=0,passwordLength=24,unicodePasswordLength=24,capabilities=84,accountName=20013059,primaryDomain=?,NATIVE_OS=SunOS,NATIVE_LANMAN=jCIFS]
        at jcifs.util.transport.Transport.sendrecv(Transport.java:74)
        at jcifs.smb.SmbTransport.send(SmbTransport.java:580)
        at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:264)
        at jcifs.smb.SmbSession.send(SmbSession.java:223)
        at jcifs.smb.SmbTree.treeConnect(SmbTree.java:144)
        at jcifs.smb.SmbFile.connect(SmbFile.java:792)
        at jcifs.smb.SmbFile.connect0(SmbFile.java:762)
        at jcifs.smb.SmbFile.send(SmbFile.java:660)
        at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1684)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1575)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1539)
...


Then whenever the application attempts to talk to that server again,
we get this exception. As far as I can tell, the exception means "this
transport is in error, and this is what caused it (Connection
timeout)":

jcifs.smb.SmbException:
jcifs.util.transport.TransportException: Connection in error
jcifs.util.transport.TransportException: Connection timeout
        at jcifs.util.transport.Transport.connect(Transport.java:175)
        at jcifs.smb.SmbTransport.connect(SmbTransport.java:271)
        at jcifs.smb.SmbTree.treeConnect(SmbTree.java:129)
        at jcifs.smb.SmbFile.connect(SmbFile.java:792)
        at jcifs.smb.SmbFile.connect0(SmbFile.java:762)
        at jcifs.smb.SmbFile.send(SmbFile.java:660)
        at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1684)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1575)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1539)
...
        at jcifs.util.transport.Transport.connect(Transport.java:155)
        at jcifs.smb.SmbTransport.connect(SmbTransport.java:271)
        at jcifs.smb.SmbTree.treeConnect(SmbTree.java:129)
        at jcifs.smb.SmbFile.connect(SmbFile.java:792)
        at jcifs.smb.SmbFile.connect0(SmbFile.java:762)
        at jcifs.smb.SmbFile.send(SmbFile.java:660)
        at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1684)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1575)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1539)
...
        at jcifs.smb.SmbTransport.connect(SmbTransport.java:273)
        at jcifs.smb.SmbTree.treeConnect(SmbTree.java:129)
        at jcifs.smb.SmbFile.connect(SmbFile.java:792)
        at jcifs.smb.SmbFile.connect0(SmbFile.java:762)
        at jcifs.smb.SmbFile.send(SmbFile.java:660)
        at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1684)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1575)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1539)

So is this a jCIFS bug or should our application be somehow detecting
the error and closing/resetting the transport when there's an error in
connecting?

Regards
Tom Shaw


More information about the jcifs mailing list