Tomcat 7 + Servlet 3.0 + cometD

217 views
Skip to first unread message

Juriy

unread,
Nov 20, 2010, 9:14:14 AM11/20/10
to cometd-users
Hello guys,

I've googled a bit for a working solution on Tomcat 7 + CometD
integration with long-polling, but couldn't make my way through.

The problem is as follows: during the first long-polling request jetty-
continuation figures out that there's a Servlet 3.0 async support and
uses it. When timeout hits, the following exception is thrown:

java.lang.IllegalStateException: Calling [dispatchAsync()] is not
valid for a request with Async state [TIMING_OUT]
at
org.apache.coyote.AsyncStateMachine.asyncDispatch(AsyncStateMachine.java:
220)
at
org.apache.coyote.http11.Http11NioProcessor.actionInternal(Http11NioProcessor.java:
672)
at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:
937)
at org.apache.coyote.Request.action(Request.java:348)
at
org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:
173)
at
org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:
135)
at
org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:
130)
at org.eclipse.jetty.continuation.Servlet3Continuation
$1.onTimeout(Servlet3Continuation.java:62)
at
org.apache.catalina.core.AsyncListenerWrapper.fireOnTimeout(AsyncListenerWrapper.java:
45)
at
org.apache.catalina.core.AsyncContextImpl.timeout(AsyncContextImpl.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:
270)
at
org.apache.coyote.http11.Http11NioProcessor.asyncDispatch(Http11NioProcessor.java:
232)
at org.apache.coyote.http11.Http11NioProtocol
$Http11ConnectionHandler.event(Http11NioProtocol.java:305)
at org.apache.tomcat.util.net.NioEndpoint
$SocketProcessor.run(NioEndpoint.java:1526)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

Then the server continues to work without long-poll (polled every
couple of seconds and return immediately)

It looks like there's some kind of a bug that is not quite related to
CometD itself, but rather to Servlet3Continuation from jetty, but I
just hope that somebody already encountered it and maybe knows how to
deal with it.

Here's my setup:

Tomcat 7.0.4
cometD 2.1.0beta2

Tomcat is set to use the org.apache.coyote.http11.Http11NioProtocol,
the CometdServlet is configured to allow async processing:
<async-supported>true</async-supported>
in web.xml.

Simone Bordet

unread,
Nov 20, 2010, 11:25:19 AM11/20/10
to cometd...@googlegroups.com
Hi,

ContinuationListeners are entitled to call AsyncContext.dispatch(),
which is what the Jetty Continuation does, so this looks like a Tomcat
bug to me.

Simon
--
http://bordet.blogspot.com
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

Juriy

unread,
Nov 20, 2010, 12:42:46 PM11/20/10
to cometd-users
Yeah, I've looked through the Servlet 3.0 specs and tried the code
just with Tomcat without CometD or Jetty. So currently Tomcat 7 (7.0.4
to be exact) + CometD will not play nice together. If anybody cares
about it, I've posted the bug to Tomcat's bugtracker, you might want
to vote for it: https://issues.apache.org/bugzilla/show_bug.cgi?id=50308

// Juriy
> --http://bordet.blogspot.com
Reply all
Reply to author
Forward
0 new messages