[ 
https://issues.apache.org/jira/browse/DERBY-4306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mamta A. Satoor updated DERBY-4306:
-----------------------------------

    Attachment: DERBY4306_checkForNullability_patch1_diff.txt

I am attaching a really simple fix as 
DERBY4306_checkForNullability_patch1_diff.txt Can someone more familiar with 
JMX please take a look and verify if the fix is as simple as checking for 
nullability. It appears that registeredMbeans is null and hence following 
results in NPE
    private synchronized void unregisterMBean(final ObjectName mbeanName)
    {
        if (registeredMbeans.remove(mbeanName) == null)
            return;
        
        if (mbeanServer == null)
            return;
        
        jmxUnregister(mbeanName);
    }
My proposed check just does following at the beginning of the method
if (registeredMbeans == null) return
So, the method will look as follows
    private synchronized void unregisterMBean(final ObjectName mbeanName)
    {
        //Has this service been shut down?
        if (registeredMbeans == null)
            return;

        if (registeredMbeans.remove(mbeanName) == null)
            return;
        
        if (mbeanServer == null)
            return;
        
        jmxUnregister(mbeanName);
    }

I talked to Kathey about the fix and Kathey thought that there is a possibility 
that registeredMbeans will be null when this method is called but she wanted me 
to check with the community to see if anything thinks it is wrong to assume 
that registeredMbeans can be null.
*************
Kathey's thoughts on the issue
If you shutdown the engine with shutdown=true  I think the service is stopped 
and mbeans unregistered at that time.If derby embedded has already been 
shutdown before the network server shutdown command is issued then I think that 
is when you get this JMX NPE
*************

I will go ahead and checkin the fix tomorrow after running the junit and 
derbyall. If someone thinks this is the right way of fixing the problem, please 
let me know.

> NullPointerException in JMXManagementService.unregisterMBean when running 
> jdbcapi._Suite
> ----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4306
>                 URL: https://issues.apache.org/jira/browse/DERBY-4306
>             Project: Derby
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: 10.5.2.0, 10.6.0.0
>            Reporter: Tiago R. Espinha
>         Attachments: DERBY4306_checkForNullability_patch1_diff.txt, 
> JMX_NPE_AuthenticationTest.tar.gz, JMXNPE.tar.gz, ReproDerby4306.java
>
>
> I consistently get a NullPointerException when I run the jdbcapi suite:
> java.lang.NullPointerException
>       at 
> org.apache.derby.impl.services.jmx.JMXManagementService.unregisterMBean(JMXManagementService.java:286)
>       at 
> org.apache.derby.impl.services.jmx.JMXManagementService.unregisterMBean(JMXManagementService.java:277)
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(NetworkServerControlImpl.java:864)
>       at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> org.apache.derby.iapi.jdbc.DRDAServerStarter.run(DRDAServerStarter.java:236)
>       at java.lang.Thread.run(Thread.java:619)
> I'm attaching the log folder from the jdbcapi run.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to