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

NPE happens at StoredResponseStreamSinkConduit.terminateWrites when StoredResponseHandler (store-response) is enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.2.4.Final, 2.1.6.Final, 2.0.34.Final, 2.0.34.SP1
    • Core
    • None
    • Hide

      1. Enable StoredResponseHandler (store-response) with RequestDumpingHandler (dump-request) to dump request and response information (both header and body) in the undertow subsystem in standalone.xml

          <server name="default-server">
              ... 
              <host name="default-host" alias="localhost">
                  ... 
                  <filter-ref name="dump-request-and-response-filter"/> <!-- add this --> 
              </host>
          </server>
          ... 
          <filters>
              <expression-filter name="dump-request-and-response-filter" expression="dump-request;eager-form-parser;store-response;"/> <!-- add this --> 
          </filters>
      

      2. Deploy a web application like https://github.com/jboss-developer/jboss-eap-quickstarts/tree/7.3.x/helloworld-rs

      3. Send a request

      $ curl -v http://localhost:8080/helloworld-rs/rest/xml
      

      RequestDumpingHandler works fine to dump request/response in sever.log, but you will see NullPointerException at io.undertow.conduits.StoredResponseStreamSinkConduit.terminateWrites().

      Show
      1. Enable StoredResponseHandler (store-response) with RequestDumpingHandler (dump-request) to dump request and response information (both header and body) in the undertow subsystem in standalone.xml <server name= " default -server" > ... <host name= " default -host" alias= "localhost" > ... <filter-ref name= "dump-request-and-response-filter" /> <!-- add this --> </host> </server> ... <filters> <expression-filter name= "dump-request-and-response-filter" expression= "dump-request;eager-form-parser;store-response;" /> <!-- add this --> </filters> 2. Deploy a web application like https://github.com/jboss-developer/jboss-eap-quickstarts/tree/7.3.x/helloworld-rs 3. Send a request $ curl -v http: //localhost:8080/helloworld-rs/ rest /xml RequestDumpingHandler works fine to dump request/response in sever.log, but you will see NullPointerException at io.undertow.conduits.StoredResponseStreamSinkConduit.terminateWrites().
    • Undefined

      When StoredResponseHandler (store-response) is enabled to dump response body with RequestDumpingHandler (dump-request), NullPointerException happens at io.undertow.conduits.StoredResponseStreamSinkConduit.terminateWrites() at the end of the request processing.

      ERROR [io.undertow.request] (default task-1) UT005071: Undertow request failed HttpServerExchange{ GET /helloworld-rs/rest/xml}: java.lang.NullPointerException
      	at io.undertow.conduits.StoredResponseStreamSinkConduit.terminateWrites(StoredResponseStreamSinkConduit.java:148)
      	at org.xnio.conduits.ConduitStreamSinkChannel.shutdownWrites(ConduitStreamSinkChannel.java:178)
      	at io.undertow.channels.DetachableStreamSinkChannel.shutdownWrites(DetachableStreamSinkChannel.java:79)
      	at io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:618)
      	at io.undertow.servlet.spec.HttpServletResponseImpl.closeStreamAndWriter(HttpServletResponseImpl.java:534)
      	at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:623)
      	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:328)
      	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
      	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
      	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
      	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
      	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      	at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
      	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
      	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
      	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:370)
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280)
      	at java.lang.Thread.run(Thread.java:748)
      

              rhn-support-mmiura Masafumi Miura
              rhn-support-mmiura Masafumi Miura
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: