cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Dawkins (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5659) IllegalStateException on Async call
Date Fri, 28 Mar 2014 12:55:16 GMT

    [ https://issues.apache.org/jira/browse/CXF-5659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13950652#comment-13950652
] 

Stephen Dawkins commented on CXF-5659:
--------------------------------------

Sorry, I meant to add that. I'm using Jetty 9.1.2.v20140210. Also I forgot to note that the
response is getting sent back to the client fine, this exception happens after that.

The Javadoc for complete() says it's only valid after startAsync and before dispatch, I've
stepped through the code, and dispatch is definitely called first. 

> IllegalStateException on Async call
> -----------------------------------
>
>                 Key: CXF-5659
>                 URL: https://issues.apache.org/jira/browse/CXF-5659
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.7.10
>            Reporter: Stephen Dawkins
>            Priority: Minor
>              Labels: continuation
>
> I've come acrossed an odd exception when attempting to use an Async JAX-WS Provider:
> {code}java.lang.IllegalStateException: s=DISPATCHED i=false a=null
> 	at org.eclipse.jetty.server.HttpChannelState.complete(HttpChannelState.java:430)
> 	at org.eclipse.jetty.server.AsyncContextState.complete(AsyncContextState.java:92)
> 	at org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.reset(Servlet3ContinuationProvider.java:131)
> 	at org.apache.cxf.transport.http.Servlet3ContinuationProvider.complete(Servlet3ContinuationProvider.java:55)
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:242)
> 	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
> 	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
> 	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:717)
> 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> 	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:544)
> 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
> 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1112)
> 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:479)
> 	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
> 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1046)
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
> 	at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159)
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
> 	at org.eclipse.jetty.server.Server.handleAsync(Server.java:516)
> 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:288)
> 	at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:237)
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
> 	at java.lang.Thread.run(Thread.java:722){code}
> From what I've been able to determine, it appears it is attempting to call AsyncContext.complete()
after AsyncContext.dispatch() has been called from Servlet3Continuation.redispatch()/resume().
> I changed the Servlet3.Continuation.reset() method to this to 'fix' it:
> {code:java}        public void reset() {
>             if (!isResumed) {
>                 context.complete();
>             }
>             obj = null;
>         }{code}
> But I'm not sure if that's correct.
> I also changed the Servlet3Continuation.startAsyncAgain() method, as I spotted it adding
a duplicate listener:
> {code:java}        void startAsyncAgain() {
>             AsyncContext old = context;
>             try {
>                 context = req.startAsync();
>                 context.addListener(this);
>             } catch (IllegalStateException ex) { 
>                 context = old;
>             }
>         }{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message