org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe

Java.net JIRA | gkresic2 | 9 months ago
  1. 0

    There are quite a few bugs here about {{Factory.dispose}} not being called ([2299|https://java.net/jira/browse/JERSEY-2299], [2549|https://java.net/jira/browse/JERSEY-2549], [2677|https://java.net/jira/browse/JERSEY-2677], [2678|https://java.net/jira/browse/JERSEY-2678]) but I think I've pinpointed yet another one. It's quite specific, but always reproducible: * client initiates HTTP GET request that +slowly+ generates +large+ content * client aborts connection +before+ Jersey starts sending content In this scenario, exception is thrown: {noformat} SEVERE org.glassfish.jersey.server.ServerRuntime$Responder: An I/O error has occurred while writing a response message entity to the container output stream. org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe {noformat} ??(full stack trace posted below)?? and {{Factory.dispose}} of {{@Inject}}-ed resources is not called. Note that this occurs only in content size is above certain threshold, and works perfectly normal for small contents. Did not investigate any further, but threshold is somewhere around socketBuffer property of Tomcat Connector. Repro case: {code:title=RestApi.java|borderStyle=solid} package com.steatoda.rest; import javax.ws.rs.ApplicationPath; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.process.internal.RequestScoped; import org.glassfish.jersey.server.ResourceConfig; @ApplicationPath("/rest/") public class RestApi extends ResourceConfig { public RestApi() { super(); packages(true, "com.steatoda.rest"); register(new AbstractBinder() { @Override protected void configure() { bindFactory(BeanFactory.class, RequestScoped.class).to(Bean.class).in(RequestScoped.class); } }); } } {code} {code:title=Bean.java|borderStyle=solid} package com.steatoda.rest; import java.text.SimpleDateFormat; import java.util.Date; public class Bean { public Bean() { this.date = new Date(); } @Override public String toString() { return "Bean " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(date); } private final Date date; } {code} {code:title=BeanFactory.java|borderStyle=solid} package com.steatoda.rest; import org.glassfish.hk2.api.Factory; public class BeanFactory implements Factory<Bean> { @Override public Bean provide() { Bean bean = new Bean(); System.out.println("BEAN PROVIDE " + bean); return bean; } @Override public void dispose(Bean bean) { System.out.println("BEAN DISPOSE " + bean); } } {code} {code:title=DemoService.java|borderStyle=solid} package com.steatoda.rest; import javax.inject.Inject; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; @Path("/demo") public class DemoService { @GET @Path("text") public Response text(@QueryParam("size") @DefaultValue("64535") int size) throws InterruptedException { // simulate slow content generation (and give us time to cancel request before it finishes) Thread.sleep(10000); StringBuffer content = new StringBuffer(size); // generate content for (int i = 0; i < size; ++i) content.append(i % 10); return Response.ok(content.toString()) .header("Content-Disposition", "attachment; filename=\"" + bean.toString() + ".txt\"") .build(); } @Inject private Bean bean; } {code} Now, if I initiate big request and let it finish: {noformat} gkresic@mata:~/Sources/asphalt (jersey-test)$ curl -v --output text http://127.0.0.1:8080/asphalt/rest/demo/text?size=50000 * Trying 127.0.0.1... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > GET /asphalt/rest/demo/text?size=50000 HTTP/1.1 > Host: 127.0.0.1:8080 > User-Agent: curl/7.43.0 > Accept: */* > 0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0< HTTP/1.1 200 OK < Server: Apache-Coyote/1.1 < Content-Disposition: attachment; filename="Bean 2016-03-21 14:09:52.860.txt" < Content-Type: text/plain < Transfer-Encoding: chunked < Vary: Accept-Encoding < Date: Mon, 21 Mar 2016 13:10:02 GMT < { [16146 bytes data] 100 50000 0 50000 0 0 4995 0 --:--:-- 0:00:10 --:--:-- 13147 * Connection #0 to host 127.0.0.1 left intact gkresic@mata:~/Sources/asphalt (jersey-test)$ {noformat} log shows that everything is ok: {noformat} BEAN PROVIDE Bean 2016-03-21 14:09:52.860 BEAN DISPOSE Bean 2016-03-21 14:09:52.860 {noformat} However, if I cancel ({{Ctrl+C}}) request after 3-4 seconds after initiating it: {noformat} gkresic@mata:~/Sources/asphalt (jersey-test)$ curl -v --output text http://127.0.0.1:8080/asphalt/rest/demo/text?size=50000 * Trying 127.0.0.1... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > GET /asphalt/rest/demo/text?size=50000 HTTP/1.1 > Host: 127.0.0.1:8080 > User-Agent: curl/7.43.0 > Accept: */* > 0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0^C gkresic@mata:~/Sources/asphalt (jersey-test)$ {noformat} log shows only bean creation this exception: {noformat} BEAN PROVIDE Bean 2016-03-21 14:12:00.044 [2016-03-21 14:12:10.047] SEVERE org.glassfish.jersey.server.ServerRuntime$Responder: An I/O error has occurred while writing a response message entity to the container output stream. org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:92) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130) at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711) at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444) at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434) at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:267) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471) at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1757) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1716) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:407) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:342) at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:432) at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:420) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91) at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.write(ResponseWriter.java:325) at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:233) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:135) at java.io.OutputStreamWriter.write(OutputStreamWriter.java:220) at org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:192) at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:130) at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:99) at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:59) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86) ... 57 more Caused by: java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcherImpl.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:125) at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101) at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:174) at org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:163) at org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:242) at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:213) at org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer.java:41) at org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer.java:268) at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:119) at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:192) at org.apache.coyote.Response.doWrite(Response.java:499) at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:402) ... 79 more {noformat} As seen above, this time {{BeanFactory.dispose}} is not called. Since I'm suspecting that it has something to do with Tomcat Connectors, I'm sending my Connector configuration too: {noformat} <Connector port="8080" redirectPort="443" enableLookups="false" protocol="org.apache.coyote.http11.Http11NioProtocol" acceptCount="10" maxThreads="4" minSpareThreads="1" connectionTimeout="10000" disableUploadTimeout="true" URIEncoding="UTF-8" maxHttpHeaderSize="8192" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/json" /> {noformat}

    Java.net JIRA | 9 months ago | gkresic2
    org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
  2. 0

    There are quite a few bugs here about {{Factory.dispose}} not being called ([2299|https://java.net/jira/browse/JERSEY-2299], [2549|https://java.net/jira/browse/JERSEY-2549], [2677|https://java.net/jira/browse/JERSEY-2677], [2678|https://java.net/jira/browse/JERSEY-2678]) but I think I've pinpointed yet another one. It's quite specific, but always reproducible: * client initiates HTTP GET request that +slowly+ generates +large+ content * client aborts connection +before+ Jersey starts sending content In this scenario, exception is thrown: {noformat} SEVERE org.glassfish.jersey.server.ServerRuntime$Responder: An I/O error has occurred while writing a response message entity to the container output stream. org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe {noformat} ??(full stack trace posted below)?? and {{Factory.dispose}} of {{@Inject}}-ed resources is not called. Note that this occurs only in content size is above certain threshold, and works perfectly normal for small contents. Did not investigate any further, but threshold is somewhere around socketBuffer property of Tomcat Connector. Repro case: {code:title=RestApi.java|borderStyle=solid} package com.steatoda.rest; import javax.ws.rs.ApplicationPath; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.process.internal.RequestScoped; import org.glassfish.jersey.server.ResourceConfig; @ApplicationPath("/rest/") public class RestApi extends ResourceConfig { public RestApi() { super(); packages(true, "com.steatoda.rest"); register(new AbstractBinder() { @Override protected void configure() { bindFactory(BeanFactory.class, RequestScoped.class).to(Bean.class).in(RequestScoped.class); } }); } } {code} {code:title=Bean.java|borderStyle=solid} package com.steatoda.rest; import java.text.SimpleDateFormat; import java.util.Date; public class Bean { public Bean() { this.date = new Date(); } @Override public String toString() { return "Bean " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(date); } private final Date date; } {code} {code:title=BeanFactory.java|borderStyle=solid} package com.steatoda.rest; import org.glassfish.hk2.api.Factory; public class BeanFactory implements Factory<Bean> { @Override public Bean provide() { Bean bean = new Bean(); System.out.println("BEAN PROVIDE " + bean); return bean; } @Override public void dispose(Bean bean) { System.out.println("BEAN DISPOSE " + bean); } } {code} {code:title=DemoService.java|borderStyle=solid} package com.steatoda.rest; import javax.inject.Inject; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; @Path("/demo") public class DemoService { @GET @Path("text") public Response text(@QueryParam("size") @DefaultValue("64535") int size) throws InterruptedException { // simulate slow content generation (and give us time to cancel request before it finishes) Thread.sleep(10000); StringBuffer content = new StringBuffer(size); // generate content for (int i = 0; i < size; ++i) content.append(i % 10); return Response.ok(content.toString()) .header("Content-Disposition", "attachment; filename=\"" + bean.toString() + ".txt\"") .build(); } @Inject private Bean bean; } {code} Now, if I initiate big request and let it finish: {noformat} gkresic@mata:~/Sources/asphalt (jersey-test)$ curl -v --output text http://127.0.0.1:8080/asphalt/rest/demo/text?size=50000 * Trying 127.0.0.1... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > GET /asphalt/rest/demo/text?size=50000 HTTP/1.1 > Host: 127.0.0.1:8080 > User-Agent: curl/7.43.0 > Accept: */* > 0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0< HTTP/1.1 200 OK < Server: Apache-Coyote/1.1 < Content-Disposition: attachment; filename="Bean 2016-03-21 14:09:52.860.txt" < Content-Type: text/plain < Transfer-Encoding: chunked < Vary: Accept-Encoding < Date: Mon, 21 Mar 2016 13:10:02 GMT < { [16146 bytes data] 100 50000 0 50000 0 0 4995 0 --:--:-- 0:00:10 --:--:-- 13147 * Connection #0 to host 127.0.0.1 left intact gkresic@mata:~/Sources/asphalt (jersey-test)$ {noformat} log shows that everything is ok: {noformat} BEAN PROVIDE Bean 2016-03-21 14:09:52.860 BEAN DISPOSE Bean 2016-03-21 14:09:52.860 {noformat} However, if I cancel ({{Ctrl+C}}) request after 3-4 seconds after initiating it: {noformat} gkresic@mata:~/Sources/asphalt (jersey-test)$ curl -v --output text http://127.0.0.1:8080/asphalt/rest/demo/text?size=50000 * Trying 127.0.0.1... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > GET /asphalt/rest/demo/text?size=50000 HTTP/1.1 > Host: 127.0.0.1:8080 > User-Agent: curl/7.43.0 > Accept: */* > 0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0^C gkresic@mata:~/Sources/asphalt (jersey-test)$ {noformat} log shows only bean creation this exception: {noformat} BEAN PROVIDE Bean 2016-03-21 14:12:00.044 [2016-03-21 14:12:10.047] SEVERE org.glassfish.jersey.server.ServerRuntime$Responder: An I/O error has occurred while writing a response message entity to the container output stream. org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:92) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130) at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711) at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444) at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434) at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:267) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471) at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1757) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1716) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:407) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:342) at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:432) at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:420) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91) at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.write(ResponseWriter.java:325) at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:233) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:135) at java.io.OutputStreamWriter.write(OutputStreamWriter.java:220) at org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:192) at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:130) at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:99) at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:59) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86) ... 57 more Caused by: java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcherImpl.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:125) at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101) at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:174) at org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:163) at org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:242) at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:213) at org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer.java:41) at org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer.java:268) at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:119) at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:192) at org.apache.coyote.Response.doWrite(Response.java:499) at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:402) ... 79 more {noformat} As seen above, this time {{BeanFactory.dispose}} is not called. Since I'm suspecting that it has something to do with Tomcat Connectors, I'm sending my Connector configuration too: {noformat} <Connector port="8080" redirectPort="443" enableLookups="false" protocol="org.apache.coyote.http11.Http11NioProtocol" acceptCount="10" maxThreads="4" minSpareThreads="1" connectionTimeout="10000" disableUploadTimeout="true" URIEncoding="UTF-8" maxHttpHeaderSize="8192" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/json" /> {noformat}

    Java.net JIRA | 9 months ago | gkresic2
    org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
  3. 0

    Broken Pipe Exception - org.apache.catalina.connector.clientabortexception java.io.ioexception broken pipe

    Stack Overflow | 2 years ago | Rakesh Iyer
    org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    hadoop: Broken Pipe Exception - org.apache.catalina.connector.clientabortexception java.io.ioexception broken pipe

    blogspot.com | 11 months ago
    org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
  6. 0

    org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe

    Stack Overflow | 1 year ago | Peter Penzov
    org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe

  1. fima 26 times, last 2 months ago
  2. aldrinleal 1 times, last 4 months ago
  3. treanz 2 times, last 5 months ago
  4. William Hartzell-Baird 1 times, last 5 months ago
  5. Justin 298 times, last 7 months ago
21 more registered users
73 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.write0()
  2. Java RT
    SocketChannelImpl.write
    1. sun.nio.ch.FileDispatcherImpl.write0(Native Method)
    2. sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
    3. sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    4. sun.nio.ch.IOUtil.write(IOUtil.java:65)
    5. sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
    5 frames
  3. Grizzly HTTP
    Response.doWrite
    1. org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:125)
    2. org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
    3. org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:174)
    4. org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:163)
    5. org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:242)
    6. org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:213)
    7. org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer.java:41)
    8. org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer.java:268)
    9. org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:119)
    10. org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:192)
    11. org.apache.coyote.Response.doWrite(Response.java:499)
    11 frames
  4. Glassfish Core
    OutputBuffer.realWriteBytes
    1. org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:402)
    1 frame
  5. Tomcat Util
    ByteChunk.append
    1. org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:342)
    1 frame
  6. Glassfish Core
    CoyoteOutputStream.write
    1. org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:432)
    2. org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:420)
    3. org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91)
    3 frames
  7. jersey-container-servlet-core
    ResponseWriter$NonCloseableOutputStreamWrapper.write
    1. org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.write(ResponseWriter.java:325)
    1 frame
  8. Jersey Core
    WriterInterceptorExecutor$UnCloseableOutputStream.write
    1. org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:233)
    2. org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299)
    2 frames
  9. Java RT
    OutputStreamWriter.write
    1. sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
    2. sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282)
    3. sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
    4. sun.nio.cs.StreamEncoder.write(StreamEncoder.java:135)
    5. java.io.OutputStreamWriter.write(OutputStreamWriter.java:220)
    5 frames
  10. Jersey Core
    WriterInterceptorExecutor.proceed
    1. org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:192)
    2. org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:130)
    3. org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:99)
    4. org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:59)
    5. org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
    6. org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
    7. org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
    7 frames
  11. jersey-core-server
    JsonWithPaddingInterceptor.aroundWriteTo
    1. org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
    1 frame
  12. Jersey Core
    WriterInterceptorExecutor.proceed
    1. org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
    1 frame
  13. jersey-core-server
    MappableExceptionWrapperInterceptor.aroundWriteTo
    1. org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
    1 frame
  14. Jersey Core
    MessageBodyFactory.writeTo
    1. org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
    2. org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
    2 frames
  15. jersey-core-server
    ServerRuntime$2.run
    1. org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
    2. org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
    3. org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
    4. org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
    4 frames
  16. 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
  17. jersey-core-server
    ApplicationHandler.handle
    1. org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    2. org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    2 frames
  18. jersey-container-servlet-core
    ServletContainer.service
    1. org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
    2. org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
    3. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
    4. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
    5. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
    5 frames
  19. Glassfish Core
    ApplicationFilterChain.doFilter
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    2 frames
  20. Tomcat WS
    WsFilter.doFilter
    1. org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    1 frame
  21. Glassfish Core
    ApplicationFilterChain.doFilter
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    2 frames
  22. Shiro
    OncePerRequestFilter.doFilter
    1. org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    2. org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    3. org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    4. org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    5. org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    6. org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    7. org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    8. org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    9. org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    10. org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    11. org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    12. org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    13. org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    14. org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    15. org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    16. org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    16 frames
  23. Glassfish Core
    CoyoteAdapter.service
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    6. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    7. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    8. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    9. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
    9 frames
  24. Grizzly HTTP
    NioEndpoint$SocketProcessor.run
    1. org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
    2. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    3. org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1757)
    4. org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1716)
    4 frames
  25. Java RT
    ThreadPoolExecutor$Worker.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    2 frames
  26. Tomcat Util
    TaskThread$WrappingRunnable.run
    1. org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    1 frame
  27. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:745)
    1 frame