Mantis - Resin
Viewing Issue Advanced Details
4723 minor always 08-22-11 11:02 09-02-11 10:29
closed 4.0.21  
none 4.0.21  
0004723: async state machine issues
(rep by Mark Price)

we're seeing some odd errors in our production logs when processing async requests.
The message we see is:

java.lang.IllegalStateException: async dispatch is not valid outside of an async cycle. Current state: INIT
    at com.caucho.server.http.AsyncContextImpl.dispatch(

where current state is one of INIT,REQUEST,KEEPALIVE.

Our usage pattern is as follows:

on request thread
- ServletRequest.startAsync(request, response)
- store AsyncContext in a ConcurrentHashMap keyed by sessionId

on incoming event thread
- lookup AsyncContext by sessionId
- AsyncContextImpl.dispatch()

We have a copy of the code that is causing this error, and it looks as though we should never have more than one AsyncContext per session. Are there any other scenarios in which this error is expected - i.e. is AysncContext state guaranteed to be ready for dispatch after ServletRequest.startAsync(request, response)?

There are no notes attached to this issue.