[jcifs] Multiple Threads Causes Server Timeout

Michael B Allen mba2000 at ioplex.com
Thu Apr 14 18:14:44 GMT 2005

On Thu, 14 Apr 2005 15:53:00 +0100
tim_wiffen at westlb.co.uk wrote:

> jcifs version: 1.1.9
> I have some code that runs a pool of 3 threads that pick file requests off
> a list and fetch them. As a unit test I am using this to copy 300 files 
> (total size of files 500MB)  in a directory on a remote server. However 
> after copying about 50 files I start to get SmbExceptions but other files 
> are copied successfully after these errors:
> jcifs.smb.SmbException: Timeout waiting for response from server: 
> someserver.myserver.net/
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:671)
>         at jcifs.smb.SmbSession.send(SmbSession.java:259)
>         at jcifs.smb.SmbTree.send(SmbTree.java:103)
>         at jcifs.smb.SmbFile.send(SmbFile.java:725)
>         at jcifs.smb.SmbFileInputStream.read(SmbFileInputStream.java:147)
> My guess is that the connections to the server are not being closed, and 
> as there is no close() method in the SmbFile class there is nothing I can 

Sessions are multiplexed over the same connection so this isn't the

> Here is some test code to illustrate the problem:
> public void testJCIFSThreads() {
>         final int THREADS = 3; //Set thread to 1 and no errors occur
>         try {
>             SmbFile smbfile = null;
>             smbfile = new SmbFile("smb://USERNAME:PASSWORD@SERVERPATH"); 

I think the only thing technically wrong with this code is that SMB URLs
that do not refer to files must end with a trailing '/'. If you add a
trailing slash (ie ...ERPATH/") above do you get different behavior?

I'm interested in trying your code in my env. There was another report
of a problem like this that I believe is a concurrency error. But the
test code required setting -Xmx512 and running 50 or more threads to
trigger the problem.

Also, I recently rewrote the transport layer and put jcifs-1.1.9trans.jar
in the download area. That might give you different results. Can you
try it?


IRC - where men are men, women are men, and the boys are FBI agents.

More information about the jcifs mailing list