Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SocketsHttpHandlerTest_HttpClientHandlerTest_Http3.ReadAsStreamAsync_Cancellation data race #101428

Merged

Conversation

rzikm
Copy link
Member

@rzikm rzikm commented Apr 23, 2024

Encountered in local runs

    System.Net.Http.Functional.Tests.SocketsHttpHandlerTest_HttpClientHandlerTest_Http3.ReadAsStreamAsync_Cancellation [FAIL]
      System.Net.Quic.QuicException : Stream aborted by peer (268).
      Stack Trace:
        /source/runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/ResettableValueTaskSource.cs(177,0): at System.Net.Quic.ResettableValueTaskSource.TryComplete(Exception exception, Boolean final)
        /source/runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/ResettableValueTaskSource.cs(237,0): at System.Net.Quic.ResettableValueTaskSource.TrySetException(Exception exception, Boolean final)
        /source/runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs(591,0): at System.Net.Quic.QuicStream.HandleEventPeerReceiveAborted(_PEER_RECEIVE_ABORTED_e__Struct& data)
        /source/runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs(642,0): at System.Net.Quic.QuicStream.HandleStreamEvent(QUIC_STREAM_EVENT& streamEvent)
        /source/runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs(673,0): at System.Net.Quic.QuicStream.NativeCallback(QUIC_HANDLE* stream, Void* context, QUIC_STREAM_EVENT* streamEvent)
        --- End of stack trace from previous location ---
        /source/runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/ResettableValueTaskSource.cs(251,0): at System.Net.Quic.ResettableValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
        /source/runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs(376,0): at System.Net.Quic.QuicStream.WriteAsync(ReadOnlyMemory`1 buffer, Boolean completeWrites, CancellationToken cancellationToken)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/Http3LoopbackStream.cs(165,0): at System.Net.Test.Common.Http3LoopbackStream.SendFrameAsync(Int64 frameType, ReadOnlyMemory`1 framePayload)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/Http3LoopbackStream.cs(120,0): at System.Net.Test.Common.Http3LoopbackStream.SendHeadersFrameAsync(Nullable`1 statusCode, IEnumerable`1 headers, Boolean qpackEncodeStatus)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/Http3LoopbackStream.cs(265,0): at System.Net.Test.Common.Http3LoopbackStream.SendResponseHeadersAsync(Nullable`1 statusCode, IEnumerable`1 headers)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/Http3LoopbackStream.cs(248,0): at System.Net.Test.Common.Http3LoopbackStream.SendResponseAsync(HttpStatusCode statusCode, IList`1 headers, String content, Boolean isFinal)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/Http3LoopbackConnection.cs(217,0): at System.Net.Test.Common.Http3LoopbackConnection.SendResponseAsync(HttpStatusCode statusCode, IList`1 headers, String content, Boolean isFinal)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs(1398,0): at System.Net.Http.Functional.Tests.HttpClientHandlerTest.<>c__DisplayClass31_0.<<ReadAsStreamAsync_Cancellation>b__3>d.MoveNext()
        /source/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs(1407,0): at System.Net.Http.Functional.Tests.HttpClientHandlerTest.<>c__DisplayClass31_0.<<ReadAsStreamAsync_Cancellation>b__3>d.MoveNext()
        --- End of stack trace from previous location ---
        /source/runtime/src/libraries/Common/tests/System/Net/Http/Http3LoopbackServer.cs(91,0): at System.Net.Test.Common.Http3LoopbackServer.AcceptConnectionAsync(Func`2 funcAsync)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/Http3LoopbackServer.cs(92,0): at System.Net.Test.Common.Http3LoopbackServer.AcceptConnectionAsync(Func`2 funcAsync)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs(1392,0): at System.Net.Http.Functional.Tests.HttpClientHandlerTest.<>c__DisplayClass31_0.<<ReadAsStreamAsync_Cancellation>b__1>d.MoveNext()
        --- End of stack trace from previous location ---
        /source/runtime/src/libraries/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs(120,0): at System.Threading.Tasks.TaskTimeoutExtensions.GetRealException(Task task)
        --- End of stack trace from previous location ---
        /source/runtime/src/libraries/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs(90,0): at System.Threading.Tasks.TaskTimeoutExtensions.WhenAllOrAnyFailed(Task[] tasks)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/GenericLoopbackServer.cs(44,0): at System.Net.Test.Common.LoopbackServerFactory.<>c__DisplayClass6_0.<<CreateClientAndServerAsync>b__0>d.MoveNext()
        --- End of stack trace from previous location ---
        /source/runtime/src/libraries/Common/tests/System/Net/Http/Http3LoopbackServer.cs(116,0): at System.Net.Test.Common.Http3LoopbackServerFactory.CreateServerAsync(Func`3 funcAsync, Int32 millisecondsTimeout, GenericLoopbackOptions options)
        /source/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs(1378,0): at System.Net.Http.Functional.Tests.HttpClientHandlerTest.ReadAsStreamAsync_Cancellation()
        --- End of stack trace from previous location ---

The connection was closed before the test loopback server managed to write response body. We can ignore the exception.

@rzikm rzikm force-pushed the h3-cancellation-tests-handle-cancellation-exception branch from ac1f96f to 0ade6f8 Compare April 23, 2024 13:17
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@rzikm rzikm force-pushed the h3-cancellation-tests-handle-cancellation-exception branch from 0ade6f8 to 391384e Compare April 23, 2024 13:19
@rzikm
Copy link
Member Author

rzikm commented Apr 23, 2024

Other test failures are unrelated

@rzikm rzikm merged commit d92ac1f into dotnet:main Apr 23, 2024
79 of 87 checks passed
matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
…ync_Cancellation data race (dotnet#101428)

* Fix SocketsHttpHandlerTest_HttpClientHandlerTest_Http3.ReadAsStreamAsync_Cancellation data race

* Fix build
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
…ync_Cancellation data race (dotnet#101428)

* Fix SocketsHttpHandlerTest_HttpClientHandlerTest_Http3.ReadAsStreamAsync_Cancellation data race

* Fix build
@karelz karelz added this to the 9.0.0 milestone May 14, 2024
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
…ync_Cancellation data race (dotnet#101428)

* Fix SocketsHttpHandlerTest_HttpClientHandlerTest_Http3.ReadAsStreamAsync_Cancellation data race

* Fix build
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants