Repository navigation
Closed
Labels
area-System.Threading.Tasksblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'runtime-async
Milestone
Description
Starting: System.Threading.Channels.Tests (parallel test collections = on [2 threads], stop on fail = off)
Process terminated.
Assertion failed.
state is RuntimeAsyncTask<T>
at System.Runtime.CompilerServices.AsyncHelpers.RuntimeAsyncTask`1.<>c.<.cctor>b__16_1(Object state) in /_/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncHelpers.CoreCLR.cs:line 711
at System.Threading.Channels.ChannelUtilities.DangerousSetOperations[TAsyncOp,TResult](TAsyncOp head, TResult result) in /_/src/libraries/System.Threading.Channels/src/System/Threading/Channels/ChannelUtilities.cs:line 245
at System.Threading.Channels.UnboundedChannel`1.UnboundedChannelWriter.TryWrite(T item) in /_/src/libraries/System.Threading.Channels/src/System/Threading/Channels/UnboundedChannel.cs:line 281
at System.Threading.Channels.UnboundedChannel`1.UnboundedChannelWriter.WriteAsync(T item, CancellationToken cancellationToken) in /_/src/libraries/System.Threading.Channels/src/System/Threading/Channels/UnboundedChannel.cs:line 298
at System.Threading.Channels.Tests.ChannelTestBase.<>c__DisplayClass26_0.<ManyProducerConsumer_ConcurrentReadWrite_Success>b__1() in /_/src/libraries/System.Threading.Channels/tests/ChannelTestBase.cs:line 248
at System.Threading.Tasks.Task`1.InnerInvoke() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task_T.cs:line 486
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs:line 279
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:line 2424
at System.Threading.ThreadPoolWorkQueue.Dispatch() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs:line 950
at System.Threading.PortableThreadPool.WorkerThread.WorkerDoWork(PortableThreadPool threadPoolInstance) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs:line 134
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs:line 110
at System.Threading.Thread.StartCallback() in /_/src/coreclr/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.cs:line 116
[createdump] Gathering state for process 34 dotnet
Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1314345
Build error leg or test failing: System.Threading.Channels.Tests.WorkItemExecution
Pull request: #124725
Error Message
Fill the error message using step by step known issues guidance.
{
"ErrorMessage": "state is RuntimeAsyncTask<T>",
"ErrorPattern": "",
"BuildRetry": false,
"ExcludeConsoleLog": false
}Known issue validation
Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1314345
Error message validated: [state is RuntimeAsyncTask<T>]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 2/28/2026 8:10:46 PM UTC
Report
| Build | Definition | Test | Pull Request |
|---|---|---|---|
| 1356861 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | |
| 1356722 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #125900 |
| 1356463 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #126231 |
| 1352252 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #126091 |
| 1343605 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #125759 |
| 1340863 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #125436 |
| 1335001 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #124920 |
| 1328950 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #125211 |
| 1324436 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #125282 |
| 1318669 | dotnet/runtime | System.Threading.Channels.Tests.WorkItemExecution | #123819 |
Summary
| 24-Hour Hit Count | 7-Day Hit Count | 1-Month Count |
|---|---|---|
| 0 | 4 | 10 |
Metadata
Metadata
Assignees
Labels
area-System.Threading.Tasksblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'runtime-async
Type
Projects
- StatusShow more project fieldsNo status
Activity
dotnet-policy-service commentedon Feb 28, 2026
Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Feb 28, 2026
Tagging subscribers to this area: @dotnet/area-system-threading-tasks
See info in area-owners.md if you want to be subscribed.
jakobbotsch commentedon Mar 2, 2026
The code looks quite innocent:
runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncHelpers.CoreCLR.cs
Lines 709 to 713 in 1fd4dda
runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncHelpers.CoreCLR.cs
Line 447 in 1fd4dda
Either we are breaking some invariants or this is some kind of a race in
UnboundedChanneland how it calls continuations.jakobbotsch commentedon Mar 2, 2026
@stephentoub Before I dig deeper here or try to come up with a smaller repro, would this be a possible symptom of us calling
OnCompletedmultiple times perhaps?jakobbotsch commentedon Mar 2, 2026
Copilot points at a missing barrier here:
runtime/src/libraries/System.Threading.Channels/src/System/Threading/Channels/AsyncOperation.cs
Lines 270 to 277 in 20650a9
Been trying to come up with a smaller repro, but so far no luck.
JulieLeeMSFT commentedon Mar 3, 2026
Failed in: runtime-coreclr libraries-jitstress 20260224.1
Failed tests:
Error message:
Stack Trace
mangod9 commentedon Mar 19, 2026
copilot provided this analysis:
NinoFloris commentedon Mar 31, 2026
This was addressed in ManualResetValueTaskSourceCore in 3c25f59#diff-2e8d67cb44ae1feafd4904c162a22a6d971210cf251f9a60256f10536ac16bc8R216. AsyncOperation seems to have borrowed a lot of this code when it was written, but it was not kept in sync afterwards (it might be worthwhile to see if more can be shared).
The rationale reads correct to me: any load of
_continuationmust be prevented from reordering with the later loads of fields that were mutated before the_continuationrelease fence. I have actually had real issues with exactly this reordered read on an unfixed copy of MRVTSC code on my arm64 mac. AsyncOperation seems to be affected by the same issue, the Volatile.Read on _continuation is the right fix for it.Avoid reordering when reading continuation state in AsyncOperation.Si…
jakobbotsch commentedon Apr 1, 2026
@NinoFloris Thanks for pointing at that!
Avoid reordering when reading continuation state in AsyncOperation.Si…