Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-5281

Race between registering and unregistering CustomMXBeans in concurrent thread may result in NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0-incubating
    • 1.7.0
    • jmx

    Description

      Stack trace from an example of the unexpected NullPointerException in MBeanProxyFactory.createProxy()

      [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)
      

      The registering thread enters

        public void createProxy(DistributedMember member, ObjectName objectName,
            Region<String, Object> monitoringRegion, Object newVal) {
      
      

      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.

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

      federationComponent == null results in the NPE.

      Attachments

        Issue Links

          Activity

            People

              khowe Ken Howe
              khowe Ken Howe
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m