[MAGNOLIA-2764] Cache module configuration may refer to non-existing repositories, causes NPEs on shutdown Created: 05/Jun/09  Updated: 23/Jan/13  Resolved: 15/Jun/09

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 4.1, 3.6.6, 4.0.2

Type: Bug Priority: Major
Reporter: Fabrizio Giustina Assignee: Fabrizio Giustina
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
depends upon MAGNOLIA-769 Uninstall of modules Closed
relation
is related to MAGNOLIA-2616 Provide a method to flush page based ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 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.



 Comments   
Comment by Fabrizio Giustina [ 05/Jun/09 ]

fixed in svn, this is really a blocker for 4.1

Comment by Magnolia International [ 05/Jun/09 ]

Needs to be merged to at least the 4.0 branch.

Comment by Magnolia International [ 05/Jun/09 ]

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.

These repositories should be registered in the cache configuration by the modules who register these repositories. So if things are correct, it should only be the case if the corresponding modules (and thus the corresponding repositories)
If that's not the case, then that needs to be fixed.

Comment by Fabrizio Giustina [ 05/Jun/09 ]

Needs to be merged to at least the 4.0 branch.

The bug looks caused by the changes in MAGNOLIA-2616 , which is only in 4.1. There is no need to merge the fix to the 4.0 branch: I am not sure on what has changed in the listener registration but 4.0.x definitively works fine.

Comment by Magnolia International [ 05/Jun/09 ]

Damn.. well I just merged it. Doesn't seem like it'd hurt. But we need to understand where/how this was introduced. No time to investigate now.

Comment by Magnolia International [ 15/Jun/09 ]

afaik, this happens simply because modules register their own repositories/workspaces in the cache config at install time, so this shouldn't be 4.1-specific. Uninstallation of modules should take care of this (MAGNOLIA-769)

Generated at Mon Feb 12 03:39:52 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.