Hi

> Make sure you are using the latest 8.0.26 release. There have been some fixes 
> around async dispatch. If you still see the issue then
> we'll need a test case (as simple as possible) that reproduces the issue for 
> us to investigate.

I just upgraded to 8.0.26. But I see the same exception again:

Aug 26, 2015 9:42:41 AM org.apache.catalina.connector.CoyoteAdapter 
asyncDispatch
SCHWERWIEGEND: Exception while processing an asynchronous request
java.lang.IllegalStateException: Calling [asyncError()] is not valid for a 
request with Async state [MUST_COMPLETE]
        at 
org.apache.coyote.AsyncStateMachine.asyncError(AsyncStateMachine.java:351)
        at 
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:820)
        at org.apache.coyote.Request.action(Request.java:378)
        at 
org.apache.catalina.core.AsyncContextImpl.setErrorState(AsyncContextImpl.java:419)
        at 
org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:332)
        at 
org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1709)
        at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:649)
        at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526)
        at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)


I *think* this happens in the following case:

1. A client opens an html file using https that gets dispatched to an Async 
servlet.

2. The servlet calls startAsync, registers read/write/context handlers:
        AsyncContext context = request.startAsync();
        context.setTimeout( 0 );
        ServletInputStream input = request.getInputStream();
        ServletOutputStream output = response.getOutputStream();
        ChannelProcessor processor = new ChannelProcessor( ... );
        context.addListener( processor );
        input.setReadListener( processor );
        output.setWriteListener( processor );

3. The server writes some data to "output".
4. As the client is not sending data, "onAllDataRead" is called and the 
reference to "input" is dropped.
5. "onWritePossible" is called, but there is no more data to send for now.
6. The client window is closed. (BTW: The servlet is not notified about that at 
all.)
7. Later, an server event occurs and the server writes to "output" again (after 
checking "isReady").

I think this is the point, the exception is logged.


I will try to create a testcase, but stripping down that code is far from easy 
as it is in the middle of a framework.


I would also like to increase logging in tomcat, but I could not find out, how 
to do so.
My current logging.properties consists of the following only:


handlers = java.util.logging.ConsoleHandler
.handlers = java.util.logging.ConsoleHandler

.level = TRACE
org.apache.level = TRACE


I suspect that should set any logger to TRACE, but only a few lines are 
logged...


Regards,
  Steffen

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to