Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.io.IOException: Broken pipe

We are currently migrating a legacy application to Jetty. And I have somehow an exception regarding a broken pipe.

  • Java 6
  • Jetty 8.1.8
  • Spring 3.2.0

I am trying to migrate a Glassfish web application to Jetty. In our testing environment we are using a load balancer and everything is working fine. Our clients are working without any problem.

WARN  [2013-04-03 13:34:28,963] com.myapp.bbb.config.MvcDefaultConfig$1: Handler execution resulted in exception ! org.eclipse.jetty.io.EofException: null ! at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:914) ! at org.eclipse.jetty.http.HttpGenerator.complete(HttpGenerator.java:798) ! at org.eclipse.jetty.server.AbstractHttpConnection.completeResponse(AbstractHttpConnection.java:642) ! at org.eclipse.jetty.server.Response.complete(Response.java:1234) ! at org.eclipse.jetty.server.Response.sendError(Response.java:404) ! at org.eclipse.jetty.server.Response.sendError(Response.java:416) ! at org.springframework.web.servlet.DispatcherServlet.noHandlerFound(DispatcherServlet.java:1111) ! at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:898) ! at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) ! at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915) ! at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811) ! at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) ! at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796) ! at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) ! at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669) ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336) ! at com.magnetdigital.maggy.dropwizard.head2get.Head2GetFilter.doFilter(Head2GetFilter.java:22) ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) ! at com.yammer.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:29) ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) ! at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453) ! at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229) ! at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) ! at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) ! at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) ! at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) ! at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) ! at com.yammer.metrics.jetty.InstrumentedHandler.handle(InstrumentedHandler.java:200) ! at org.eclipse.jetty.server.handler.GzipHandler.handle(GzipHandler.java:275) ! at com.yammer.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:123) ! at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) ! at org.eclipse.jetty.server.Server.handle(Server.java:365) ! at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) ! at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53) ! at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926) ! at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988) ! at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635) ! at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) ! at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72) ! at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.run(BlockingChannelConnector.java:298) ! at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) ! at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) ! at java.lang.Thread.run(Thread.java:662) Caused by: ! java.io.IOException: Broken pipe ! at sun.nio.ch.FileDispatcher.write0(Native Method) ! at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29) ! at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69) ! at sun.nio.ch.IOUtil.write(IOUtil.java:26) ! at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334) ! at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:293) ! at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.flush(BlockingChannelConnector.java:253) ! at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:850) !... 44 common frames omitted 

When I check the stacktrace I have seen this exceptions are triggered by always a 404 request.

org.springframework.web.servlet.DispatcherServlet.noHandlerFound(DispatcherServlet.java:1111)

  • Why am I having this exception?
  • How can I reproduce this exception at my machine locally?
like image 565
Cemo Avatar asked Apr 03 '13 10:04

Cemo


People also ask

How do I fix Java IO IOException broken pipe?

io. IOException: Broken pipe changing the value will help until the root cause (60s should be enough) can be fixed. Show activity on this post. Basically, what is happening is that your user is either closing the browser tab, or is navigating away to a different page, before communication was complete.

What is broken pipe error in Java?

'Broken pipe' errors usually occur when the browser is closed before the request can be completed. They are harmless. There are various reasons, but the most common being a browser session being closed while the request is still processing.

What causes Java IO IOException?

IOException is thrown when an error occurred during an input-output operation. That can be reading/writing to a file, a stream (of any type), a network connection, connection with a queue, a database etc, pretty much anything that has to do with data transfer from your software to an external medium.


1 Answers

The most common reason I've had for a "broken pipe" is that one machine (of a pair communicating via socket) has shut down its end of the socket before communication was complete. About half of those were because the program communicating on that socket had terminated.

If the program sending bytes sends them out and immediately shuts down the socket or terminates itself, it is possible for the socket to cease functioning before the bytes have been transmitted and read.

Try putting pauses anywhere you are shutting down the socket and before you allow the program to terminate to see if that helps.

FYI: "pipe" and "socket" are terms that get used interchangeably sometimes.

like image 161
arcy Avatar answered Sep 21 '22 07:09

arcy