google-code-export / gwt-comet

Automatically exported from code.google.com/p/gwt-comet
0 stars 1 forks source link

Stack Traces Logged on Browser Disconnect #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In my environment I've noticed a lot of exceptions being logged in my error 
logs like the stack trace shown below.  Debugging things a bit, it appears that 
this message will appear whenever the user closes their browser (so gwt-comet 
doesn't have an opportunity to cleanly shut down the connection.)  Given that 
this behavior would seem pretty common, I'm proposing that the "heartbeat" and 
"tryHeartbeat" methods in CometServletResponseImpl.java be changed to the 
following:

    @Override
    public synchronized void heartbeat() throws IOException {
        if (!terminated) {
            try {
                doHeartbeat();
                flush();
                scheduleHeartbeat();
            }
            catch (IOException e) {
                setTerminated(false);
                if(!(e instanceof java.io.EOFException)) {
                    throw e;
                }
            }
        }
    }

    void tryHeartbeat() {
        try {
            heartbeat();
        }
        catch (IOException e) {
            if(!(e instanceof java.io.EOFException)) {
                servlet.log("Error sending heartbeat", e);
            }
        }
    }

That seems to work well in my environment, but let me know if you'd consider 
adding something similar to gwt-comet in an upcoming release.

Thanks,

     -Shawn

Stack trace follows:

10:18:22,911 | WARN  | qtp1925088074-76 | /                                | 
.eclipse.jetty.util.log.Slf4jLog   50 | 51 - org.eclipse.jetty.util - 
7.3.1.v20110307 | Error sending heartbeat
org.eclipse.jetty.io.EofException
    at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:911)[54:org.eclipse.jetty.http:7.3.1.v20110307]
    at org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:433)[54:org.eclipse.jetty.http:7.3.1.v20110307]
    at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:89)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.server.HttpConnection$Output.flush(HttpConnection.java:1131)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at net.zschech.gwt.comet.server.deflate.DeflaterOutputStream.flush(DeflaterOutputStream.java:100)[71:gwt-comet-1.2.3:1.2.3]
    at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:278)[:1.6.0_27]
    at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)[:1.6.0_27]
    at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)[:1.6.0_27]
    at net.zschech.gwt.comet.server.impl.CometServletResponseImpl.flush(CometServletResponseImpl.java:367)[71:gwt-comet-1.2.3:1.2.3]
    at net.zschech.gwt.comet.server.impl.CometServletResponseImpl.heartbeat(CometServletResponseImpl.java:345)[71:gwt-comet-1.2.3:1.2.3]
    at net.zschech.gwt.comet.server.impl.ManagedStreamCometServletResponseImpl.heartbeat(ManagedStreamCometServletResponseImpl.java:100)[71:gwt-comet-1.2.3:1.2.3]
    at net.zschech.gwt.comet.server.impl.BlockingAsyncServlet.suspend(BlockingAsyncServlet.java:50)[71:gwt-comet-1.2.3:1.2.3]
    at net.zschech.gwt.comet.server.impl.CometServletResponseImpl.suspend(CometServletResponseImpl.java:269)[71:gwt-comet-1.2.3:1.2.3]
    at net.zschech.gwt.comet.server.CometServlet.doCometImpl(CometServlet.java:157)[71:gwt-comet-1.2.3:1.2.3]
    at net.zschech.gwt.comet.server.CometServlet.doGet(CometServlet.java:108)[71:gwt-comet-1.2.3:1.2.3]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)[50:org.apache.geronimo.specs.geronimo-servlet_2.5_spec:1.1.2]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)[50:org.apache.geronimo.specs.geronimo-servlet_2.5_spec:1.1.2]
    at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276)[42:com.google.inject:3.0.0.snapshot]
    at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:176)[42:com.google.inject:3.0.0.snapshot]
    at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)[42:com.google.inject:3.0.0.snapshot]
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)[42:com.google.inject:3.0.0.snapshot]
    at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)[42:com.google.inject:3.0.0.snapshot]
    at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)[42:com.google.inject:3.0.0.snapshot]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)[85:org.eclipse.jetty.servlet:7.3.1.v20110307]
    at org.ops4j.pax.web.service.internal.WelcomeFilesFilter.doFilter(WelcomeFilesFilter.java:169)[90:org.ops4j.pax.web.pax-web-runtime:1.0.3]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)[85:org.eclipse.jetty.servlet:7.3.1.v20110307]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:474)[85:org.eclipse.jetty.servlet:7.3.1.v20110307]
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)[91:org.ops4j.pax.web.pax-web-jetty:1.0.3]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)[84:org.eclipse.jetty.security:7.3.1.v20110307]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:934)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:116)[91:org.ops4j.pax.web.pax-web-jetty:1.0.3]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:404)[85:org.eclipse.jetty.servlet:7.3.1.v20110307]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:184)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:869)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:72)[91:org.ops4j.pax.web.pax-web-jetty:1.0.3]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.server.Server.handle(Server.java:346)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1040)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:592)[54:org.eclipse.jetty.http:7.3.1.v20110307]
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)[54:org.eclipse.jetty.http:7.3.1.v20110307]
    at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)[83:org.eclipse.jetty.server:7.3.1.v20110307]
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:526)[52:org.eclipse.jetty.io:7.3.1.v20110307]
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:41)[52:org.eclipse.jetty.io:7.3.1.v20110307]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)[51:org.eclipse.jetty.util:7.3.1.v20110307]
    at java.lang.Thread.run(Thread.java:662)[:1.6.0_27]
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)[:1.6.0_27]
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)[:1.6.0_27]
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69)[:1.6.0_27]
    at sun.nio.ch.IOUtil.write(IOUtil.java:26)[:1.6.0_27]
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)[:1.6.0_27]
    at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:188)[52:org.eclipse.jetty.io:7.3.1.v20110307]
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:291)[52:org.eclipse.jetty.io:7.3.1.v20110307]
    at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:855)[54:org.eclipse.jetty.http:7.3.1.v20110307]

Original issue reported on code.google.com by squ...@moxiegroup.com on 11 Feb 2012 at 3:34