ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。

被调用方服务

20:52:57.530 [http-nio-50009-exec-7] ERROR c.r.c.s.h.GlobalExceptionHandler - [handleException,93] - 请求地址’/findInner’,发生系统异常.
org.apache.catalina.connector.ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:784)
at org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:689)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:388)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:366)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:96)
at org.springframework.util.StreamUtils$NonClosingOutputStream.write(StreamUtils.java:287)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2171)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeString(UTF8JsonGenerator.java:515)
at com.fasterxml.jackson.databind.SerializerProvider.defaultSerializeDateValue(SerializerProvider.java:1199)
at com.fasterxml.jackson.databind.ser.std.DateTimeSerializerBase._serializeAsString(DateTimeSerializerBase.java:211)
at com.fasterxml.jackson.databind.ser.std.DateSerializer.serialize(DateSerializer.java:51)
at com.fasterxml.jackson.databind.ser.std.DateSerializer.serialize(DateSerializer.java:15)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:728)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:774)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:808)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeWithoutTypeInfo(MapSerializer.java:764)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:720)
at com.fasterxml.

调用方服务

20:52:44.484 [http-nio-50010-exec-4] DEBUG o.s.c.s.i.w.c.f.TraceFeignBlockingLoadBalancerClient - [execute,86] - Exception thrown
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:779)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:714)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1607)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1512)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at feign.Client D e f a u l t . c o n v e r t R e s p o n s e ( C l i e n t . j a v a : 109 ) a t f e i g n . C l i e n t Default.convertResponse(Client.java:109) at feign.Client Default.convertResponse(Client.java:109)atfeign.ClientDefault.execute(Client.java:105)
at org.springframework.cloud.sleuth.instrument.web.client.feign.TracingFeignClient.execute(TracingFeignClient.java:79)
at org.springframework.cloud.sleuth.instrument.web.client.feign.LazyTracingFeignClient.execute(LazyTracingFeignClient.java:62)
at org.springframework.cloud.openfeign.loadbalancer.LoadBalancerUtils.executeWithLoadBalancerLifecycleProcessing(LoadBalancerUtils.java:57)
at org.springframework.cloud.openfeign.loadbalancer.LoadBalancerUtils.executeWithLoadBalancerLifecycleProcessing(LoadBalancerUtils.java:95)
at org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient.execute(FeignBlockingLoadBalancerClient.java:114)
at org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignBlockingLoadBalancerClient.execute(TraceFeignBlockingLoadBalancerClient.java:77)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethod

解决方法

本人猜测是 调用方等不及被调用方响应,超时主动取消了请求,所以被调用方报错 “你的主机中的软件中止了一个已建立的连接。”

配置超时时间就可以了

feign:
	client:
		config:
			default:
				connect-timeout: 3000		# 默认两秒,单位为毫秒
				read-timeout: 30000			# 默认五秒,单位为毫秒

你可能感兴趣的:(bug解决,java,开发语言,spring,cloud,feign)