The toMap method introduced within NXP-22546 could cause NPE after the last contribution for an id has been removed, see the stack trace below:
2021-11-24T09:16:31,514 ERROR [http-nio-0.0.0.0-8080-exec-5] [org.nuxeo.ecm.core.event.impl.EventServiceImpl] Exception during opchainlistener sync listener execution, continuing to run other listeners
java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:221) ~[?:?]
at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:178) ~[?:?]
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1746) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
at org.nuxeo.runtime.model.ContributionFragmentRegistry.toMap(ContributionFragmentRegistry.java:244) ~[nuxeo-runtime-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.automation.core.events.EventRegistry.lookup(EventRegistry.java:100) ~[nuxeo-automation-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.automation.core.events.EventHandlerRegistry.getEventHandlers(EventHandlerRegistry.java:56) ~[nuxeo-automation-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.automation.core.events.OperationEventListener.handleEvent(OperationEventListener.java:39) ~[nuxeo-automation-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:279) ~[nuxeo-core-event-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:286) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.api.AbstractSession.save(AbstractSession.java:1576) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.platform.content.template.listener.RepositoryInitializationListener.doInitializeRepository(RepositoryInitializationListener.java:41) ~[nuxeo-platform-content-template-manager-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.repository.RepositoryInitializationHandler.initializeRepository(RepositoryInitializationHandler.java:92) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.repository.RepositoryInitializationHandler.initializeRepository(RepositoryInitializationHandler.java:90) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.repository.RepositoryInitializationHandler.initializeRepository(RepositoryInitializationHandler.java:90) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.repository.RepositoryService$2.run(RepositoryService.java:226) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.runUnrestricted(UnrestrictedSessionRunner.java:123) ~[nuxeo-core-api-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.repository.RepositoryService.initializeRepository(RepositoryService.java:228) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.repository.RepositoryService.doInitRepositories(RepositoryService.java:210) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.transaction.TransactionHelper.lambda$runInTransaction$4(TransactionHelper.java:628) ~[nuxeo-runtime-jtajca-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:661) ~[nuxeo-runtime-jtajca-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:628) ~[nuxeo-runtime-jtajca-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:616) ~[nuxeo-runtime-jtajca-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.repository.RepositoryService.initRepositories(RepositoryService.java:167) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.ecm.core.repository.RepositoryService$1.afterStart(RepositoryService.java:103) ~[nuxeo-core-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.model.impl.ComponentManagerImpl$Listeners.lambda$afterStart$5(ComponentManagerImpl.java:1176) ~[nuxeo-runtime-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.model.impl.ComponentManagerImpl$Listeners.safeLoop(ComponentManagerImpl.java:1190) [nuxeo-runtime-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.model.impl.ComponentManagerImpl$Listeners.afterStart(ComponentManagerImpl.java:1176) [nuxeo-runtime-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.model.impl.ComponentManagerImpl.startComponents(ComponentManagerImpl.java:744) [nuxeo-runtime-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.model.impl.ComponentManagerImpl.resume(ComponentManagerImpl.java:901) [nuxeo-runtime-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.reload.ReloadComponent.reloadBundles(ReloadComponent.java:396) [nuxeo-runtime-reload-PR-294-2021.12-SNAPSHOT.jar:?]
at org.nuxeo.runtime.reload.DevReloadBridge.reloadBundles(DevReloadBridge.java:59) [nuxeo-runtime-reload-PR-294-2021.12-SNAPSHOT.jar:?]
It seems that the FragmentList linked to the contribution id is still present in the Map whereas it should be removed according to https://github.com/nuxeo/nuxeo-lts/blob/2021/modules/runtime/nuxeo-runtime/src/main/java/org/nuxeo/runtime/model/ContributionFragmentRegistry.java#L233
We would like to fix this behavior in order to not have this NPE.
- is related to
-
NXP-22546 Change runtime reload_strategy
- Resolved
- Is referenced in