Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 612647 Details for
Bug 848938
JMX Plugin - Leaking connector threads - com.sun.jmx.remote.internal.ClientCommunicatorAdminClientCommunicatorAdmin$Checker.run
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
fixes connection leak patch
0001-Bug-848938-JMX-Plugin-Leaking-connector-thread.patch (text/plain), 6.43 KB, created by
Elias Ross
on 2012-09-13 22:01:15 UTC
(
hide
)
Description:
fixes connection leak patch
Filename:
MIME Type:
Creator:
Elias Ross
Created:
2012-09-13 22:01:15 UTC
Size:
6.43 KB
patch
obsolete
>From b3d924b4ae62eb0f6d326ec2e454b6676abfb8fe Mon Sep 17 00:00:00 2001 >From: Elias Ross <elias_ross@apple.com> >Date: Thu, 16 Aug 2012 14:08:58 -0700 >Subject: [PATCH] Bug 848938 - JMX Plugin - Leaking connector thread > >Ensure connectors are closed during discovery; e.g. > >"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) >--- > .../org/rhq/plugins/jmx/JMXDiscoveryComponent.java | 67 ++++++++++---------- > 1 file changed, 35 insertions(+), 32 deletions(-) > >diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java >index 6dfe2a3..e1f365e 100644 >--- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java >+++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java >@@ -319,9 +319,17 @@ public ResourceUpgradeReport upgrade(ResourceUpgradeContext inventoriedResource) > throw new RuntimeException("Failed to parse connector address: " + connectorAddress, e); > } > >- JMXConnector jmxConnector; >+ JMXConnector jmxConnector = null; >+ Long pid; > try { > jmxConnector = connect(jmxServiceURL); >+ MBeanServerConnection mbeanServerConnection = jmxConnector.getMBeanServerConnection(); >+ RuntimeMXBean runtimeMXBean = ManagementFactory.newPlatformMXBeanProxy(mbeanServerConnection, >+ ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class); >+ pid = getJvmPid(runtimeMXBean); >+ if (pid == null) { >+ throw new RuntimeException("Failed to determine JVM pid by parsing JVM name."); >+ } > } catch (SecurityException e) { > // Authentication failed, which most likely means the username and password are not set correctly in > // the Resource's plugin config. This is not an error, so return null. >@@ -335,19 +343,8 @@ public ResourceUpgradeReport upgrade(ResourceUpgradeContext inventoriedResource) > log.debug("Unable to upgrade key of JVM Resource with key [" + inventoriedResource.getResourceKey() > + "], since connecting to its JMX service URL [" + jmxServiceURL + "] failed: " + e); > return null; >- } >- >- Long pid; >- try { >- MBeanServerConnection mbeanServerConnection = jmxConnector.getMBeanServerConnection(); >- RuntimeMXBean runtimeMXBean = ManagementFactory.newPlatformMXBeanProxy(mbeanServerConnection, >- ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class); >- pid = getJvmPid(runtimeMXBean); >- if (pid == null) { >- throw new RuntimeException("Failed to determine JVM pid by parsing JVM name."); >- } >- } catch (Exception e) { >- throw new RuntimeException("Failed to determine pid of JVM at [" + jmxServiceURL + "].", e); >+ } finally { >+ close(jmxConnector); > } > > List<ProcessInfo> processes = inventoriedResource.getSystemInformation().getProcesses( >@@ -376,6 +373,13 @@ public ResourceUpgradeReport upgrade(ResourceUpgradeContext inventoriedResource) > return null; > } > >+ private void close(JMXConnector jmxConnector) { >+ try { >+ if (jmxConnector != null) >+ jmxConnector.close(); >+ } catch (Exception e) {} >+ } >+ > private static Long getJvmPid(RuntimeMXBean runtimeMXBean) { > Long pid; > String jvmName = runtimeMXBean.getName(); >@@ -461,30 +465,29 @@ protected String getJavaVersion(ProcessInfo process, JMXServiceURL jmxServiceURL > JMXConnector jmxConnector = null; > try { > jmxConnector = connect(jmxServiceURL); >+ return getJavaVersion(jmxConnector); > } catch (SecurityException e) { > log.warn("Unable to to authenticate to JMX service URL [" + jmxServiceURL + "]: " + e.getMessage()); > } catch (IOException e) { > log.error("Failed to connect to JMX service URL [" + jmxServiceURL + "].", e); >+ } catch (Exception e) { >+ log.error("Failed to determine JVM version for process [" + process.getPid() + "] with command line [" + >+ Arrays.asList(process.getCommandLine()) + "].", e); >+ } finally { >+ close(jmxConnector); > } >- String version; >- if (jmxConnector != null) { >- try { >+ // TODO: We could exec "java -version" here. >+ return null; >+ } > >- MBeanServerConnection mbeanServerConnection = jmxConnector.getMBeanServerConnection(); >- RuntimeMXBean runtimeMXBean = ManagementFactory.newPlatformMXBeanProxy(mbeanServerConnection, >- ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class); >- version = runtimeMXBean.getSystemProperties().get(SYSPROP_JAVA_VERSION); >- if (version == null) { >- throw new IllegalStateException("System property [" + SYSPROP_JAVA_VERSION + "] is not defined."); >- } >- } catch (Exception e) { >- log.error("Failed to determine JVM version for process [" + process.getPid() + "] with command line [" + >- Arrays.asList(process.getCommandLine()) + "].", e); >- version = null; >- } >- } else { >- // TODO: We could exec "java -version" here. >- version = null; >+ protected String getJavaVersion(JMXConnector jmxConnector) throws Exception { >+ String version; >+ MBeanServerConnection mbeanServerConnection = jmxConnector.getMBeanServerConnection(); >+ RuntimeMXBean runtimeMXBean = ManagementFactory.newPlatformMXBeanProxy(mbeanServerConnection, >+ ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class); >+ version = runtimeMXBean.getSystemProperties().get(SYSPROP_JAVA_VERSION); >+ if (version == null) { >+ throw new IllegalStateException("System property [" + SYSPROP_JAVA_VERSION + "] is not defined."); > } > return version; > } >-- >1.7.9.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 848938
:
612647
|
614447