2

I run Jmeter concurrency(concurrency=5) test on springboot(version is 2.6.6) application and the springcloud gateway version is 3.1.2. I often got this error in gateway:

2022-11-21 15:39:01.541  WARN 218 --- [ctor-http-nio-2] r.n.h.c.HttpClientConnect                : [86ec2bb9-8] The connection observed an error, the request cannot be retried as the headers/body were sent
java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:1.8.0_322]
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:1.8.0_322]
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[?:1.8.0_322]
    at sun.nio.ch.IOUtil.read(IOUtil.java:192) ~[?:1.8.0_322]
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379) ~[?:1.8.0_322]
    at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:258) ~[netty-buffer-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) ~[netty-buffer-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357) ~[netty-transport-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) ~[netty-transport-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) ~[netty-transport-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) ~[netty-transport-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) ~[netty-transport-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) ~[netty-transport-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995) ~[netty-common-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.77.Final.jar!/:4.1.77.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.77.Final.jar!/:4.1.77.Final]
    at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_322]
2022-11-21 15:39:01.542  WARN 218 --- [ctor-http-nio-2] c.h.h.f.g.c.AbstractJalorDiscoveryClient : put unhealthy instance to cache, instanceId: xxx:ccc33637fb9d406ab9ba4c92401c04a1-848d7c89b6-vthhr:52766
2022-11-21 15:39:01.542 ERROR 218 --- [ctor-http-nio-2] c.h.h.f.g.f.ServerFilter                 : [ServerResponse]{requestId=0462eed0-383780, traceId=a054ca3222698b572bf64c1f857df8cf, ServerInfo[instanceId=*.*.7.199:52766, startTime=1669016341539, endTime=1669016341542, duration=3, statusCode=500, exception=Connection reset by peer]}
2022-11-21 15:39:01.542 ERROR 218 --- [ctor-http-nio-2] c.h.h.f.g.f.ServerExceptionFilter        : [ServerResponse]{requestId=0462eed0-383780, traceId=a054ca3222698b572bf64c1f857df8cf, error=Connection reset by peer}
2022-11-21 15:39:01.542 ERROR 218 --- [ctor-http-nio-2] .h.f.g.e.GatewayErrorWebExceptionHandler : requestId=0462eed0-383780, traceId=a054ca3222698b572bf64c1f857df8cf, error={timestamp=2022-11-21T15:39:01.542+0800, path=xxx, status=500, error=Internal Server Error, requestId=0462eed0-383780}
2022-11-21 15:39:01.542 ERROR 218 --- [ctor-http-nio-2] a.w.r.e.AbstractErrorWebExceptionHandler : [0462eed0-383780]  500 Server Error for HTTP POST "xxx"

Then I config some params, but not work: the gateway param is spring.cloud.gateway.httpclient.pool.max-idle-time=10000. The springboot system param is server.tomcat.connection-timeout=20000. And I also found if run serially(concurrency=1), it almost won't happen "Connection reset by peer".

How can I solve this problem ?

zhu mo
  • 33
  • 3
  • Check this thread: https://stackoverflow.com/questions/24563156/jmeter-connection-reset-by-peer-socket-write-error-socket-exception-connectio – Alex Karamfilov Nov 21 '22 at 15:54

0 Answers0