Sascha Vogt created KARAF-6329:
----------------------------------

             Summary: NPE on shutdown
                 Key: KARAF-6329
                 URL: https://issues.apache.org/jira/browse/KARAF-6329
             Project: Karaf
          Issue Type: Bug
          Components: karaf
    Affects Versions: 4.2.5, 4.3.0
            Reporter: Sascha Vogt


We found a NPE on shutdown:
{noformat}
2019-05-23T09:56:56.407+0000     ERROR   Felix   FelixStartLevel         [:]    
                                 Bundle org.apache.karaf.features.core [11] 
EventDispatcher: Error during dispatch. (java.lang.NullPointerException)
java.lang.NullPointerException: null
        at 
org.apache.karaf.features.internal.osgi.Activator$2.removedService(Activator.java:306)
 ~[?:?]
        at 
org.apache.karaf.features.internal.osgi.Activator$2.removedService(Activator.java:292)
 ~[?:?]
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:967)
 ~[?:?]
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:870)
 ~[?:?]
        at 
org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341) ~[?:?]
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:909)
 ~[?:?]
        at 
org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
 ~[?:?]
        at 
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
 [?:?]
        at 
org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
 [?:?]
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4595) 
[?:?]
        at org.apache.felix.framework.Felix.access$000(Felix.java:106) [?:?]
        at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:420) 
[?:?]
        at 
org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:170)
 [?:?]
        at 
org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:144)
 [?:?]
        at 
org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:241)
 [?:?]
        at org.apache.felix.framework.Felix.stopBundle(Felix.java:2661) [?:?]
        at 
org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1391) [?:?]
        at 
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
 [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]{noformat}
Could it be a race condition, that even the tracker is closed it still gets a 
few removedService / addedService calls from another thread if the other thread 
already has a reference to the tracker once close from the first thread is 
called?

In that case, could a simple nullcheck avoid the issue?

Code: 
[https://github.com/apache/karaf/blob/master/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java#L306]



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

Reply via email to