runtime: HTTP/3: InvalidOperationException with many streams on a connection
I have a test that:
- Client is starting a QUIC connection. The server accepts it.
- Client is starting 101 concurrent bidirectional streams simultaneously on the connection.
- Each client stream is sending about 20 bytes to the server then finishing.
- The server is reading the data and then waiting.
- Once all 101 streams are open and the server has read data from each stream then the server then completes the open streams gracefully (I think, still getting my head around what that means with QUIC).
I saw this error:
[xUnit.net 00:00:00.51] Starting: Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (parallel test collections = on, max threads = unlimited)
The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.InvalidOperationException: Operation is not valid due to the current state of the object.
at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.OnCompleted(Action`1 continuation, Object state, Int16 token, ValueTaskSourceOnCompletedFlags flags) in System.Private.CoreLib.dll:token 0x6003034+0x97
at System.Net.Quic.Implementations.MsQuic.Internal.ResettableCompletionSource`1.OnCompleted(Action`1 continuation, Object state, Int16 token, ValueTaskSourceOnCompletedFlags flags) in System.Net.Quic.dll:token 0x6000198+0x0
at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.System.Runtime.CompilerServices.IStateMachineBoxAwareAwaiter.AwaitUnsafeOnCompleted(IAsyncStateMachineBox box) in System.Private.CoreLib.dll:token 0x6004ae4+0x2c
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AwaitUnsafeOnCompleted[TAwaiter](TAwaiter& awaiter, IAsyncStateMachineBox box) in System.Private.CoreLib.dll:token 0x6004a5b+0x0
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_1(Object state) in System.Private.CoreLib.dll:token 0x6002ea3+0x0
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute() in System.Private.CoreLib.dll:token 0x6002bac+0x14
at System.Threading.ThreadPoolWorkQueue.Dispatch() in System.Private.CoreLib.dll:token 0x6002b86+0xa0
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() in System.Private.CoreLib.dll:token 0x6002c80+0x67
at System.Threading.Thread.StartCallback() in System.Private.CoreLib.dll:token 0x6002819+0xe
I’m not sure at what point or why the error happens as it is raised from the thread pool and crashes the test.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (20 by maintainers)
Repo: https://github.com/dotnet/aspnetcore/tree/jamesnk/http3-quicbug-parallelstreams Test: StreamPool_ManyConcurrentStreams_StreamPoolFull
https://github.com/dotnet/aspnetcore/blob/jamesnk/http3-quicbug-parallelstreams/src/Servers/Kestrel/Transport.Quic/test/QuicConnectionContextTests.cs#L379-L469