Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.32
-
None
-
Tested in the following environments:
OSX 10.10.4 with Oracle Java SE Runtime 1.8.0_45-b14
OSX 10.10.4 with Oracle Java SE Runtime 1.7.0_67
RHEL 6.3 with OpenJDK RE Java 1.7.0_71 (rhel-2.5.3.2.el6_6-x86_64 u71-b14)
Description
A thread leak occurs in our environment running the QPID 0.32 Java client over time. As best as I can tell from the reproduction code and troubleshooting with jconsole the Dispatcher-X-Conn-X threads are not always getting cleaned up. It appears to happen when the Connection is interrupted / closed while the MessageConsumer is in receive() but I don't know that for a fact.
I've attached a zip with some demo code and a gradle build script that reproduces the problem.
Steps to reproduce:
1. Unzip archive.
2. Start up a QPID broker (tried with Java and C++, no difference but I didn't expect to see one)
3. Run ./gradlew run -PbrokerUrl="amqp://guest:guest@localhost/default?brokerlist='tcp://your.qpid.broker:5672?heartbeat='5'&retries='5'&connectdelay='5000''" -Pconsumers=100 -Pruntime=30
4. Launch jconsole and connect to the Main .... process.
5. Switch to the Threads tab and watch that it grows over time and the Dispatcher-X-Conn-X threads continue to accumulate.
Note: I disabled the WARN and INFO error logging from QPID since it is very spammy with thrown InterruptedExceptions and makes it hard to see any other errors that pop up. That can be changed by changing the system property being sent to the slf4j simple logger set in build.gradle.