Repository navigation
HTTP/3: InvalidOperationException with many streams on a connection #55249
Copy link
Copy link
Closed
Labels
area-System.Net.Quicbugtenet-reliabilityReliability/stability related issue (stress, load problems, etc.)Reliability/stability related issue (stress, load problems, etc.)
Milestone
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Net.Quicbugtenet-reliabilityReliability/stability related issue (stress, load problems, etc.)Reliability/stability related issue (stress, load problems, etc.)
Activity
JamesNK commentedon Jul 7, 2021
More details: This error isn't consistent. With the same test, this similar error was thrown:
That one looks like it coming from the QuicStream on the server when reading incoming data.
JamesNK commentedon Jul 7, 2021
Repo is in dotnet/aspnetcore#34075. Test is called
StreamPool_ManyConcurrentStreams_StreamPoolFull.Remove the
Task.Delayto get bad behavior:CarnaViire commentedon Jul 15, 2021
@JamesNK could you please check if this still reproduces after #55505?
JamesNK commentedon Jul 17, 2021
Still fails. Logs below.
It is complaining about multiple reads on a stream but the way ASP.NET Core uses QuicStream should ensure there will never be multiple reads.
Details
``` Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests.QuicConnectionContextTests.StreamPool_ManyConcurrentStreams_StreamPoolFull Source: QuicConnectionContextTests.cs line 378 Duration: 5.2 secMessage:
System.TimeoutException : The operation has timed out.
Stack Trace:
TaskExtensions.TimeoutAfter(Task task, TimeSpan timeout, String filePath, Int32 lineNumber) line 125
QuicConnectionContextTests.StreamPool_ManyConcurrentStreams_StreamPoolFull() line 411
QuicConnectionContextTests.StreamPool_ManyConcurrentStreams_StreamPoolFull() line 418
QuicConnectionContextTests.StreamPool_ManyConcurrentStreams_StreamPoolFull() line 418
--- End of stack trace from previous location ---
Standard Output:
| [0.008s] TestLifetime Information: Starting test StreamPool_ManyConcurrentStreams_StreamPoolFull at 2021-07-17T00:14:22
| [0.131s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Connection id "0HMA8MVA4V7N0" accepted.
| [0.166s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:12" type Bidirectional accepted.
| [0.166s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:0" type Bidirectional accepted.
| [0.167s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:16" type Bidirectional accepted.
| [0.166s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:4" type Bidirectional accepted.
| [0.167s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:0" type Bidirectional accepted.
| [0.167s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:8" type Bidirectional accepted.
| [0.182s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:20" type Bidirectional accepted.
| [0.182s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:20" type Bidirectional accepted.
| [0.182s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:20" type Bidirectional accepted.
| [0.182s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:20" type Bidirectional accepted.
| [0.183s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:32" type Bidirectional accepted.
| [0.183s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:28" type Bidirectional accepted.
| [0.183s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:36" type Bidirectional accepted.
| [0.183s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:24" type Bidirectional accepted.
| [0.183s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:40" type Bidirectional accepted.
| [0.183s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:44" type Bidirectional accepted.
| [0.183s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:48" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:64" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:60" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:52" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:56" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:68" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:72" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:76" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:80" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:84" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:88" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:92" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:96" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:100" type Bidirectional accepted.
| [0.184s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:104" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:112" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:108" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:116" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:120" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:124" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:128" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:132" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:136" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:140" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:144" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:148" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:152" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:156" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:160" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:164" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:168" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:172" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:176" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:180" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:184" type Bidirectional accepted.
| [0.185s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:188" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:192" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:196" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:200" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:204" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:208" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:212" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:216" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:220" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:224" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:228" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:232" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:236" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:240" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:244" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:248" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:252" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:256" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:260" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:268" type Bidirectional accepted.
| [0.186s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:264" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:272" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:276" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:280" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:284" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:288" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:292" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:296" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:300" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:304" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:308" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:312" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:316" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:320" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:324" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:328" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:332" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:336" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:340" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:344" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:348" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:352" type Bidirectional accepted.
| [0.187s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:356" type Bidirectional accepted.
| [0.188s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:360" type Bidirectional accepted.
| [0.188s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:364" type Bidirectional accepted.
| [0.188s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:368" type Bidirectional accepted.
| [0.188s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:372" type Bidirectional accepted.
| [0.188s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:376" type Bidirectional accepted.
| [0.188s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:380" type Bidirectional accepted.
| [0.213s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:64" unexpected error.
| System.InvalidOperationException: Only one read is supported at a time.
| at System.Net.Quic.Implementations.MsQuic.MsQuicStream.ReadAsync(Memory
1 destination, CancellationToken cancellationToken) in System.Net.Quic.dll:token 0x6000136+0x211 | at System.Net.Quic.QuicStream.ReadAsync(Memory1 buffer, CancellationToken cancellationToken) in System.Net.Quic.dll:token 0x60000a9+0x0| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.ProcessReceives() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\src\Internal\QuicStreamContext.cs:line 220
| at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) in System.Private.CoreLib.dll:token 0x6004ee7+0x28
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.ProcessReceives() in Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll:token 0x6000100+0x1f
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.DoReceive() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\src\Internal\QuicStreamContext.cs:line 178
| at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) in System.Private.CoreLib.dll:token 0x6004ee7+0x28
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.DoReceive() in Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll:token 0x60000ff+0x1f
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.StartAsync() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\src\Internal\QuicStreamContext.cs:line 149
| at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) in System.Private.CoreLib.dll:token 0x6004ee7+0x28
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.StartAsync() in Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll:token 0x60000fe+0x1f
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.Start() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\src\Internal\QuicStreamContext.cs:line 135
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicConnectionContext.AcceptAsync(CancellationToken cancellationToken) in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\src\Internal\QuicConnectionContext.cs:line 99
| at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) in System.Private.CoreLib.dll:token 0x6004ee7+0x28
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicConnectionContext.AcceptAsync(CancellationToken cancellationToken) in Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll:token 0x60000df+0x26
| at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests.QuicConnectionContextTests.<StreamPool_ManyConcurrentStreams_StreamPoolFull>g__SendStream|8_0(RequestState requestState) in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\test\QuicConnectionContextTests.cs:line 424
| at System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) in System.Private.CoreLib.dll:token 0x6004f12+0x0| at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in System.Private.CoreLib.dll:token 0x6002ead+0x40
| at System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) in System.Private.CoreLib.dll:token 0x6004f16+0x3f| at System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1.AsyncStateMachineBox1.MoveNext() in System.Private.CoreLib.dll:token 0x6004f15+0x0| at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in System.Private.CoreLib.dll:token 0x6003389+0x3b
| at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in System.Private.CoreLib.dll:token 0x600329b+0x65
| at System.Threading.Tasks.Task.FinishContinuations() in System.Private.CoreLib.dll:token 0x600329a+0x14
| at System.Threading.Tasks.Task
1.TrySetResult(TResult result) in System.Private.CoreLib.dll:token 0x6003179+0x4b | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.SetExistingTaskResult(Task1 task, TResult result) in System.Private.CoreLib.dll:token 0x6004f0a+0x0 | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult() in System.Private.CoreLib.dll:token 0x6004ef8+0x14 | at Microsoft.AspNetCore.Testing.TaskExtensions.TimeoutAfter(Task task, TimeSpan timeout, String filePath, Int32 lineNumber) in C:\Development\Source\AspNetCore\src\Shared\TaskExtensions.cs:line 143 | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) in System.Private.CoreLib.dll:token 0x6004f12+0x0 | at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in System.Private.CoreLib.dll:token 0x6002ead+0x40 | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) in System.Private.CoreLib.dll:token 0x6004f16+0x3f | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext() in System.Private.CoreLib.dll:token 0x6004f15+0x0 | at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in System.Private.CoreLib.dll:token 0x6003389+0x3b | at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in System.Private.CoreLib.dll:token 0x600329b+0x65 | at System.Threading.Tasks.Task.FinishContinuations() in System.Private.CoreLib.dll:token 0x600329a+0x14 | at System.Threading.Tasks.Task1.TrySetResult(TResult result) in System.Private.CoreLib.dll:token 0x6003179+0x4b| at System.Threading.Tasks.Task.CancellationPromise
1.System.Threading.Tasks.ITaskCompletionAction.Invoke(Task completingTask) in System.Private.CoreLib.dll:token 0x60032f7+0x3c | at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining) in System.Private.CoreLib.dll:token 0x600329c+0x0 | at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in System.Private.CoreLib.dll:token 0x600329b+0x90 | at System.Threading.Tasks.Task.FinishContinuations() in System.Private.CoreLib.dll:token 0x600329a+0x14 | at System.Threading.Tasks.Task1.TrySetResult(TResult result) in System.Private.CoreLib.dll:token 0x6003179+0x4b| at System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1.SetExistingTaskResult(Task1 task, TResult result) in System.Private.CoreLib.dll:token 0x6004f0a+0x0| at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder.SetResult() in System.Private.CoreLib.dll:token 0x6004f1e+0x14
| at System.Net.Quic.Implementations.MsQuic.MsQuicStream.WriteAsync(ReadOnlyMemory
1 buffer, Boolean endStream, CancellationToken cancellationToken) in System.Net.Quic.dll:token 0x6000132+0xfe | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) in System.Private.CoreLib.dll:token 0x6004f12+0x0 | at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) in System.Private.CoreLib.dll:token 0x6002eb0+0x15 | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) in System.Private.CoreLib.dll:token 0x6004f16+0x4d | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecuteFromThreadPool(Thread threadPoolThread) in System.Private.CoreLib.dll:token 0x6004f14+0x0 | at System.Threading.ThreadPoolWorkQueue.Dispatch() in System.Private.CoreLib.dll:token 0x6002fff+0x0 | at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() in System.Private.CoreLib.dll:token 0x60030f9+0x67 | at System.Threading.Thread.StartCallback() in System.Private.CoreLib.dll:token 0x6002c91+0xe | --- End of stack trace from previous location --- | at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.ProcessReceives() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\src\Internal\QuicStreamContext.cs:line 220 | at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.DoReceive() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\src\Internal\QuicStreamContext.cs:line 178 | [0.218s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic Debug: Stream id "0HMA8MVA4V7N0:64" type Bidirectional accepted. | [5.179s] Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests.QuicConnectionContextTests Error: Test threw an exception. | System.TimeoutException: The operation has timed out. | at Microsoft.AspNetCore.Testing.TaskExtensions.TimeoutAfter(Task task, TimeSpan timeout, String filePath, Int32 lineNumber) in C:\Development\Source\AspNetCore\src\Shared\TaskExtensions.cs:line 125 | at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests.QuicConnectionContextTests.StreamPool_ManyConcurrentStreams_StreamPoolFull() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\test\QuicConnectionContextTests.cs:line 411 | at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests.QuicConnectionContextTests.StreamPool_ManyConcurrentStreams_StreamPoolFull() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\test\QuicConnectionContextTests.cs:line 418 | at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests.QuicConnectionContextTests.StreamPool_ManyConcurrentStreams_StreamPoolFull() in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\test\QuicConnectionContextTests.cs:line 418 | at Xunit.Sdk.TestInvoker1.<>c__DisplayClass48_1.<b__1>d.MoveNext() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 264| --- End of stack trace from previous location ---
| at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func
1 asyncAction) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 48 | at Xunit.Sdk.ExceptionAggregator.RunAsync(Func1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90| [5.220s] TestLifetime Information: Finished test StreamPool_ManyConcurrentStreams_StreamPoolFull in 5.2171434s
wegylexy commentedon Jul 20, 2021
It also happens to me, with only 2 QUIC streams per connection, only a couple of connections, not using HTTP/3, just purely QUIC. The stack trace is not consistent, but the top is always
sometimes with
in between but always followed by
The worst thing is that
try-catchdoesn't catch it, and the program crashes withUnhandled exception.karelz commentedon Jul 22, 2021
Triage: Lower priority, unless it is problem when going up to 10 parallel requests.
JamesNK commentedon Jul 22, 2021
I've tested and it fails with even 10 parallel requests. I'm going to move it back to high priority.
Logs:
wfurt commentedon Jul 22, 2021
where this comes from?
is there asp.net test that demonstrates that? (or better yet add test ton runtime or have standalone repro)
6 remaining items
wegylexy commentedon Jul 23, 2021
Try to assert if they are indeed different streams, i.e. no concurrent IO within a stream?
JamesNK commentedon Jul 23, 2021
There shouldn't be any concurrent reads or concurrent writes on a stream.
Kestrel reads and writes with QuicStream using simple loops:
A read and write could happen at the same time, but that shouldn't be a problem.
wfurt commentedon Aug 3, 2021
I was able to reproduce it but it is pretty rare for me. I also see some other failures, timeouts and
Thew timeouts are mostly coming from
await allConnectionsOnServerTcs.ManickaP commentedon Aug 10, 2021
@JamesNK so is this issue fixed from your point of view?
We're not 100% sure the change we made should fix this, but for now this might be mitigated and at least punted.
karelz commentedon Nov 16, 2021
Looks like it is addressed by PR #56768