gpt4 book ai didi

spring - 这个 ClientAbortException 是从哪里来的?

转载 作者:行者123 更新时间:2023-11-28 21:47:03 24 4
gpt4 key购买 nike

我有一个 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

如您所见,堆栈跟踪没有显示我的应用程序的任何内容。此异常纯粹发生在基础设施中。这是什么意思,我该如何重现?另外,我不明白为什么堆栈跟踪中有 Jackson。我的应用程序中没有任何 JSON 输出。

最后我想知道我的申请是否有问题。如果是这样,请修复它。如果不是,我不想在我的日志中将其作为错误。

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

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.mixclouddownload</groupId>
<artifactId>downloader</artifactId>
<version>0.0.1-SNAPSHOT</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
</parent>

<properties>
<java-version>1.8</java-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<dependency>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<version>1.63.0</version>
</dependency>
<dependency>
<groupId>net.sf.jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>r938</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>4.0.0-alpha.6</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>58.2</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>bootstrap-social</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>4.0.6</version>
</dependency>
<dependency>
<groupId>org.facebook4j</groupId>
<artifactId>facebook4j-core</artifactId>
<version>2.4.8</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>ca.pjer</groupId>
<artifactId>logback-awslogs-appender</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

最佳答案

这是因为客户端在 Tomcat 有机会写出响应之前关闭连接。

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

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

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

关于spring - 这个 ClientAbortException 是从哪里来的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41752535/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com