Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
Minor
-
Resolution: Works as Designed
-
Affects Version/s: 3.2.3
-
Fix Version/s: None
-
Component/s: Web
-
Labels:
-
Last commented by a User:true
Description
I'm using Spring 3.2.3 and Tomcat 7.0.41 with the NIO backend. I'm (still) experiencing problems with timeout handling of DeferredResult. (See SPR-10485 for an earlier bug.)
Consider the following code:
@Controller public class TestController { @RequestMapping(value="/test") @ResponseBody public DeferredResult<String> test() { return new DeferredResult<String>(50L, "timeout\n"); } }
Now, create 100 threads which send this request in a loop: (The "parallel" command here is GNU parallel.)
yes 'curl --silent http://localhost:8080/test' | parallel -j100
Some of these requests will fail and Tomcat will log the this exception:
jul 01, 2013 11:42:38 AM org.apache.coyote.AbstractProtocol$AbstractConnectionHandler process SEVERE: Error reading request, ignored java.lang.IllegalStateException: Calling [asyncPostProcess()] is not valid for a request with Async state [STARTED] at org.apache.coyote.AsyncStateMachine.asyncPostProcess(AsyncStateMachine.java:204) at org.apache.coyote.AbstractProcessor.asyncPostProcess(AbstractProcessor.java:116) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:593) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)