java.net.SocketException: Broken pipe

tip

Nginx does not handle websocket requests. Configure nginx proxy for websockets.

tip

Upgrade your docker-selenium

tip

Client closed the websocket connection (safe to ignore)

tip

*not english*


poroszd
tip

It takes too long time for the JVM to find enough entropy for secure connection. Use this jvm option: '-Djava.security.egd=file:/dev/./urandom'.

tip

Upgrade yokozuna

tip

Set larger socket timeout (or 0 to set no timeout).

tip

Upgrade your nanohttpd

tip

Here is a animation for the life cycle. http://tcp.cs.st-andrews.ac.uk/index.shtml?page=connection_lifecycle

tip

Probably there is a bug in TestNG Eclipse plugin (6.8.6.20130607_0745), try an other version (e.g. 6.8.0.20121120_1820)

tip

before running my test in debug mode, i open the debug view, and remove some breakpoints (such as some remaining on NullPointersExceptions, and Sockets)

tip

Try removing all the breakpoints (even if breakpoints are disabled the problem still occurs, yes even if both disabled entirely and piecewise).

tip

There is a known issue between TestNG 6.4 and IDEA, the next EAP will fix this but in the meantime, use the previous version.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Spring 4 websockets causing tons of exceptions
    via Stack Overflow by pdeva
    ,
  • We are using websockets on tomcat 7.0.50 with an in memory simple spring broker. Our logs are littered with this exception {code} 3 ERROR MessageBrokerSockJS-1 handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession:276 - Terminating connection after failure to send message to client. This may be because the client has gone away (see https://java.net/jira/browse/SERVLET_SPEC-44) Feb 15 12:05:16 apmgui i-04e9bc6a: ClientAbortException: java.net.SocketException: Broken pipe Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:371) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:333) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.Response.flushBuffer(Response.java:570) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:307) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:81) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.writeFrameInternal(StreamingSockJsSession.java:99) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:273) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:294) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession$1.run(AbstractSockJsSession.java:309) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.FutureTask.run(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.lang.Thread.run(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: Caused by: java.net.SocketException: Broken pipe Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.socketWrite0(Native Method) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.socketWrite(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.write(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:805) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.Response.action(Response.java:174) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:366) Feb 15 12:05:16 apmgui i-04e9bc6a: ... 17 more {code} Either: 1. This is a bug in spring, in which case fix it 2. This is expected behavior, in which case provide a workaround/documentation for it so our logs are not littered by it. Either way, this behavior is not documented and presence of this issue makes logs very, very heavy. Not to mention we don't know if this is an actual error in our app or one we can ignore. Either fix this issue or provide an explanation/documentation for it.
    via by Prashant Deva,
  • We are using websockets on tomcat 7.0.50 with an in memory simple spring broker. Our logs are littered with this exception {code} 3 ERROR MessageBrokerSockJS-1 handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession:276 - Terminating connection after failure to send message to client. This may be because the client has gone away (see https://java.net/jira/browse/SERVLET_SPEC-44) Feb 15 12:05:16 apmgui i-04e9bc6a: ClientAbortException: java.net.SocketException: Broken pipe Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:371) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:333) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.Response.flushBuffer(Response.java:570) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:307) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:81) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.writeFrameInternal(StreamingSockJsSession.java:99) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:273) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:294) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession$1.run(AbstractSockJsSession.java:309) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.FutureTask.run(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.lang.Thread.run(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: Caused by: java.net.SocketException: Broken pipe Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.socketWrite0(Native Method) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.socketWrite(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.write(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:805) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.Response.action(Response.java:174) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:366) Feb 15 12:05:16 apmgui i-04e9bc6a: ... 17 more {code} Either: 1. This is a bug in spring, in which case fix it 2. This is expected behavior, in which case provide a workaround/documentation for it so our logs are not littered by it. Either way, this behavior is not documented and presence of this issue makes logs very, very heavy. Not to mention we don't know if this is an actual error in our app or one we can ignore. Either fix this issue or provide an explanation/documentation for it.
    via by Prashant Deva,
  • How to handle and catch SocketException?
    via Stack Overflow by membersound
    ,
    • java.net.SocketException: Broken pipe at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:371) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:333) at org.apache.catalina.connector.Response.flushBuffer(Response.java:570) at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:307) at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:81) at org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.writeFrameInternal(StreamingSockJsSession.java:99) at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:273) at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:294) at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession$1.run(AbstractSockJsSession.java:309) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(Unknown Source) at java.net.SocketOutputStream.write(Unknown Source) at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480) at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119) at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:805) at org.apache.coyote.Response.action(Response.java:174) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:366) ... 17 more

    Users with the same issue

    linxiaolong
    linxiaolong3 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    224 more bugmates