Mantis - Resin
Viewing Issue Advanced Details
4697 minor always 08-03-11 10:06 08-04-11 11:54
ferg  
ferg  
normal  
closed  
fixed  
none    
none 4.0.21  
0004697: async onComplete is calling GET
(rep by Adrian Sutton)

We've been trying to track down an exception we see quite regularly in the resin logs:
java.lang.IllegalStateException: Comet cannot be requested after complete().
    at com.caucho.network.listen.TcpSocketLink.toComet(TcpSocketLink.java:1393)
    at com.caucho.server.http.AsyncContextImpl.restart(AsyncContextImpl.java:85)
    at com.caucho.server.http.HttpServletRequestImpl.startAsync(HttpServletRequestImpl.java:1774)
    at com.caucho.server.http.CauchoRequestWrapper.startAsync(CauchoRequestWrapper.java:326)
    at com.foo.hcf.push.PushServlet.parkAsyncContext(PushServlet.java:146)
    at com.foo.hcf.push.PushServlet.handleRequest(PushServlet.java:106)
    at com.foo.hcf.push.PushServlet.doPost(PushServlet.java:59)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:158)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:96)
    at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
    at com.lmax.hcf.web.InvocationContextFilter.doFilter(InvocationContextFilter.java:70)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:126)
    at com.caucho.server.webapp.ResumeFilterChain.doFilter(ResumeFilterChain.java:142)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:287)
    at com.caucho.server.webapp.RequestDispatcherImpl.dispatchResume(RequestDispatcherImpl.java:510)
    at com.caucho.server.webapp.RequestDispatcherImpl.dispatchResume(RequestDispatcherImpl.java:124)
    at com.caucho.server.http.AbstractHttpRequest.handleResume(AbstractHttpRequest.java:1524)
    at com.caucho.network.listen.TcpSocketLink.handleResumeTask(TcpSocketLink.java:974)
    at com.caucho.network.listen.CometResumeTask.doTask(CometResumeTask.java:60)
    at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:97)
    at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:80)
    at com.caucho.network.listen.CometResumeTask.run(CometResumeTask.java:51)
    at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
    at com.caucho.env.thread.ResinThread.run(ResinThread.java:130)


I believe this is occurring because when we call asyncContext.complete(), the request is passed back through doGet/doPost again, at the end of which we try to call request.startAsync again. As I understand it, asyncContext.complete() just cause the response to be committed "as-is" and not trigger a final processing by the servlet class.

Let me know if you need any further information etc.


Notes
(0005426)
ferg   
08-04-11 11:54   
server/1lb5