Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-8530

Ensure MBean are deregistered if the repository fails to start

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.18.0
    • Component/s: core
    • Labels:
      None

      Description

      When used in OSGi environments the repository service is unfortunately prone to restarts ( see SLING-7811 for the gory details ). Besides the performance problem, the repository typically fails to restart since MBeans that were registered once were not deregistered. The failures happen before repository is constructed, so there is no instance to close.

      A typical stack trace is

      06.08.2019 09:55:03.894 *ERROR* [Apache Sling Repository Startup Thread #4] org.apache.aries.jmx.whiteboard.MBeanHolder register: Failure registering MBean org.apache.jackrabbit.oak.management.RepositoryManager@5e05b159
      javax.management.InstanceAlreadyExistsException: org.apache.jackrabbit.oak:name=repository manager,type=RepositoryManagement
      	at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
      	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
      	at org.apache.aries.jmx.whiteboard.MBeanHolder.register(MBeanHolder.java:114)
      	at org.apache.aries.jmx.whiteboard.JmxWhiteboardSupport.registerMBean(JmxWhiteboardSupport.java:88)
      	at org.apache.aries.jmx.whiteboard.Activator$MBeanTracker.addingService(Activator.java:102)
      	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
      	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871)
      	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
      	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
      	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903)
      	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:4833)
      	at org.apache.felix.framework.Felix.registerService(Felix.java:3804)
      	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)
      	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:302)
      	at org.apache.jackrabbit.oak.osgi.OsgiWhiteboard.register(OsgiWhiteboard.java:79)
      	at org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardUtils.registerMBean(WhiteboardUtils.java:115) [org.apache.jackrabbit.oak-core-spi:1.18.0.SNAPSHOT]
      	at org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardUtils.registerMBean(WhiteboardUtils.java:99) [org.apache.jackrabbit.oak-core-spi:1.18.0.SNAPSHOT]
      	at org.apache.jackrabbit.oak.Oak.createNewContentRepository(Oak.java:772) [org.apache.jackrabbit.oak-core:1.18.0.SNAPSHOT]
      	at org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:671) [org.apache.jackrabbit.oak-core:1.18.0.SNAPSHOT]
      	at org.apache.jackrabbit.oak.jcr.Jcr.createContentRepository(Jcr.java:376) [org.apache.jackrabbit.oak-jcr:1.18.0.SNAPSHOT]
      	at org.apache.sling.jcr.oak.server.internal.OakSlingRepositoryManager.acquireRepository(OakSlingRepositoryManager.java:152) [org.apache.sling.jcr.oak.server:1.2.2]
      	at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.initializeAndRegisterRepositoryService(AbstractSlingRepositoryManager.java:481) [org.apache.sling.jcr.base:3.0.6]
      	at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.access$300(AbstractSlingRepositoryManager.java:86) [org.apache.sling.jcr.base:3.0.6]
      

      I will propose a patch shortly.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rombert Robert Munteanu
                Reporter:
                rombert Robert Munteanu
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: