Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-2354

Bootstrap$WebSocketListener.contextDestroyed throws NPE after application start up error

XMLWordPrintable

      After https://github.com/wildfly/wildfly/pull/16379/, EAP/Wildfly now undeploys in the event of a context start up exception. This results in contextDestroyed being call on all listeners, though not all listeners have had contextInitialized called in what progress had previously been made in start up before the error. So for Bootstrap$WebSocketListener.contextDestroyed, this means its container field is not initialized and remains null to result in an NPE after an application's start up error:

      15:53:32,561 ERROR [io.undertow.servlet.request] (ServerService Thread Pool -- 83) UT015005: Error invoking method contextDestroyed on listener class io.undertow.websockets.jsr.Bootstrap$WebSocketListener: java.lang.NullPointerException
      	at io.undertow.websocket@2.3.10.SP3-redhat-00001//io.undertow.websockets.jsr.Bootstrap$WebSocketListener.contextDestroyed(Bootstrap.java:133)
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.ApplicationListeners.contextDestroyed(ApplicationListeners.java:202)
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.DeploymentImpl.destroy(DeploymentImpl.java:291)
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl$4.call(DeploymentManagerImpl.java:683)
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl$4.call(DeploymentManagerImpl.java:673)
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      	at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
      	at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
      	at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
      	at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl.undeploy(DeploymentManagerImpl.java:688)
      	at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:110)
      	at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:87)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.JBossThread.run(JBossThread.java:513)
      

      That is caught safely and any other listeners following this are called so doesn't seem there'd be any functional impact, but it's extra log noise we should avoid.

            flaviarnn Flavia Rainone
            rhn-support-aogburn Aaron Ogburn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: