Exception occours if client sends reset frame while the server is sending headers
See original GitHub issuewhen I use netty http2 to build a server, exception will occour if the client sents a reset frame to the server while the server is sending headers (netty version is 4.1.8.final),
io.netty.handler.codec.http2.Http2Exception: Request stream 2414839 is not correct for server connection
at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:85)
at io.netty.handler.codec.http2.DefaultHttp2Connection$DefaultEndpoint.checkNewStreamAllowed(DefaultHttp2Connection.java:1095)
at io.netty.handler.codec.http2.DefaultHttp2Connection$DefaultEndpoint.createStream(DefaultHttp2Connection.java:942)
at io.netty.handler.codec.http2.DefaultHttp2Connection$DefaultEndpoint.createStream(DefaultHttp2Connection.java:960)
at io.netty.handler.codec.http2.DefaultHttp2Connection$DefaultEndpoint.createStream(DefaultHttp2Connection.java:868)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder.writeHeaders(DefaultHttp2ConnectionEncoder.java:158)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder.writeHeaders(DefaultHttp2ConnectionEncoder.java:148)
at com.c.t.h2c.netty.NettyServerHandler.sendResponseHeaders(NettyServerHandler.java:293)
at com.c.t.h2c.netty.NettyServerHandler.write(NettyServerHandler.java:253)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:739)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)
https://github.com/netty/netty/blob/4.1/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java#L156 when the server receives reset frame it will remove the stream from the streamMap, but it will create the stream when it writes headers if it finds the stream is null。
https://github.com/netty/netty/blob/4.1/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java#L687 here the netty will check whether the streamId is even, but the streamId from upstream is always odd.So is there any method to resolve this problem?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
so do I, How are you to solve it?
It seems like that the modification can resolve this problem.