Kenneth Howe created GEODE-5281:
-----------------------------------

             Summary: Race between registering and unregistering CustomMXBeans 
in concurrent thread may result in NPE
                 Key: GEODE-5281
                 URL: https://issues.apache.org/jira/browse/GEODE-5281
             Project: Geode
          Issue Type: Improvement
          Components: jmx
            Reporter: Kenneth Howe


Stack trace from an example of the unexpected NullPointerException in 
{{MBeanProxyFactory.createProxy()}}
{code:java}
[warning 2018/02/03 17:32:13.561 UTC 
managing_1_gemfire2_79a23c4a-f5e3-4c9f-6455-149c397ce13c_38199 
<pool-3-thread-4> tid=0x5e] Create Proxy failed for 
GemFire:type=CustomMXBean213,member=locator_managing_gemfire1_79a23c4a-f5e3-4c9f-6455-149c397ce13c_37116
 with exception null
java.lang.NullPointerException
        at 
org.apache.geode.management.internal.MBeanProxyFactory.createProxy(MBeanProxyFactory.java:83)
        at 
org.apache.geode.management.internal.MBeanProxyFactory.createAllProxies(MBeanProxyFactory.java:137)
        at 
org.apache.geode.management.internal.FederatingManager$GIITask.call(FederatingManager.java:457)
        at 
org.apache.geode.management.internal.FederatingManager$GIITask.call(FederatingManager.java:341)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
{code}

The registering thread enters 
{code}
  public void createProxy(DistributedMember member, ObjectName objectName,
      Region<String, Object> monitoringRegion, Object newVal) {

{code}
with the {{objectName}} existing in the {{_monitoringRegion}}. A few lines 
further the entry is retrieved from the region, but is now {{null}} due to it 
being removed by the unregistering thread.

{code}
      String name = objectName.toString();
      FederationComponent federationComponent = (FederationComponent) 
monitoringRegion.get(name);
      String interfaceClassName = federationComponent.getMBeanInterfaceClass();
{code}

{{federationComponent == null}} results in the NPE.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to