Skip to content

Commit 97c3db9

Browse files
Fix flaky Http2 test by using consistent ConnectionEndReason for closed streams (#65456)
1 parent 6e3747e commit 97c3db9

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ private Task ProcessDataFrameAsync(in ReadOnlySequence<byte> payload)
754754
//
755755
// We choose to do that here so we don't have to keep state to track implicitly closed
756756
// streams vs. streams closed with END_STREAM or RST_STREAM.
757-
throw new Http2ConnectionErrorException(CoreStrings.FormatHttp2ErrorStreamClosed(_incomingFrame.Type, _incomingFrame.StreamId), Http2ErrorCode.STREAM_CLOSED, ConnectionEndReason.UnknownStream);
757+
throw new Http2ConnectionErrorException(CoreStrings.FormatHttp2ErrorStreamClosed(_incomingFrame.Type, _incomingFrame.StreamId), Http2ErrorCode.STREAM_CLOSED, ConnectionEndReason.FrameAfterStreamClose);
758758
}
759759

760760
private Http2ConnectionErrorException CreateReceivedFrameStreamAbortedException(Http2Stream stream)

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,7 @@ await WaitForConnectionErrorAsync<Http2ConnectionErrorException>(
16391639
CoreStrings.FormatHttp2ErrorStreamClosed(Http2FrameType.DATA, streamId: 1),
16401640
CoreStrings.FormatHttp2ErrorStreamHalfClosedRemote(Http2FrameType.DATA, streamId: 1)
16411641
});
1642-
AssertConnectionEndReason(ConnectionEndReason.UnknownStream);
1642+
AssertConnectionEndReason(ConnectionEndReason.FrameAfterStreamClose);
16431643
}
16441644

16451645
[Fact]
@@ -1853,7 +1853,7 @@ await WaitForConnectionErrorAsync<Http2ConnectionErrorException>(
18531853
expectedErrorCode: Http2ErrorCode.STREAM_CLOSED,
18541854
expectedErrorMessage: CoreStrings.FormatHttp2ErrorStreamClosed(Http2FrameType.DATA, streamId: 1));
18551855

1856-
AssertConnectionEndReason(ConnectionEndReason.UnknownStream);
1856+
AssertConnectionEndReason(ConnectionEndReason.FrameAfterStreamClose);
18571857
}
18581858

18591859
[Fact]
@@ -5744,7 +5744,7 @@ await WaitForConnectionErrorAsync<Http2ConnectionErrorException>(
57445744
CoreStrings.FormatHttp2ErrorStreamClosed(Http2FrameType.DATA, streamId: 1),
57455745
CoreStrings.FormatHttp2ErrorStreamHalfClosedRemote(Http2FrameType.DATA, streamId: 1)
57465746
});
5747-
AssertConnectionEndReason(ConnectionEndReason.UnknownStream);
5747+
AssertConnectionEndReason(ConnectionEndReason.FrameAfterStreamClose);
57485748
break;
57495749

57505750
case Http2FrameType.HEADERS:
@@ -5835,7 +5835,7 @@ await WaitForConnectionErrorAsync<Http2ConnectionErrorException>(
58355835
switch (finalFrameType)
58365836
{
58375837
case Http2FrameType.DATA:
5838-
AssertConnectionEndReason(ConnectionEndReason.UnknownStream);
5838+
AssertConnectionEndReason(ConnectionEndReason.FrameAfterStreamClose);
58395839
break;
58405840

58415841
case Http2FrameType.HEADERS:

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ await WaitForConnectionErrorAsyncDoNotCloseTransport<Http2ConnectionErrorExcepti
304304
switch (finalFrameType)
305305
{
306306
case Http2FrameType.DATA:
307-
AssertConnectionEndReason(ConnectionEndReason.UnknownStream);
307+
AssertConnectionEndReason(ConnectionEndReason.FrameAfterStreamClose);
308308
break;
309309

310310
case Http2FrameType.CONTINUATION:

0 commit comments

Comments
 (0)