Mantis - Resin
Viewing Issue Advanced Details
4723 minor always 08-22-11 11:02 09-02-11 10:29
ferg  
ferg  
normal  
closed 4.0.21  
fixed  
none    
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.network.listen.SocketLinkRequestState.toAsyncWake(SocketLinkRequestState.java:278)
    at com.caucho.network.listen.TcpSocketLink.requestWakeComet(TcpSocketLink.java:681)
    at com.caucho.network.listen.TcpAsyncController.wake(TcpAsyncController.java:113)
    at com.caucho.server.http.AsyncContextImpl.dispatch(AsyncContextImpl.java:237)

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.