Bug 871610 - JMX Plugin - Leaking connector threads - com.sun.jmx.remote.internal.ClientCommunicatorAdminClientCommunicatorAdmin$Checker.run
JMX Plugin - Leaking connector threads - com.sun.jmx.remote.internal.ClientCo...
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- Other (Show other bugs)
JON 3.1.1
Unspecified Unspecified
high Severity high
: ---
: JON 3.1.2
Assigned To: John Mazzitelli
Mike Foley
Depends On: 848938
  Show dependency treegraph
Reported: 2012-10-30 16:54 EDT by Charles Crouch
Modified: 2015-02-01 18:28 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 848938
Last Closed: 2013-09-11 06:59:47 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Charles Crouch 2012-10-30 16:54:20 EDT
+++ This bug was initially created as a clone of Bug #848938 +++

Description of problem:

Number of process threads increases over time.

One such example:

"Thread-2461" daemon prio=10 tid=0x000000006103c800 nid=0x5fc0 waiting on condition [0x00002aab178bb000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(Native Method)
        at com.sun.jmx.remote.internal.ClientCommunicatorAdmin$Checker.run(ClientCommunicatorAdmin.java:154)
        at java.lang.Thread.run(Thread.java:619)

Version-Release number of selected component (if applicable):

RHQ 4.4 version of the plugin running.

How reproducible:

Unclear what specific conditions cause this in my case, but I have seen it almost universally. It could be to discovery failing.

There are obvious code paths which can likely lead to this condition worth exploring.

Additional info:

See: http://stackoverflow.com/questions/564589/dynamic-proxies-with-jmx-can-cause-thread-leaks
> When you do:
> JMXConnectorFactory.connect(url)
> Make sure to close it when you're done using it rather than leaving it up to garbage collection or it seems they can keep piling up...

There are two instances where close is never called:
1) Getting Java version
2) Getting Java PID

** patch forthcoming

--- Additional comment from genman@noderunner.net on 2012-09-13 18:01:15 EDT ---

Created attachment 612647 [details]
fixes connection leak patch

--- Additional comment from mazz@redhat.com on 2012-09-19 06:55:33 EDT ---

Tried applying the patch - it failed on current master (which is 6887631b) - please correct and re-attach to this BZ. Here's the error I get:

$ git am ~/Downloads/0001-Bug-848938-JMX-Plugin-Leaking-connector-thread.patch
Applying: Bug 848938 - JMX Plugin - Leaking connector thread
error: patch failed: modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java:335
error: modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java: patch does not apply
Patch failed at 0001 Bug 848938 - JMX Plugin - Leaking connector thread

--- Additional comment from genman@noderunner.net on 2012-09-19 12:01:58 EDT ---

Created attachment 614447 [details]
updated patch against master - 9f175839392

--- Additional comment from mazz@redhat.com on 2012-09-19 12:30:42 EDT ---

git commit to master: 26b37482f90fb01a6771c5c51471e2754dc3cdb4

--- Additional comment from ccrouch@redhat.com on 2012-10-30 16:51:33 EDT ---

Set Target Release correctly.
Comment 1 Charles Crouch 2012-10-30 17:27:00 EDT
Waiting to be cherry-picked to the release/jon31x branch
Comment 2 John Mazzitelli 2012-10-31 14:10:29 EDT
cherry picked to release/jon3.1.x branch: 7aa947262aba8dd3bbebeea9243165b659e11e5e

had to correct minor conflicts - no code conflicts, just comments
Comment 3 Simeon Pinder 2012-11-16 13:33:07 EST
Moving this to ON_QA as available for testing in https://brewweb.devel.redhat.com//buildinfo?buildID=243389.
Comment 4 Mike Foley 2012-11-16 13:58:38 EST
no repro steps 
unclear what causes this 

marking verified based on developer code review ... low risk.  adding close() in several spots.

plugins will be regression tested as part of JON 3.1.2.

Note You need to log in before you can comment on or make changes to this bug.