java - Handling broken pipe exception in @ControllerAdvice does not work as well -
good day. know "broken pipe" not critical exception , mean client did not wait response server. , know there many similar question can not find answer on s.o.
i want keep logs clear found solution.
and tried write like:
@controlleradvice public class controlleradvisor { private static final logger logger = logmanager.getlogger(); @responsebody @exceptionhandler(ioexception.class) @responsestatus(httpstatus.service_unavailable) public object brokenpipehandle(ioexception e, httpservletrequest req) { if (stringutils.containsignorecase(exceptionutils.getrootcausemessage(e), "broken pipe")) return null; return new errordto(e.getmessage()); } }
but broken pipe exception still happened , have in logs:
java.io.ioexception: broken pipe @ sun.nio.ch.filedispatcherimpl.write0(native method) ~[na:1.8.0_91] @ sun.nio.ch.socketdispatcher.write(socketdispatcher.java:47) ~[na:1.8.0_91] @ sun.nio.ch.ioutil.writefromnativebuffer(ioutil.java:93) ~[na:1.8.0_91] @ sun.nio.ch.ioutil.write(ioutil.java:65) ~[na:1.8.0_91] @ sun.nio.ch.socketchannelimpl.write(socketchannelimpl.java:471) ~[na:1.8.0_91] @ org.apache.tomcat.util.net.niochannel.write(niochannel.java:134) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.tomcat.util.net.nioblockingselector.write(nioblockingselector.java:101) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.tomcat.util.net.nioselectorpool.write(nioselectorpool.java:157) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.tomcat.util.net.nioendpoint$niosocketwrapper.dowrite(nioendpoint.java:1241) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.tomcat.util.net.socketwrapperbase.flushblocking(socketwrapperbase.java:428) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.tomcat.util.net.socketwrapperbase.flush(socketwrapperbase.java:418) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.coyote.http11.http11outputbuffer.flushbuffer(http11outputbuffer.java:533) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.coyote.http11.http11outputbuffer.flush(http11outputbuffer.java:250) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.coyote.http11.http11processor.action(http11processor.java:691) ~[tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.coyote.response.action(response.java:167) [tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.catalina.connector.outputbuffer.doflush(outputbuffer.java:336) [tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.catalina.connector.outputbuffer.flush(outputbuffer.java:303) [tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.catalina.connector.response.flushbuffer(response.java:541) [tomcat-embed-core-8.5.4.jar:8.5.4] @ org.apache.catalina.connector.responsefacade.flushbuffer(responsefacade.java:312) [tomcat-embed-core-8.5.4.jar:8.5.4] @ javax.servlet.servletresponsewrapper.flushbuffer(servletresponsewrapper.java:176) [tomcat-embed-core-8.5.4.jar:8.5.4] @ javax.servlet.servletresponsewrapper.flushbuffer(servletresponsewrapper.java:176) [tomcat-embed-core-8.5.4.jar:8.5.4] @ org.springframework.security.web.util.oncommittedresponsewrapper.flushbuffer(oncommittedresponsewrapper.java:158) [spring-security-web-4.1.1.release.jar:4.1.1.release] @ javax.servlet.servletresponsewrapper.flushbuffer(servletresponsewrapper.java:176) [tomcat-embed-core-8.5.4.jar:8.5.4] @ org.springframework.security.web.util.oncommittedresponsewrapper.flushbuffer(oncommittedresponsewrapper.java:158) [spring-security-web-4.1.1.release.jar:4.1.1.release] @ org.springframework.http.server.servletserverhttpresponse.flush(servletserverhttpresponse.java:96) [spring-web-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.sockjs.transport.session.abstracthttpsockjssession.writeframeinternal(abstracthttpsockjssession.java:365) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.sockjs.transport.session.abstractsockjssession.writeframe(abstractsockjssession.java:349) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.sockjs.transport.session.streamingsockjssession.flushcache(streamingsockjssession.java:86) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.sockjs.transport.session.abstracthttpsockjssession.sendmessageinternal(abstracthttpsockjssession.java:302) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.sockjs.transport.session.abstractsockjssession.sendmessage(abstractsockjssession.java:165) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.handler.concurrentwebsocketsessiondecorator.tryflushmessagebuffer(concurrentwebsocketsessiondecorator.java:132) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.handler.concurrentwebsocketsessiondecorator.sendmessage(concurrentwebsocketsessiondecorator.java:104) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.messaging.stompsubprotocolhandler.sendtoclient(stompsubprotocolhandler.java:437) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.messaging.stompsubprotocolhandler.handlemessagetoclient(stompsubprotocolhandler.java:422) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.web.socket.messaging.subprotocolwebsockethandler.handlemessage(subprotocolwebsockethandler.java:338) [spring-websocket-4.3.2.release.jar:4.3.2.release] @ org.springframework.messaging.support.executorsubscribablechannel$sendtask.run(executorsubscribablechannel.java:135) [spring-messaging-4.3.2.release.jar:4.3.2.release] @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) [na:1.8.0_91] @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) [na:1.8.0_91] @ java.lang.thread.run(thread.java:745) [na:1.8.0_91]
Comments
Post a Comment