You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When client-side requests time out, a RST_STREAM is sent and the HTTP/2 stream is closed.
However, server-side may not close the response immediately, which may cause responses to still be written.
This is a violation of the HTTP/2 specification.
The RST_STREAM frame fully terminates the referenced stream and causes it to enter the "closed" state. After receiving a RST_STREAM on a stream, the receiver MUST NOT send additional frames for that stream, with the exception of PRIORITY
As a result the following logs are printed in client-side.
io.netty.handler.codec.http2.Http2Exception$StreamException: Received HEADERS frame for an unknown stream 3
io.netty.handler.codec.http2.Http2Exception$StreamException: Received DATA frame for an unknown stream 3
jrhee17
changed the title
Server writes http/2 after receiving a RST_STREAM frame
Server writes a response with HTTP/2 even after receiving a RST_STREAM frame
Jan 16, 2023
Problem statement
When client-side requests time out, a RST_STREAM is sent and the HTTP/2 stream is closed.
However, server-side may not close the response immediately, which may cause responses to still be written.
This is a violation of the HTTP/2 specification.
https://httpwg.org/specs/rfc7540.html#RST_STREAM
As a result the following logs are printed in client-side.
Analysis
Running the following test reproduces the issue:
armeria/grpc/src/test/java/com/linecorp/armeria/client/grpc/GrpcClientTimeoutTest.java
Line 89 in 76c50fe
responseTimeout
closes the stream and sends aRST_STREAM
armeria/core/src/main/java/com/linecorp/armeria/client/HttpResponseDecoder.java
Line 429 in 76c50fe
Afterwards, the stream is closed and the response is removed
armeria/core/src/main/java/com/linecorp/armeria/client/Http2ResponseDecoder.java
Line 137 in 76c50fe
armeria/core/src/main/java/com/linecorp/armeria/server/Http2RequestDecoder.java
Line 356 in 76c50fe
and calls close on the
ctx
andresponse
sequentially.armeria/core/src/main/java/com/linecorp/armeria/server/AggregatingDecodedHttpRequest.java
Lines 175 to 185 in 76c50fe
However,
FramedGrpcService
registers callbacks onctx.close
armeria/grpc/src/main/java/com/linecorp/armeria/server/grpc/FramedGrpcService.java
Lines 313 to 320 in 76c50fe
and writes a response before
ctx.close
is invokedarmeria/grpc/src/main/java/com/linecorp/armeria/server/grpc/AbstractServerCall.java
Line 297 in 76c50fe
The text was updated successfully, but these errors were encountered: