Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30270

ComponentManager listeners should be called within a try/catch

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.10-HF44, 11.x, 2021.2
    • Component/s: Runtime
    • Team:
      PLATFORM
    • Sprint:
      nxplatform #31, nxplatform #30
    • Story Points:
      0

      Description

      We have more and more code executed in the ComponentManager.Listener#afterRuntimeStart subject to failures, see an example below:

      ERROR [main] [org.nuxeo.osgi.OSGiAdapter] Error during Framework Listener execution : class org.nuxeo.runtime.osgi.OSGiRuntimeService
      java.lang.NullPointerException: null
              at org.nuxeo.ecm.platform.web.common.admin.AdministrativeStatusListener.handleEvent(AdministrativeStatusListener.java:75) ~[nuxeo-platform-web-common-10.10-HF40.jar:?]
              at org.nuxeo.runtime.services.event.EventService.sendEvent(EventService.java:126) ~[nuxeo-runtime-10.10-HF10.jar:?]
              at org.nuxeo.runtime.services.event.EventService.sendEvent(EventService.java:100) ~[nuxeo-runtime-10.10-HF10.jar:?]
              at org.nuxeo.ecm.core.management.statuses.RuntimeEventNotifier.notifyEvent(RuntimeEventNotifier.java:35) ~[nuxeo-core-management-10.10-HF19.jar:?]
              at org.nuxeo.ecm.core.management.statuses.AdministrativeStatusManagerImpl.notifyEvent(AdministrativeStatusManagerImpl.java:78) ~[nuxeo-core-management-10.10-HF19.jar:?]
              at org.nuxeo.ecm.core.management.statuses.AdministrativeStatusManagerImpl.notifyOnStatus(AdministrativeStatusManagerImpl.java:152) ~[nuxeo-core-management-10.10-HF19.jar:?]
              at org.nuxeo.ecm.core.management.statuses.AdministrativeStatusManagerImpl.doNotifyAllStatuses(AdministrativeStatusManagerImpl.java:118) ~[nuxeo-core-management-10.10-HF19.jar:?]
              at org.nuxeo.ecm.core.management.statuses.AdministrativeStatusManagerImpl.onNuxeoServerStartup(AdministrativeStatusManagerImpl.java:104) ~[nuxeo-core-management-10.10-HF19.jar:?]
              at org.nuxeo.ecm.core.management.CoreManagementComponent.onNuxeoServerStartup(CoreManagementComponent.java:141) ~[nuxeo-core-management-10.10-HF19.jar:?]
              at org.nuxeo.ecm.core.management.storage.DocumentStoreManager.doInitializeRepository(DocumentStoreManager.java:107) ~[nuxeo-core-management-10.10-HF19.jar:?]
              at org.nuxeo.ecm.core.repository.RepositoryInitializationHandler.initializeRepository(RepositoryInitializationHandler.java:93) ~[nuxeo-core-10.10-HF36.jar:?]
              at org.nuxeo.ecm.core.repository.RepositoryInitializationHandler.initializeRepository(RepositoryInitializationHandler.java:91) ~[nuxeo-core-10.10-HF36.jar:?]
              at org.nuxeo.ecm.core.repository.RepositoryService$2.run(RepositoryService.java:158) ~[nuxeo-core-10.10-HF36.jar:?]
              at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.runUnrestricted(UnrestrictedSessionRunner.java:137) ~[nuxeo-core-api-10.10-HF39.jar:?]
              at org.nuxeo.ecm.core.repository.RepositoryService.initializeRepository(RepositoryService.java:160) ~[nuxeo-core-10.10-HF36.jar:?]
              at org.nuxeo.ecm.core.repository.RepositoryService.doInitRepositories(RepositoryService.java:142) ~[nuxeo-core-10.10-HF36.jar:?]
              at org.nuxeo.runtime.transaction.TransactionHelper.lambda$runInTransaction$5(TransactionHelper.java:616) ~[nuxeo-runtime-jtajca-10.10-HF41.jar:?]
              at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:636) ~[nuxeo-runtime-jtajca-10.10-HF41.jar:?]
              at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:616) ~[nuxeo-runtime-jtajca-10.10-HF41.jar:?]
              at org.nuxeo.ecm.core.repository.RepositoryService.initRepositories(RepositoryService.java:100) ~[nuxeo-core-10.10-HF36.jar:?]
              at org.nuxeo.ecm.core.repository.RepositoryService$1.afterStart(RepositoryService.java:78) ~[nuxeo-core-10.10-HF36.jar:?]
              at org.nuxeo.runtime.model.impl.ComponentManagerImpl$Listeners.afterStart(ComponentManagerImpl.java:1135) ~[nuxeo-runtime-10.10-HF10.jar:?]
              at org.nuxeo.runtime.model.impl.ComponentManagerImpl.startComponents(ComponentManagerImpl.java:695) ~[nuxeo-runtime-10.10-HF10.jar:?]
              at org.nuxeo.runtime.model.impl.ComponentManagerImpl.start(ComponentManagerImpl.java:792) ~[nuxeo-runtime-10.10-HF10.jar:?]
              at org.nuxeo.runtime.osgi.OSGiRuntimeService.startComponents(OSGiRuntimeService.java:447) ~[nuxeo-runtime-10.10-HF10.jar:?]
              at org.nuxeo.runtime.osgi.OSGiRuntimeService.frameworkEvent(OSGiRuntimeService.java:462) ~[nuxeo-runtime-10.10-HF10.jar:?]
              at org.nuxeo.osgi.OSGiAdapter.fireFrameworkEvent(OSGiAdapter.java:223) [nuxeo-runtime-osgi-10.10.jar:?]
              at org.nuxeo.osgi.application.loader.FrameworkLoader.doStart(FrameworkLoader.java:225) [nuxeo-runtime-osgi-10.10.jar:?]
              at org.nuxeo.osgi.application.loader.FrameworkLoader.start(FrameworkLoader.java:124) [nuxeo-runtime-osgi-10.10.jar:?]
              at org.nuxeo.runtime.deployment.NuxeoStarter.start(NuxeoStarter.java:124) [nuxeo-runtime-deploy-10.10.jar:?]
              at org.nuxeo.runtime.deployment.NuxeoStarter.contextInitialized(NuxeoStarter.java:93) [nuxeo-runtime-deploy-10.10.jar:?]
              at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4716) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5177) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:706) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:631) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1830) [catalina-9.0.41.jar:9.0.41]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_282]
              at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_282]
              at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util-9.0.41.jar:9.0.41]
              at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) [?:1.8.0_282]
              at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:526) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:425) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:843) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) [catalina-9.0.41.jar:9.0.41]
              at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_282]
              at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util-9.0.41.jar:9.0.41]
              at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [?:1.8.0_282]
              at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.StandardService.startInternal(StandardService.java:434) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.41.jar:9.0.41]
              at org.apache.catalina.startup.Catalina.start(Catalina.java:772) [catalina-9.0.41.jar:9.0.41]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_282]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_282]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_282]
              at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_282]
              at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342) [bootstrap-9.0.41.jar:9.0.41]
              at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473) [bootstrap-9.0.41.jar:9.0.41]
      

      We should wrap these listeners' calls in a try/catch block, log as error the exception and add an error runtime message. This will make the runtime stop in strict mode and give us more information when such situations happen.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                PagerDuty

                Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.