Details
-
Type: Bug
-
Status: Closed
-
Priority: Critical
-
Resolution: Fixed
-
Affects Version/s: 1.0.0 Final
-
Fix Version/s: 1.0.2
-
Component/s: Networking
-
Labels:None
-
Environment:Originally observed in quickfix/j 1.0.0, jdk 1.4.2, mina 0.9.3.
Also Reproduced with quickfix/j trunk, jdk 1.5, mina 0.9.5 trunk.
Description
A few new threads are created by MINA each time an initiator connects to a remote host. Two of these (AnonymousIoService-x-y) are not cleaned up which can event lead to OutOfMemoryError or other strange behaviour.
This can easily be reproduced using Banzai and Executor. Change the SenderCompId in Banzai to BANZAI2 which will cause the executor to disconnect it after the logon. Start the executor and start Banzai in the debugger. As it reconnects you'll see three threads hanging around each time:
SocketConnector-0
AnonymousIoService-1-1
AnonymousIoService-1-2
The SocketConnector threads do eventually get cleaned up after an idle period, but the AnonymousIoService threads hang around forever.
Thread [SocketConnector-1] (Suspended)
WindowsSelectorImpl$SubSelector.poll0(long, int, int[], int[], int[], long) line: not available [native method]
WindowsSelectorImpl$SubSelector.poll() line: 275
WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl$SubSelector) line: 257
WindowsSelectorImpl.doSelect(long) line: 138
WindowsSelectorImpl(SelectorImpl).lockAndDoSelect(long) line: 69
WindowsSelectorImpl(SelectorImpl).select(long) line: 80
SocketConnector$Worker.run() line: 394
Thread [AnonymousIoService-2-3] (Suspended)
Object.wait(long) line: not available [native method]
LeaderFollowersThreadPool$Worker.waitForPromotion() line: 402
LeaderFollowersThreadPool$Worker.run() line: 309
Thread [AnonymousIoService-2-4] (Suspended)
Object.wait(long) line: not available [native method]
BlockingQueue(Object).wait() line: 474
BlockingQueue.waitForNewItem() line: 55
LeaderFollowersThreadPool$Worker.fetchRunnable() line: 339
LeaderFollowersThreadPool$Worker.run() line: 312