[jcifs] Multiple Threads Causes Server Timeout
Michael B Allen
mba2000 at ioplex.com
Thu Apr 14 23:41:43 GMT 2005
tim_wiffen at westlb.co.uk said:
> 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:
> at jcifs.smb.SmbTransport.send(SmbTransport.java:671)
I can't reproduce this. Your example runs ok for me. I had to change the
path a little to point to a directory with files.
I have to wonder if maybe your network has a problem. For example, one
thing that could cause this kind of trouble is if your NIC is set to
half-duplex but the router wants full-duplex. Or visa-versa. Check it out.
Otherwise I ran your example several times on a large directory of files
and it worked 100%. I ran it with 20 threads a couple times and it worked
Note there is a known concurrency error that someone reported but at this
point I do not think your problem is related. Also, note the
jcifs-1.1.9trans.jar I pointed you to *does* fail your test in a very
similar way (timeout) but for entirely different reasons (bad mid
Try your test on a different network.
Also, note your Iterator is not synchronized. I don't think that's a
problem but thought I would mention it.
PS: I realize you're just testing but for a variety of reasons any file
copying you do should always be done using SmbFile.copyTo().
More information about the jcifs