Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-20706

[GSS](7.3.z) UNDERTOW-1828 NullPointerException occurred if a servlet calls HttpServletRequest#getContextPath() while EAP was shutting down

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.3.6.CR1, 7.3.6.GA
    • 7.3.4.GA
    • Undertow
    • None
    • False
    • False
    • +
    • Undefined
    • Workaround Exists
    • Hide

      use graceful shutdown like as `shutdown --suspend-timeout=60`.

      Show
      use graceful shutdown like as `shutdown --suspend-timeout=60`.
    • Hide

      1. startup EAP with default standalone.xml.
      2. deploy the reproducer application attached on this jira.
      3. execute servlet that invokes getContextPath() after sleeping 10 seconds. (http://localhost:8080/hello/hello)
      4. shutdown EAP with Ctrl+C during sleeping the servlet.

      Show
      1. startup EAP with default standalone.xml. 2. deploy the reproducer application attached on this jira. 3. execute servlet that invokes getContextPath() after sleeping 10 seconds. ( http://localhost:8080/hello/hello ) 4. shutdown EAP with Ctrl+C during sleeping the servlet.

      When calling HttpServlet#getContextPath() from a servlet while the EAP is shutting down, the call will throws an NPE with the following stack trace.

      2020-12-11 14:41:44,383 INFO  [org.jboss.as.server] (Thread-2) WFLYSRV0272: Suspending server
      2020-12-11 14:41:44,387 INFO  [org.jboss.as.ejb3] (Thread-2) WFLYEJB0493: EJB subsystem suspension complete
      2020-12-11 14:41:44,415 INFO  [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested via an OS signal
      2020-12-11 14:41:44,436 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-5) WFLYMAIL0002: Unbound mail session [java:jboss/mail/Default]
      2020-12-11 14:41:44,437 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 77) WFLYUT0022: Unregistered web context: '/hello' from server 'default-server'
      2020-12-11 14:41:44,443 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]
      2020-12-11 14:41:44,446 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0019: Stopped Driver service with driver-name = h2
      2020-12-11 14:41:44,452 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0019: Host default-host stopping
      2020-12-11 14:41:44,454 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 77) WFLYCLINF0003: Stopped client-mappings cache from ejb container
      2020-12-11 14:41:44,475 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0008: Undertow HTTPS listener https suspending
      2020-12-11 14:41:44,475 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0008: Undertow HTTP listener default suspending
      2020-12-11 14:41:44,475 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0007: Undertow HTTP listener default stopped, was bound to 127.0.0.1:8080
      2020-12-11 14:41:44,475 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0007: Undertow HTTPS listener https stopped, was bound to 127.0.0.1:8443
      2020-12-11 14:41:44,476 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0004: Undertow 2.0.32.SP1-redhat-00001 stopping
      2020-12-11 14:41:44,477 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028: Stopped deployment hello.war (runtime-name: hello.war) in 53ms
      2020-12-11 14:41:44,586 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /hello/hello: java.lang.NullPointerException
      	at io.undertow.servlet.spec.ServletContextImpl.getContextPath(ServletContextImpl.java:210)
      	at io.undertow.servlet.spec.HttpServletRequestImpl.getContextPath(HttpServletRequestImpl.java:296)
      	at com.example.Hello.doGet(Hello.java:29)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:503)
          ...
      

        1. server.log
          28 kB
          Hiroki Daicho

            mshikalw Moulali Shikalwadi
            rhn-support-hdaicho Hiroki Daicho (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: