Hi all, I faced a problem while using asynchronous computing of the HTTP requests My code is really simple
AsyncContext asyncContext = request.startAsync(request, response); If I interrupt the request from the client, I got java.lang.IllegalStateException: Calling [asyncStart()] is not valid for a request with Async state [ERROR] at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:152) at org.apache.coyote.AsyncStateMachine.asyncStart(AsyncStateMachine.java:242) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1257) at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:497) at org.apache.coyote.Request.action(Request.java:432) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:741) at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:561) at org.apache.catalina.core.AsyncContextImpl.setStarted(AsyncContextImpl.java:323) at org.apache.catalina.connector.Request.startAsync(Request.java:1690) at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:505) at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1050) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:538) at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:402) What is the best way to handle this case? Is there any variable in somewhere (AsyncContext object?) to check before calling asyncStart() ? Otherwise, should I catch the IllegalStateException? I'm using v9.0.39 Nicolò Boschi