Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-6329

NPE on shutdown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.3.0, 4.2.5
    • 4.3.0, 4.2.7
    • karaf
    • None

    Description

      We found a NPE on shutdown:

      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) [?:?]

      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

      Attachments

        Issue Links

          Activity

            People

              jbonofre Jean-Baptiste Onofré
              svogt Sascha Vogt
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: