Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-11103

If ServletInputStream.isReady returns false it is illegal to call the ServletInputStream.read method and EAP returns HTTP 200

XMLWordPrintable

    • Hide
      1. ./standalone.sh
      2. prepare deployment
        • download JBEAP-12223.zip
        • mvn clean package
        • $JBOSS_HOME/bin/jboss-cli.sh -c
        • deploy target/jaxrs-wf.war -f
      3. curl -v --data "aaa" -X POST -H "Content-Type: text/plain" http://127.0.0.1:8080/jaxrs-wf/async
      Show
      ./standalone.sh prepare deployment download JBEAP-12223.zip mvn clean package $JBOSS_HOME/bin/jboss-cli.sh -c deploy target/jaxrs-wf.war -f curl -v --data "aaa" -X POST -H "Content-Type: text/plain" http://127.0.0.1:8080/jaxrs-wf/async

      EAP returns HTTP 200 instead of 500 when IllegalStateException is thrown if ServletInputStream.isReady returns false.
      This exists in 7.2.0.CD14, it works in 7.2.0.CD13.

      Caused by: java.lang.IllegalStateException: UT010035: Stream in async mode was not ready for IO operation
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:164)
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:154)
      	at org.resteasy.simple.deployment.er2.ResourceInfoInjectionResource$1.onDataAvailable(ResourceInfoInjectionResource.java:42)
      	at io.undertow.servlet.spec.ServletContextImpl$3.call(ServletContextImpl.java:188)
      	at io.undertow.servlet.spec.ServletContextImpl$3.call(ServletContextImpl.java:185)
      	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:1502)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
      	at io.undertow.servlet.spec.ServletContextImpl.invokeOnDataAvailable(ServletContextImpl.java:1009)
      	... 4 more
      
      16:27:16,509 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default I/O-5) RESTEASY002020: Unhandled asynchronous exception, sending back 500: org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: java.lang.IllegalStateException: UT010035: Stream in async mode was not ready for IO operation
      	at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:257)
      	at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:197)
      	at org.jboss.resteasy.core.SynchronousDispatcher.asynchronousExceptionDelivery(SynchronousDispatcher.java:513)
      	at org.jboss.resteasy.core.AbstractAsynchronousResponse.internalResume(AbstractAsynchronousResponse.java:228)
      	at org.jboss.resteasy.plugins.server.servlet.Servlet3AsyncHttpRequest$Servlet3ExecutionContext$Servle3AsychronousResponse.resume(Servlet3AsyncHttpRequest.java:118)
      	at org.resteasy.simple.deployment.er2.ResourceInfoInjectionResource$1.onError(ResourceInfoInjectionResource.java:61)
      	at io.undertow.servlet.spec.ServletInputStreamImpl$ServletInputStreamChannelListener$1.run(ServletInputStreamImpl.java:317)
      	at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:181)
      	at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:178)
      	at io.undertow.servlet.spec.ServletContextImpl.invokeRunnable(ServletContextImpl.java:1027)
      	at io.undertow.servlet.spec.ServletInputStreamImpl$ServletInputStreamChannelListener.handleEvent(ServletInputStreamImpl.java:314)
      	at io.undertow.servlet.spec.ServletInputStreamImpl$1$1.run(ServletInputStreamImpl.java:135)
      	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
      	at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
      Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: UT010035: Stream in async mode was not ready for IO operation
      	at io.undertow.servlet.spec.ServletContextImpl.invokeOnDataAvailable(ServletContextImpl.java:1011)
      	at io.undertow.servlet.spec.ServletInputStreamImpl$ServletInputStreamChannelListener.handleEvent(ServletInputStreamImpl.java:295)
      	... 3 more
      Caused by: java.lang.IllegalStateException: UT010035: Stream in async mode was not ready for IO operation
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:164)
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:154)
      	at org.resteasy.simple.deployment.er2.ResourceInfoInjectionResource$1.onDataAvailable(ResourceInfoInjectionResource.java:42)
      	at io.undertow.servlet.spec.ServletContextImpl$3.call(ServletContextImpl.java:188)
      	at io.undertow.servlet.spec.ServletContextImpl$3.call(ServletContextImpl.java:185)
      	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:1502)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
      	at io.undertow.servlet.spec.ServletContextImpl.invokeOnDataAvailable(ServletContextImpl.java:1009)
      	... 4 more
      

      The exception mentions that HTTP 500, should be returned.

      Comment from rpelisse@redhat.com previous JIRA:

      Thanks for the step to reproduce, I've also managed to reproduce the behavior. Debugging through the problem, i've established that the code inserted to adress the isssue is still being used, the exception that lead to a 500 error to be returned is no longer being leading to 500 (but a 200).

      If I'm not mistaken, CD13 used Undertow 2.0.9 while CD14 is now using 2.0.13. I'll keep looking tomorrow to which of the few commits introduced in between those versions can have caused the issue.

              rpelisse@redhat.com Romain Pelisse
              akrajcik@redhat.com Adam Krajcik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: