org.eclipse.jetty.io.EofException

Java.net JIRA | ricb | 2 years ago
  1. 0

    We are using Server-Sent Events to allow our client application to listen to events raised by our Jersey server. This works great. We have a requirement for our server to have an accurate list of currently-connected SSE callers (instances of our client application). To this end, our server sends a tiny message to each client (via eventOutput.write) once every five seconds. If our client is shut down while SSE-connected, or if the remote computer is powered off while SSE-connected, our server's eventOutput.write call correctly throws the ClientAbortException/SocketException exception shown below. That's perfect: we catch the exception, and mark that client as no longer connected. The problem: there are two cases where calling eventOutput.write to a no-longer-connected computer does NOT throw an exception: 1) if the Ethernet cable of the remote computer is disconnected while the client is SSE-connected, and 2) if the network adapter in the remote computer is turned off (e.g., by an administrator) while the client is SSE-connected. In these two cases, eventOutput.write does not throw an exception. We can call eventOutput.write to the remote computer every five seconds for hours and no exception is thrown. This makes it impossible to detect that the remote computer is no longer connected. To sum up, there are four cases: 1) Client software is shut down: eventOutput.write() correctly throws an exception. 2) Computer running client software is powered down: eventOutput.write() correctly throws an exception. 3) Etherhet cable is disconnected from computer running client software: eventOutput.write does not detect broken connection. 4) Network adapter on computer running client software is turned off: eventOutput.write does not detect broken connection. Here is the (good/useful) exception we get in cases where eventOutput.write DOES throw the exception we want: {code} org.apache.catalina.connector.ClientAbortException: null at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:371) ~[catalina.jar:7.0.53] at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:333) ~[catalina.jar:7.0.53] at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:101) ~[catalina.jar:7.0.53] at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.flush(ResponseWriter.java:303) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.message.internal.CommittingOutputStream.flush(CommittingOutputStream.java:292) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:240) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:190) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.internal.Errors.process(Errors.java:242) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:347) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.server.ChunkedOutput.flushQueue(ChunkedOutput.java:190) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.server.ChunkedOutput.write(ChunkedOutput.java:180) ~[jaxrs-ri-2.13.jar:2.13.] at com.appserver.webservice.AgentSsePollingManager$ConnectionChecker.run(AgentSsePollingManager.java:174) ~[AgentSsePollingManager$ConnectionChecker.class:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_71] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_71] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_71] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71] Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.7.0_71] at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113) ~[na:1.7.0_71] at java.net.SocketOutputStream.write(SocketOutputStream.java:159) ~[na:1.7.0_71] at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215) ~[tomcat-coyote.jar:7.0.53] at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480) ~[tomcat-coyote.jar:7.0.53] at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119) ~[tomcat-coyote.jar:7.0.53] at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:799) ~[tomcat-coyote.jar:7.0.53] at org.apache.coyote.Response.action(Response.java:174) ~[tomcat-coyote.jar:7.0.53] at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:366) ~[catalina.jar:7.0.53] ... 19 common frames omitted {code}

    Java.net JIRA | 2 years ago | ricb
    org.eclipse.jetty.io.EofException
  2. 0

    We are using Server-Sent Events to allow our client application to listen to events raised by our Jersey server. This works great. We have a requirement for our server to have an accurate list of currently-connected SSE callers (instances of our client application). To this end, our server sends a tiny message to each client (via eventOutput.write) once every five seconds. If our client is shut down while SSE-connected, or if the remote computer is powered off while SSE-connected, our server's eventOutput.write call correctly throws the ClientAbortException/SocketException exception shown below. That's perfect: we catch the exception, and mark that client as no longer connected. The problem: there are two cases where calling eventOutput.write to a no-longer-connected computer does NOT throw an exception: 1) if the Ethernet cable of the remote computer is disconnected while the client is SSE-connected, and 2) if the network adapter in the remote computer is turned off (e.g., by an administrator) while the client is SSE-connected. In these two cases, eventOutput.write does not throw an exception. We can call eventOutput.write to the remote computer every five seconds for hours and no exception is thrown. This makes it impossible to detect that the remote computer is no longer connected. To sum up, there are four cases: 1) Client software is shut down: eventOutput.write() correctly throws an exception. 2) Computer running client software is powered down: eventOutput.write() correctly throws an exception. 3) Etherhet cable is disconnected from computer running client software: eventOutput.write does not detect broken connection. 4) Network adapter on computer running client software is turned off: eventOutput.write does not detect broken connection. Here is the (good/useful) exception we get in cases where eventOutput.write DOES throw the exception we want: {code} org.apache.catalina.connector.ClientAbortException: null at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:371) ~[catalina.jar:7.0.53] at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:333) ~[catalina.jar:7.0.53] at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:101) ~[catalina.jar:7.0.53] at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.flush(ResponseWriter.java:303) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.message.internal.CommittingOutputStream.flush(CommittingOutputStream.java:292) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:240) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:190) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.internal.Errors.process(Errors.java:242) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:347) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.server.ChunkedOutput.flushQueue(ChunkedOutput.java:190) ~[jaxrs-ri-2.13.jar:2.13.] at org.glassfish.jersey.server.ChunkedOutput.write(ChunkedOutput.java:180) ~[jaxrs-ri-2.13.jar:2.13.] at com.appserver.webservice.AgentSsePollingManager$ConnectionChecker.run(AgentSsePollingManager.java:174) ~[AgentSsePollingManager$ConnectionChecker.class:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_71] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_71] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_71] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71] Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.7.0_71] at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113) ~[na:1.7.0_71] at java.net.SocketOutputStream.write(SocketOutputStream.java:159) ~[na:1.7.0_71] at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215) ~[tomcat-coyote.jar:7.0.53] at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480) ~[tomcat-coyote.jar:7.0.53] at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119) ~[tomcat-coyote.jar:7.0.53] at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:799) ~[tomcat-coyote.jar:7.0.53] at org.apache.coyote.Response.action(Response.java:174) ~[tomcat-coyote.jar:7.0.53] at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:366) ~[catalina.jar:7.0.53] ... 19 common frames omitted {code}

    Java.net JIRA | 2 years ago | ricb
    org.eclipse.jetty.io.EofException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    "Broken pipe" exception with long-running (SSE) request handlers

    GitHub | 2 years ago | brutasse
    java.lang.Error: org.eclipse.jetty.io.EofException
  5. 0

    neo4j creating multiple nodes json

    Stack Overflow | 3 years ago | Nipun
    javax.ws.rs.WebApplicationException: javax.ws.rs.WebApplicationException: org.eclipse.jetty.io.EofException

  1. Nikolay Rybak 1 times, last 10 months ago
  2. MoYapro 7 times, last 3 weeks ago
  3. DoktorDoener666 5 times, last 3 weeks ago
  4. tvrmsmith 1 times, last 1 month ago
  5. dafman 1 times, last 2 months ago
21 more registered users
74 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    Broken pipe

    at sun.nio.ch.FileDispatcherImpl.writev0()
  2. Java RT
    SocketChannelImpl.write
    1. sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
    2. sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
    3. sun.nio.ch.IOUtil.write(IOUtil.java:148)
    4. sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:504)
    4 frames
  3. Jetty
    HttpOutput.flush
    1. org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:169)
    2. org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:335)
    3. org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:125)
    4. org.eclipse.jetty.server.HttpConnection$ContentCallback.process(HttpConnection.java:680)
    5. org.eclipse.jetty.util.IteratingCallback.processIterations(IteratingCallback.java:166)
    6. org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:126)
    7. org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:303)
    8. org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:720)
    9. org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:751)
    10. org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:128)
    11. org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:122)
    12. org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:201)
    12 frames
  4. jersey-container-servlet-core
    ResponseWriter$NonCloseableOutputStreamWrapper.flush
    1. org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.flush(ResponseWriter.java:308)
    1 frame
  5. Jersey Core
    CommittingOutputStream.flush
    1. org.glassfish.jersey.message.internal.CommittingOutputStream.flush(CommittingOutputStream.java:292)
    1 frame
  6. jersey-core-server
    ChunkedOutput$1.call
    1. org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:240)
    2. org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:190)
    2 frames
  7. Jersey Core
    RequestScope.runInScope
    1. org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    2. org.glassfish.jersey.internal.Errors.process(Errors.java:242)
    3. org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:367)
    3 frames
  8. jersey-core-server
    Broadcaster.broadcast
    1. org.glassfish.jersey.server.ChunkedOutput.flushQueue(ChunkedOutput.java:190)
    2. org.glassfish.jersey.server.ChunkedOutput.write(ChunkedOutput.java:180)
    3. org.glassfish.jersey.server.Broadcaster$1.run(Broadcaster.java:154)
    4. org.glassfish.jersey.server.Broadcaster$1.run(Broadcaster.java:151)
    5. org.glassfish.jersey.server.Broadcaster.forEachOutput(Broadcaster.java:204)
    6. org.glassfish.jersey.server.Broadcaster.broadcast(Broadcaster.java:151)
    6 frames
  9. org.glassfish.jersey
    ItemStoreResource.addItem
    1. org.glassfish.jersey.examples.sseitemstore.ItemStoreResource.addItem(ItemStoreResource.java:237)
    1 frame
  10. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:497)
    4 frames
  11. jersey-core-server
    ServerRuntime$2.run
    1. org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    2. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
    3. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:160)
    4. org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:142)
    5. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
    6. org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
    7. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
    8. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
    9. org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:309)
    9 frames
  12. Jersey Core
    RequestScope.runInScope
    1. org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    2. org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    3. org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    4. org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    5. org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    6. org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    6 frames
  13. jersey-core-server
    ApplicationHandler.handle
    1. org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:292)
    2. org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1139)
    2 frames
  14. jersey-container-servlet-core
    ServletContainer.service
    1. org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
    2. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
    3. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
    4. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
    4 frames
  15. Jetty
    QueuedThreadPool$3.run
    1. org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:717)
    2. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1644)
    3. org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:164)
    4. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1615)
    5. org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550)
    6. org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    7. org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:568)
    8. org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
    9. org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1110)
    10. org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:479)
    11. org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
    12. org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1044)
    13. org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    14. org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199)
    15. org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
    16. org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    17. org.eclipse.jetty.server.Server.handle(Server.java:459)
    18. org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:281)
    19. org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232)
    20. org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505)
    21. org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
    22. org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
    22 frames
  16. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:745)
    1 frame