[jcifs] OutOfMemoryError unable to create new native thread

Peter peter_zavadsky at symantec.com
Mon Mar 8 11:59:02 MST 2010

Michael B Allen <ioplex <at> gmail.com> writes:
> Hi Peter,
> I understood what you said. My point was simply that to trigger Jespa
> to create 1900 QueryThreads it would require multiple threads of your
> own.
> Just try what I recommended and see how far you get with that.
> Unfortunately I just don't have time to try your example (or even
> really read your message completely). If you find something clearly
> wrong with JCIFS then I am interested in at least diagnosing the issue
> but right now I just don't see any obvious evidence of a problem.
> Mike 


I tried your suggestion, unfortunately it doesn't work for us, because
lot of customers use non fully qualified DFS names.

Sorry, I’ll try to be more brief. Thanks so much for your patience.

I just have ONE SINGLE THREAD that is calling the JCIFS library at least 10,000
times in a loop.  

The essence of the problem is that one of the two QueryThreads is returning
with success very quickly, about 5 ms, but the other QueryThread is taking a
very long time to complete, about 5 seconds.  

So, when I call the JCIFS library 10,000 times in less than 5 seconds, I end up
with 10,000 threads that are all still waiting to complete.  Unfortunately, I
only have enough memory for about 1,800 threads, so I run out of memory long
before I get to 10,000 calls.

I don’t know why sometimes the first QueryThread in a lookup takes 5 ms and the
second QueryThread in a lookup takes 5 seconds, but this happens at some of our
customer sites as well as on one of our test machines.

So, my simplistic solution to the problem was to simply interrupt the second
QueryThread when the first one finishes successfully so that both threads
finish as soon as the first one succeeds.  This prevents orphan threads from
hanging around.


More information about the jCIFS mailing list