[jcifs] Timeout Exceptions performing listFiles with jcifs-1.2.0

Andreas Knoor knoor at e-spirit.de
Mon May 30 16:16:46 GMT 2005


Hello,

i have a problem with jcifs-1.2.0. Performing a simple "listFiles" on some 
directories throws a Timeout exception, although the network is OK.

--Exception--
jcifs.util.transport.TransportException: Transport2[anubis/192.168.100.1:445] 
timedout waiting for response to Trans2FindFirst2[command=SMB_COM_TRANSACTION2,
received=false,errorCode=The operation completed successfully.,flags=0x0018,
flags2=0x4003,signSeq=0,tid=1,pid=130,uid=100,mid=10258,wordCount=15,
byteCount=16,totalParameterCount=15,totalDataCount=0,maxParameterCount=10,
maxDataCount=65535,maxSetupCount=0,flags=0x00,timeout=0,parameterCount=15,
parameterOffset=66,parameterDisplacement=0,dataCount=0,dataOffset=82,
dataDisplacement=0,setupCount=1,pad=1,pad1=1,searchAttributes=0x16,
searchCount=200,flags=0x00,informationLevel=0x104,searchStorageType=0,
filename=\]
        at jcifs.smb.SmbTransport.send(SmbTransport.java:500)
        at jcifs.smb.SmbSession.send(SmbSession.java:226)
        at jcifs.smb.SmbTree.send(SmbTree.java:92)
        at jcifs.smb.SmbFile.send(SmbFile.java:687)
        at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1677)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1568)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1476)
        at JCIFSCheck$1.run(JCIFSCheck.java:54)
        at java.lang.Thread.run(Unknown Source)

        at jcifs.smb.SmbTransport.send(SmbTransport.java:525)
        at jcifs.smb.SmbSession.send(SmbSession.java:226)
        at jcifs.smb.SmbTree.send(SmbTree.java:92)
        at jcifs.smb.SmbFile.send(SmbFile.java:687)
        at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1677)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1568)
        at jcifs.smb.SmbFile.listFiles(SmbFile.java:1476)
        at JCIFSCheck$1.run(JCIFSCheck.java:54)
        at java.lang.Thread.run(Unknown Source)
        
        
Here is a simple test program, which lists the content of a directory.
After a few minutes (5-10), the exception is thrown. Once the exception occurs
the first time, it is thrown every 1-2 minutes. 
With JCIFS 1.11 everything works fine.


To start the program use: "java JCIFSCheck <domain> <username> <password>
smb://myserver/myshare/ smb://myserver2/myshare2/ ...
---------------------
import java.io.InputStream;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbException;
import jcifs.smb.NtlmPasswordAuthentication;

public class JCIFSCheck
{
    private final static long DT = 10000;

    private NtlmPasswordAuthentication auth;

    public JCIFSCheck(String domain, String user, String password)
    {
        auth = new NtlmPasswordAuthentication(domain, user, password);
    }

    public static void main(String[] args)
        throws Exception
    {
        JCIFSCheck jcc = new JCIFSCheck(args[0], args[1], args[2]);
        for(int i = 3; i < args.length; i++)
        {
            jcc.launch(i-3, args[i]);
        }
    }

    public void launch(final int no, final String fname)
        throws Exception
    {
        Thread th = new Thread(new Runnable()
          {
              private int count = 0;
              private int fail = 0;
              private int noList = 0;
              private long nextTime;

              public void run()
              {
                  nextTime = System.currentTimeMillis() + DT;
                  while(true)
                  {
                      count++;
                      try
                      {
                          SmbFile sf = new SmbFile(fname, auth);
                          if (!sf.exists())
                          {
                              fail++;
                          }
                          if ( sf.isDirectory() )
                          {
                              SmbFile[] sfs = sf.listFiles();
                              if ( sfs == null )
                              {
                                  noList++;
                              }
                          }
                        }
                      catch(Exception e)
                      {
                         java.util.Date date = new java.util.Date();
                         System.out.println("Error at timestamp: "+date);
                         e.printStackTrace();

                      }
                      long currentTime = System.currentTimeMillis();
                      if ( currentTime > nextTime )
                      {
                          System.out.println(no+". "+count+":"+fail+":"+noList+"
"+fname);
                          nextTime += DT;
                      }
                  }
              }
          });
        th.start();
    }
}

---------------------

Any idea what the problem is?




More information about the jcifs mailing list