Details
-
Bug
-
Resolution: Done
-
Major
-
8.0.0.Final, 8.1.0.Final, 9.0.0.Alpha1
-
None
Description
Issue is described in https://community.jboss.org/thread/242415
If client uses "Connection:keep-alive" and "Expect:100-continue" in HTTP request header and send multiple requests, Wildfly (including 8.0.0 and 8.1.0) throws following exception:
2014-06-29 11:12:14,721 ERROR [io.undertow.request] (default task-26) Blocking request failed HttpServerExchange{ POST /enterprise/composite/postAndSend}: java.lang.IllegalStateException: UT000004: getResponseChannel() has already been called at io.undertow.server.protocol.http.HttpContinue.createResponseSender(HttpContinue.java:78) at io.undertow.server.handlers.HttpContinueReadHandler$ContinueConduit.read(HttpContinueReadHandler.java:104) at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127) [xnio-api-3.2.0.Final.jar:3.2.0.Final] at io.undertow.channels.DetachableStreamSourceChannel.read(DetachableStreamSourceChannel.java:181) at io.undertow.server.HttpServerExchange$ReadDispatchChannel.read(HttpServerExchange.java:1897) at org.xnio.channels.Channels.readBlocking(Channels.java:294) [xnio-api-3.2.0.Final.jar:3.2.0.Final] at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:138) at io.undertow.servlet.spec.ServletInputStreamImpl.close(ServletInputStreamImpl.java:218) at io.undertow.servlet.spec.HttpServletRequestImpl.closeAndDrainRequest(HttpServletRequestImpl.java:589) at io.undertow.servlet.core.ServletBlockingHttpExchange.close(ServletBlockingHttpExchange.java:69) at io.undertow.server.HttpServerExchange.endExchange(HttpServerExchange.java:1363) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:183) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_55]
If there are multiple users sending this kind of requests, Wildfly eventually undeploy all applications.
Here is a test code using Apache HTTP client
HttpPost request = new HttpPost(serverURL); for (int i=0; i<200; i++) { StringEntity input = new StringEntity (payLoad); input.setContentType("application/json"); request.setHeader("Connection", "keep-alive"); request.setHeader("Expect", "100-continue"); request.setEntity(input); HttpResponse response = httpclient.execute(request); HttpEntity entity = response.getEntity(); if (entity != null) { System.out.println("Response content length: " + entity.getContentLength()); } EntityUtils.consume(entity); if (entity != null) { System.out.println("Response content length: " + entity.getContentLength()); } EntityUtils.consume(entity); }