I’m writing an application that does filetransfers programmatically (this is no chat app) every some minutes. Everything works fine except for the fact that a lot of dead threads accumulate over time, quickly killing the JVM.
Using Smack 3.0.4.
I traced this down to FaultTolerantNegotiator.createIncomingStream(). There, two NegotiatorServices are added to the futures queue. These never get terminated properly although their cancel() method gets called in the finally block. Perhaps this is a JRE oddity (using “Java HotSpot™ 64-Bit Server VM (build 1.5.0_13-b05, mixed mode)” - seems to occur in 32 bit 1.5.0_09, too, though).
Suspending one of the stale threads gives the following stack trace:
Unsafe.park(boolean, long) line: not available (native method)
LockSupport.park() line: 118
AbstractQueuedSynchronizer$ConditionObject.await() line: 1841
LinkedBlockingQueue<E>.take() line: 359
ThreadPoolExecutor.getTask() line: 470
ThreadPoolExecutor$Worker.run() line: 674
Thread.run() line: 595
Any idea what to do or how to debug further?