vert-x3 / vertx-examples

Vert.x examples
Apache License 2.0
3.55k stars 2.09k forks source link

While doing load test by sending 1000request per second from client to server ,the following error has been occured. #338

Closed SwaroopBandari closed 5 years ago

SwaroopBandari commented 5 years ago

java.lang.IllegalStateException: Response has already been written at io.vertx.core.http.impl.Http2ServerResponseImpl.checkEnded(Http2ServerResponseImpl.java:477) at io.vertx.core.http.impl.Http2ServerResponseImpl.write(Http2ServerResponseImpl.java:434) at io.vertx.core.http.impl.Http2ServerResponseImpl.end(Http2ServerResponseImpl.java:394) at io.vertx.core.http.impl.Http2ServerResponseImpl.end(Http2ServerResponseImpl.java:367) at com.rjil.http2.message.Http2Request.sendResponse(Http2Request.java:44) at com.example.http2.test.Http2ServerCallbacksExample.onRequestReceived(Http2ServerCallbacksExample.java:37) at com.rjil.http2.connection.Http2ServerRequestHandler$1.handle(Http2ServerRequestHandler.java:53) at com.rjil.http2.connection.Http2ServerRequestHandler$1.handle(Http2ServerRequestHandler.java:1) at io.vertx.core.http.HttpServerRequest.lambda$1(HttpServerRequest.java:214) at io.vertx.core.http.impl.Http2ServerRequestImpl.handleReset(Http2ServerRequestImpl.java:201) at io.vertx.core.http.impl.VertxHttp2Stream.onResetRead(VertxHttp2Stream.java:73) at io.vertx.core.http.impl.Http2ConnectionBase.lambda$8(Http2ConnectionBase.java:312) at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:320) at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43) at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:188) at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:180) at io.vertx.core.http.impl.Http2ConnectionBase.onRstStreamRead(Http2ConnectionBase.java:312) at io.vertx.core.http.impl.Http2ServerConnection.onRstStreamRead(Http2ServerConnection.java:1) at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onRstStreamRead(DefaultHttp2ConnectionDecoder.java:350) at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readRstStreamFrame(DefaultHttp2FrameReader.java:516) at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:260) at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160) at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:118) at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:390) at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:450) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) at io.vertx.core.http.impl.VertxHttp2ConnectionHandler.channelRead(VertxHttp2ConnectionHandler.java:425) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:628) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:563) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:480) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)

pmlopes commented 5 years ago

That can happen when your load test client closes the connection abruptly and your application is still pushing data to the socket. It's a non recoverable error that you can try to mitigate by checking if the socket is still open before writing.