spring – ClientAbortException来自哪里?

前端之家收集整理的这篇文章主要介绍了spring – ClientAbortException来自哪里?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我有一个Spring-Boot应用程序,它在日志中不断显示错误

[xec-104] ERROR Exception Processing ErrorPage[errorCode=0,location=/error]
org.apache.catalina.connector.ClientAbortException: java.io.IOException:
Connection reset by peer at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:340)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:303)
at
org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.j
ava:109) at
com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.j
ava:1048) at
com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:95
3) at
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverte
r.writeInternal(AbstractJackson2HttpMessageConverter.java:285) at
org.springframework.http.converter.AbstractGenericHttpMessageConverter.writ
e(AbstractGenericHttpMessageConverter.java:100) at
org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConver
terMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethod
Processor.java:231) at
org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProce
ssor.handleReturnValue(HttpEntityMethodProcessor.java:203) at
org.springframework.web.method.support.HandlerMethodReturnValueHandlerCompo
site.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:81) at
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandl
erMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:132) at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandler
Adapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandler
Adapter.handleInternal(RequestMappingHandlerAdapter.java:738) at
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.han
dle(AbstractHandlerMethodAdapter.java:85) at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServ
let.java:963) at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServl
et.java:897) at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkSe
rvlet.java:970) at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.jav
a:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.j
ava:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio
nFilterChain.java:230) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC
hain.java:165) at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher
.java:726) at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDi
spatcher.java:471) at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatc
her.java:394) at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatche
r.java:311) at
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:39
5) at
org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:25
4) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:17
7) at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79
) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav
a:87) at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.jav
a:66) at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtoc
ol.java:802) at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.ja
va:1410) at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java
:49) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1
142) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
617) at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.j
ava:61) at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Connection reset by peer
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:134)
at
org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.ja
va:101) at
org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
at
org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint
.java:1221) at
org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBas
e.java:451) at
org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:4
41) at
org.apache.coyote.http11.Http11OutputBuffer.flushBuffer(Http11OutputBuffer.
java:514) at
org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:2
43) at
org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1495)
at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:284)
at org.apache.coyote.Response.action(Response.java:167)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:336)
… 41 common frames omitted

如您所见,堆栈跟踪不会从我的应用程序中显示任何内容.此异常仅发生在基础结构中.它是什么意思,我该如何重现?另外,我不明白为什么杰克逊在筹码追踪中.我的应用程序中没有任何JSON输出.

最后,我想了解我的应用程序是否存在问题.如果是这样,请修复它.如果没有,我不希望在我的日志中将其作为错误.

编辑:根据要求,这是pom.xml:

最佳答案
这是因为客户端在Tomcat有机会写出响应之前关闭了连接.

此异常的主要实施者往往是“Internet Explorer”,因为它处理资源连接(如下载JavaScript,CSS,图标等);如果它决定它不再需要资源,它会在服务器有机会写出来之前关闭连接.当你在IE中使用Angularjs或其他SPA框架时,我也会看到更多.您将知道它是由IE引起的,因为请求资源路径是资源文件(如前所述).

第二个(或同样?)最常见的罪魁祸首可能是用户在有机会完成加载之前多次刷新页面,或者用户页面加载完成之前导航.

第三个罪魁祸首,不太常见,但更令人愤怒的是,当你在自己的网络上呼叫服务时.您将在被调用的服务上看到“ClientAbortException”,并在客户端服务上看到“SocketException:connection reset”.原因通常是因为防火墙配置不当.我和我的系统管理员聊过,她说上次发生在我身上的原因是因为在高峰使用期间复制流量太高,所以防火墙无法及时返回数据包.解决方案是在其他重要应用程序的高峰使用期间限制来自特定来源(例如复制)的流量.我想你可以通过模拟大量使用和通过防火墙的流量来复制此错误.

猜你在找的Spring相关文章