Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-2764

Cache module configuration may refer to non-existing repositories, causes NPEs on shutdown

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.1, 3.6.6, 4.0.2
    • None
    • None
    • None

    Description

      Cache module in 4.1 rcs tries to register listeners to the following repositories:

      • data
      • dms
      • templates
      • resources

      that may not exist on all the installations. Strangely the result is that the listener seems to be created but the flushing policy crashes on shutdown while trying to login to the non-existing repo in order to remove the listener.
      This is the stacktrace logged on shutdown (in this example it tries to remove the listener for a repository not existing in my installation) :

      SEVERE: Exception sending context destroyed event to listener instance of class info.magnolia.cms.servlets.MgnlServletContextListener
      java.lang.NullPointerException
      	at info.magnolia.cms.util.WorkspaceAccessUtil.createRepositorySession(WorkspaceAccessUtil.java:121)
      	at info.magnolia.cms.util.WorkspaceAccessUtil.createRepositorySession(WorkspaceAccessUtil.java:107)
      	at info.magnolia.context.AbstractRepositoryStrategy.getRepositorySession(AbstractRepositoryStrategy.java:105)
      	at info.magnolia.context.AbstractRepositoryStrategy.getHierarchyManager(AbstractRepositoryStrategy.java:77)
      	at info.magnolia.context.LifeTimeJCRSessionUtil.getHierarchyManager(LifeTimeJCRSessionUtil.java:76)
      	at info.magnolia.cms.util.ObservationUtil.getHierarchyManager(ObservationUtil.java:190)
      	at info.magnolia.cms.util.ObservationUtil.getObservationManager(ObservationUtil.java:185)
      	at info.magnolia.cms.util.ObservationUtil.unregisterChangeListener(ObservationUtil.java:173)
      	at info.magnolia.module.cache.AbstractListeningFlushPolicy.stop(AbstractListeningFlushPolicy.java:105)
      	at info.magnolia.module.cache.DelegateFlushPolicy.stop(DelegateFlushPolicy.java:75)
      	at info.magnolia.module.cache.CacheModule.stop(CacheModule.java:168)
      	at info.magnolia.module.ModuleManagerImpl.stopModule(ModuleManagerImpl.java:380)
      	at info.magnolia.module.ModuleManagerImpl.stopModules(ModuleManagerImpl.java:412)
      	at info.magnolia.cms.servlets.MgnlServletContextListener.contextDestroyed(MgnlServletContextListener.java:136)
      	at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3882)
      	at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4516)
      	at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924)
      	at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1189)
      	at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1160)
      	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:313)
      	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1086)
      	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
      	at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
      	at org.apache.catalina.core.StandardService.stop(StandardService.java:584)
      	at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
      

      The configuration for the repositories is in config.modules.cache.config.configurations.default.xml, but the list of repositories is there since a long time and it never caused problems. It seems that the refactoring for handling "multiple flush policies" caused this bug.
      The problem is pretty serious because it blocks the clean shutdown of jackrabbit, the repository status is not clean and the lock file is not removed.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                fgiust Fabrizio Giustina
                fgiust Fabrizio Giustina
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD