question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception occours if client sends reset frame while the server is sending headers

See original GitHub issue

when 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:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
twjitmcommented, Jun 27, 2017

so do I, How are you to solve it?

0reactions
qwangseucommented, Jun 28, 2017

It seems like that the modification can resolve this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Netty occasionally generates "Connection reset by peer ...
I have overridden channelInactive & exceptionCaught . The problem is when the clients close the connection, the server occasionally gets java.io ...
Read more >
HTTP response status codes - MDN Web Docs - Mozilla
HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:
Read more >
gRPC over HTTP2
Requests ; FRAME_SIZE_ERROR, INTERNAL ; REFUSED_STREAM, UNAVAILABLE - Indicates that no processing occurred and the request can be retried, possibly elsewhere.
Read more >
RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)
A server MUST NOT send this header field. The content of the HTTP2-Settings header field is the payload of a SETTINGS frame (Section...
Read more >
TCP receive window and everything you need to know about it
This field tells the link partner how much data can be sent on the wire before ... When advertising its window, a client...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found