title: java.io.IOException: Broken pipe bringing down the embedded tomcat 8 app
body: <p>I am familiar why the following exception is raised on the server side (client disconnecting from the server without reading the data). However, when this happens, the server becomes extrememly slow and unresponsive. I am looking at potential solutions so that the server is resilient to a bad behaving client.</p>
  
  <pre><code>java.io.IOException: Broken pipe
      at sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[na:1.8.0_45]
      at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) ~[na:1.8.0_45]
      at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) ~[na:1.8.0_45]
      at sun.nio.ch.IOUtil.write(IOUtil.java:65) ~[na:1.8.0_45]
      at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) ~[na:1.8.0_45]
      at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:127) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:173) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:139) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:197) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer.java:41) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer.java:320) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:84) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:256) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.coyote.Response.doWrite(Response.java:503) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:388) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
      ... 103 common frames omitted
  Wrapped by: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
      at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:393) ~[tomcat-embed-core-8.0.20.jar!/:8.0.20]
  </code></pre>