A memory leak happens in JMX Client application which repeats connecting and closing JMXConnector over remoting-jmx in JBoss EAP 6.x/7.x
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
- 7.x
- JMX client application using remoting-jmx
Issue
A memory leak happens in JMX Client application which repeats connecting and closing JMXConnector over remoting-jmx. A new java.lang.ThreadGroup is created every JMXConnectorFactory#connect().
Resolution
- This is a bug in the remoting-jmx component in JBoss, so the following bugzilla and JIRAs are opened:
- This issue can workaround by passing a custom executor to
JMXConnectorFactory.connect(url, map)by passing the environment map with the key "java.util.concurrent.Executor" in your jmx client application. See the example codeJmxClientCustomExecutorWorkaround.java, which is attached on Content from issues.jboss.org is not included.REMJMX-160, for details. - Also, this issue can be mitigated by reusing a
JMXConnectorobject after it's obtained viaJMXConnectorFactory.connect()in your JMX client application.
Root Cause
- In JMX client application, every
JMXConnectorFactory.connect()invocation creates a new ThreadGroup which is never reclaimed. - Refer to Content from issues.jboss.org is not included.REMJMX-160 for the details.
SBR
Components
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.