Terminating GWT Comet Session

124 views
Skip to first unread message

AgitoM

unread,
Dec 13, 2011, 8:08:27 AM12/13/11
to gwt-comet
I know this is a common problem, but can't find the solution in a
project I'm currently working on. (For some reason its not an issue in
a other project I build).

I'm using a button on a GUI to disconnect from a GWT Comet session.
The button send a RPC call to the server, and the server executes this
code:

@Override
public void disconnectCometSession() {
HttpSession httpSession = getThreadLocalRequest().getSession(false);
if (httpSession == null) {
System.out.println("No HTTP session available");
}
else {

// check if there is a Comet session setup. In a larger
application the HTTP session may have been
// setup via other means.
CometSession cometSession =
CometServlet.getCometSession(httpSession, false);
if (cometSession == null) {
System.out.println("No Comet session available");
}

// remove the mapping of user name to CometSession
String id = httpSession.getId();
users.remove(id);
}
}

Then on callback, I invoke this code on the client side:

private class DisconnectCallback implements AsyncCallback {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}

@Override
public void onSuccess(Object result) {
cometClient.stop();
System.out.println("Disconnected 1");
}
}

But for some reason, I get this error a few seconds later:

Starting Jetty on port 8888
[WARN] Error sending heartbeat
org.mortbay.jetty.EofException
at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:760)
at org.mortbay.jetty.AbstractGenerator
$Output.flush(AbstractGenerator.java:566)
at org.mortbay.jetty.HttpConnection$Output.flush(HttpConnection.java:
911)
at
net.zschech.gwt.comet.server.deflate.DeflaterOutputStream.flush(DeflaterOutputStream.java:
100)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:297)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at
net.zschech.gwt.comet.server.impl.CometServletResponseImpl.flush(CometServletResponseImpl.java:
366)
at
net.zschech.gwt.comet.server.impl.CometServletResponseImpl.heartbeat(CometServletResponseImpl.java:
345)
at
net.zschech.gwt.comet.server.impl.ManagedStreamCometServletResponseImpl.heartbeat(ManagedStreamCometServletResponseImpl.java:
100)
at
net.zschech.gwt.comet.server.impl.BlockingAsyncServlet.suspend(BlockingAsyncServlet.java:
92)
at
net.zschech.gwt.comet.server.impl.CometServletResponseImpl.suspend(CometServletResponseImpl.java:
269)
at
net.zschech.gwt.comet.server.CometServlet.doCometImpl(CometServlet.java:
157)
at net.zschech.gwt.comet.server.CometServlet.doGet(CometServlet.java:
108)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
362)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at
org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:
49)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
505)
at org.mortbay.jetty.HttpConnection
$RequestHandler.headerComplete(HttpConnection.java:829)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
395)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.io.IOException: An established connection was aborted
by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:89)
at sun.nio.ch.IOUtil.write(IOUtil.java:46)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:450)
at org.mortbay.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:160)
at
org.mortbay.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:
207)
at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:693)
... 32 more

My code is nearly 100% similar to that in a other project. So hope
anyone can provide some insight.

martin...@gmail.com

unread,
Apr 27, 2012, 5:49:20 AM4/27/12
to gwt-...@googlegroups.com
Hi,
  I have the same problem. client.stop() simply does not work, nothing gets disconnected on server. After several seconds, Jetty fails with EofException. What's worse, any further client.start() calls simply do nothing and the browser ends up using 100% CPU. I'm using GWT 2.4
martin
Reply all
Reply to author
Forward
0 new messages