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

[browser] FATAL UNHANDLED EXCEPTION #98842

Closed
pavelsavara opened this issue Feb 23, 2024 · 3 comments
Closed

[browser] FATAL UNHANDLED EXCEPTION #98842

pavelsavara opened this issue Feb 23, 2024 · 3 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab os-browser Browser variant of arch-wasm
Milestone

Comments

@pavelsavara
Copy link
Member

pavelsavara commented Feb 23, 2024

Error Blob

{
  "ErrorMessage": "warn: [ERROR] FATAL UNHANDLED EXCEPTION",
  "BuildRetry": false,
  "ErrorPattern": "",
  "ExcludeConsoleLog": false
}

Reproduction Steps

Log
Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=576320

[22:43:06] info: [PASS] System.Linq.Parallel.Tests.OrderByThenByTests.OrderBy_ThreadedDeadlock
[22:43:06] warn: 
[22:43:06] warn: Unhandled Exception:
[22:43:06] warn: System.InvalidCastException: Specified cast is not valid.
[22:43:06] warn:    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[22:43:06] warn:    at System.Threading.Tasks.Task.ProcessChildCompletion(Task childTask)
[22:43:06] warn:    at System.Threading.Tasks.Task.NotifyParentIfPotentiallyAttachedTask()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute)
[22:43:06] warn:    at System.Threading.Tasks.Task.Finish(Boolean userDelegateExecute)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.ThreadPoolWorkQueue.Dispatch()
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkLoopSemaphoreSuccess(LowLevelLifoAsyncWaitSemaphore semaphore, Object stateObject)
[22:43:06] warn:    at System.Threading.LowLevelLifoAsyncWaitSemaphore.PrepareAsyncWait(Int32 timeoutMs, Action`2 onSuccess, Action`2 onTimeout, Object state)
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WaitForWorkLoop(LowLevelLifoAsyncWaitSemaphore semaphore, SemaphoreWaitState state)
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
[22:43:06] warn: [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidCastException: Specified cast is not valid.
[22:43:06] warn:    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[22:43:06] warn:    at System.Threading.Tasks.Task.ProcessChildCompletion(Task childTask)
[22:43:06] warn:    at System.Threading.Tasks.Task.NotifyParentIfPotentiallyAttachedTask()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute)
[22:43:06] warn:    at System.Threading.Tasks.Task.Finish(Boolean userDelegateExecute)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.ThreadPoolWorkQueue.Dispatch()
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkLoopSemaphoreSuccess(LowLevelLifoAsyncWaitSemaphore semaphore, Object stateObject)
[22:43:06] warn:    at System.Threading.LowLevelLifoAsyncWaitSemaphore.PrepareAsyncWait(Int32 timeoutMs, Action`2 onSuccess, Action`2 onTimeout, Object state)
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WaitForWorkLoop(LowLevelLifoAsyncWaitSemaphore semaphore, SemaphoreWaitState state)
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
[22:43:06] info: [FAIL] System.Linq.Parallel.Tests.OrderByThenByTests.OrderBy_ThreadedDeadlock(labeled: ParallelEnumerable.Range, count: 1, degree: 2)
[22:43:06] info: Assert.Throws() Failure: Exception type was not an exact match
[22:43:06] info: Expected: typeof(System.AggregateException)
[22:43:06] info: Actual:   typeof(System.Threading.Tasks.TaskSchedulerException)
[22:43:06] info: ---- System.Threading.Tasks.TaskSchedulerException : An exception was thrown by a TaskScheduler.
[22:43:06] info: -------- System.PlatformNotSupportedException : Blocking wait is not supported on the JS interop threads.
[22:43:06] info:    at System.Linq.Parallel.Tests.OrderByThenByTests.OrderBy_ThreadedDeadlock(Labeled`1 labeled, Int32 count, Int32 degree)
[22:43:06] info:    at System.Object.InvokeStub_OrderByThenByTests.OrderBy_ThreadedDeadlock(Object , Span`1 )
[22:43:06] info:    at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[22:43:06] info: ----- Inner Stack Trace -----
[22:43:06] info:    at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
[22:43:06] info:    at System.Linq.Parallel.OrderPreservingSpoolingTask`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Spool(QueryTaskGroupState groupState, PartitionedStream`2 partitions, Shared`1 results, TaskScheduler taskScheduler)
[22:43:06] info:    at System.Linq.Parallel.OrderPreservingMergeHelper`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].System.Linq.Parallel.IMergeHelper<TInputOutput>.Execute()
[22:43:06] info:    at System.Linq.Parallel.MergeExecutor`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Execute[Int32](PartitionedStream`2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
[22:43:06] info:    at System.Linq.Parallel.PartitionedStreamMerger`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Receive[Int32](PartitionedStream`2 partitionedStream)
[22:43:06] info:    at System.Linq.Parallel.SortQueryOperator`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WrapPartitionedStream[Int32](PartitionedStream`2 inputStream, IPartitionedStreamRecipient`1 recipient, Boolean preferStriping, QuerySettings settings)
[22:43:06] info:    at System.Linq.Parallel.SortQueryOperatorResults`2.ChildResultsRecipient[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Receive[Int32](PartitionedStream`2 childPartitionedStream)
[22:43:06] info:    at System.Linq.Parallel.ScanQueryOperator`1.ScanEnumerableQueryOperatorResults[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
[22:43:06] info:    at System.Linq.Parallel.SortQueryOperatorResults`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
[22:43:06] info:    at System.Linq.Parallel.QueryOperator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOpenedEnumerator(Nullable`1 mergeOptions, Boolean suppressOrder, Boolean forEffect, QuerySettings querySettings)
[22:43:06] info:    at System.Linq.Parallel.QueryOpeningEnumerator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OpenQuery()
[22:43:06] info:    at System.Linq.Parallel.QueryOpeningEnumerator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
[22:43:06] info:    at System.Linq.Parallel.Tests.OrderByThenByTests.<>c__DisplayClass42_0.<OrderBy_ThreadedDeadlock>b__1()
[22:43:06] info: ----- Inner Stack Trace -----
[22:43:06] info:    at System.Threading.Thread.AssureBlockingPossible()
[22:43:06] info:    at System.Threading.Monitor.Wait(Object obj, Int32 millisecondsTimeout)
[22:43:06] info:    at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
[22:43:06] info:    at System.Threading.Tasks.Task.SpinThenBlockingWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
[22:43:06] info:    at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
[22:43:11] info: STATE CUE CARD: (? means a positive number, usually 1 or 2, * means any number)
[22:43:11] info: 	0x0	- starting (GOOD, unless the thread is running managed code)
[22:43:11] info: 	0x1	- detached (GOOD, unless the thread is running managed code)
[22:43:11] info: 	0x2	- running (BAD, unless it's the gc thread)
[22:43:11] info: 	0x?03	- async suspended (GOOD)
[22:43:11] info: 	0x?04	- self suspended (GOOD)
[22:43:11] info: 	0x?05	- async suspend requested (BAD)
[22:43:11] info: 	0x6	- blocking (BAD, unless there's no suspend initiator)
[22:43:11] info: 	0x?07	- blocking async suspended (GOOD)
[22:43:11] info: 	0x?08	- blocking self suspended (GOOD)
[22:43:11] info: 	0x?09	- blocking suspend requested (GOOD in coop; BAD in hybrid)
[22:43:11] info: --thread 0x347e368 id 0xdc96c [0] state 109
[22:43:11] info: --thread 0x2085b38 id 0x1b7cad0 [0] state 2  GC INITIATOR
[22:43:11] info: --thread 0x5551900 id 0x36276b8 [0] state 109
[22:43:11] info: --thread 0x382e7d8 id 0x3936d48 [0] state 108
[22:43:11] info: --thread 0x3b3bb48 id 0x3c58ce0 [0] state 6
[22:43:11] info: --thread 0x5a48f80 id 0x72cf068 [0] state 105
[22:43:11] info: WAITING for 1 threads, got 0 suspended
[22:43:11] fail: [0x01b7cad0-dpty 22:43:11.329] [MONO] /__w/1/s/src/mono/mono/utils/mono-threads.c:330 <disabled>

Report

Build Definition Test Pull Request
596934 dotnet/runtime WasmTestOnBrowser-System.Runtime.Tests.WorkItemExecution #99212
592800 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
591685 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
590978 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
590245 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
589684 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
579201 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
576845 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
576320 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
575939 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
575598 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98802
574940 dotnet/runtime WasmTestOnBrowser-System.Threading.Timer.Tests.WorkItemExecution #98118

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 11

Known issue validation

Build: 🔎
Result validation: ⚠️ Validation could not be done without an Azure DevOps build URL on the issue. Please add it to the "Build: 🔎" line.
Validation performed at: 3/11/2024 10:30:59 AM UTC

@pavelsavara pavelsavara added arch-wasm WebAssembly architecture blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' area-VM-threading-mono Known Build Error Use this to report build issues in the .NET Helix tab os-browser Browser variant of arch-wasm labels Feb 23, 2024
@pavelsavara pavelsavara added this to the 9.0.0 milestone Feb 23, 2024
@pavelsavara pavelsavara self-assigned this Feb 23, 2024
@ghost
Copy link

ghost commented Feb 23, 2024

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Error Blob

{
  "ErrorMessage": "warn: [ERROR] FATAL UNHANDLED EXCEPTION",
  "BuildRetry": false,
  "ErrorPattern": "",
  "ExcludeConsoleLog": false
}

Reproduction Steps

Log
Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=576320

[22:43:06] info: [PASS] System.Linq.Parallel.Tests.OrderByThenByTests.OrderBy_ThreadedDeadlock
[22:43:06] warn: 
[22:43:06] warn: Unhandled Exception:
[22:43:06] warn: System.InvalidCastException: Specified cast is not valid.
[22:43:06] warn:    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[22:43:06] warn:    at System.Threading.Tasks.Task.ProcessChildCompletion(Task childTask)
[22:43:06] warn:    at System.Threading.Tasks.Task.NotifyParentIfPotentiallyAttachedTask()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute)
[22:43:06] warn:    at System.Threading.Tasks.Task.Finish(Boolean userDelegateExecute)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.ThreadPoolWorkQueue.Dispatch()
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkLoopSemaphoreSuccess(LowLevelLifoAsyncWaitSemaphore semaphore, Object stateObject)
[22:43:06] warn:    at System.Threading.LowLevelLifoAsyncWaitSemaphore.PrepareAsyncWait(Int32 timeoutMs, Action`2 onSuccess, Action`2 onTimeout, Object state)
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WaitForWorkLoop(LowLevelLifoAsyncWaitSemaphore semaphore, SemaphoreWaitState state)
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
[22:43:06] warn: [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidCastException: Specified cast is not valid.
[22:43:06] warn:    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[22:43:06] warn:    at System.Threading.Tasks.Task.ProcessChildCompletion(Task childTask)
[22:43:06] warn:    at System.Threading.Tasks.Task.NotifyParentIfPotentiallyAttachedTask()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[22:43:06] warn:    at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute)
[22:43:06] warn:    at System.Threading.Tasks.Task.Finish(Boolean userDelegateExecute)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
[22:43:06] warn:    at System.Threading.ThreadPoolWorkQueue.Dispatch()
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkLoopSemaphoreSuccess(LowLevelLifoAsyncWaitSemaphore semaphore, Object stateObject)
[22:43:06] warn:    at System.Threading.LowLevelLifoAsyncWaitSemaphore.PrepareAsyncWait(Int32 timeoutMs, Action`2 onSuccess, Action`2 onTimeout, Object state)
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WaitForWorkLoop(LowLevelLifoAsyncWaitSemaphore semaphore, SemaphoreWaitState state)
[22:43:06] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
[22:43:06] info: [FAIL] System.Linq.Parallel.Tests.OrderByThenByTests.OrderBy_ThreadedDeadlock(labeled: ParallelEnumerable.Range, count: 1, degree: 2)
[22:43:06] info: Assert.Throws() Failure: Exception type was not an exact match
[22:43:06] info: Expected: typeof(System.AggregateException)
[22:43:06] info: Actual:   typeof(System.Threading.Tasks.TaskSchedulerException)
[22:43:06] info: ---- System.Threading.Tasks.TaskSchedulerException : An exception was thrown by a TaskScheduler.
[22:43:06] info: -------- System.PlatformNotSupportedException : Blocking wait is not supported on the JS interop threads.
[22:43:06] info:    at System.Linq.Parallel.Tests.OrderByThenByTests.OrderBy_ThreadedDeadlock(Labeled`1 labeled, Int32 count, Int32 degree)
[22:43:06] info:    at System.Object.InvokeStub_OrderByThenByTests.OrderBy_ThreadedDeadlock(Object , Span`1 )
[22:43:06] info:    at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[22:43:06] info: ----- Inner Stack Trace -----
[22:43:06] info:    at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
[22:43:06] info:    at System.Linq.Parallel.OrderPreservingSpoolingTask`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Spool(QueryTaskGroupState groupState, PartitionedStream`2 partitions, Shared`1 results, TaskScheduler taskScheduler)
[22:43:06] info:    at System.Linq.Parallel.OrderPreservingMergeHelper`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].System.Linq.Parallel.IMergeHelper<TInputOutput>.Execute()
[22:43:06] info:    at System.Linq.Parallel.MergeExecutor`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Execute[Int32](PartitionedStream`2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
[22:43:06] info:    at System.Linq.Parallel.PartitionedStreamMerger`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Receive[Int32](PartitionedStream`2 partitionedStream)
[22:43:06] info:    at System.Linq.Parallel.SortQueryOperator`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WrapPartitionedStream[Int32](PartitionedStream`2 inputStream, IPartitionedStreamRecipient`1 recipient, Boolean preferStriping, QuerySettings settings)
[22:43:06] info:    at System.Linq.Parallel.SortQueryOperatorResults`2.ChildResultsRecipient[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Receive[Int32](PartitionedStream`2 childPartitionedStream)
[22:43:06] info:    at System.Linq.Parallel.ScanQueryOperator`1.ScanEnumerableQueryOperatorResults[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
[22:43:06] info:    at System.Linq.Parallel.SortQueryOperatorResults`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
[22:43:06] info:    at System.Linq.Parallel.QueryOperator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOpenedEnumerator(Nullable`1 mergeOptions, Boolean suppressOrder, Boolean forEffect, QuerySettings querySettings)
[22:43:06] info:    at System.Linq.Parallel.QueryOpeningEnumerator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OpenQuery()
[22:43:06] info:    at System.Linq.Parallel.QueryOpeningEnumerator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
[22:43:06] info:    at System.Linq.Parallel.Tests.OrderByThenByTests.<>c__DisplayClass42_0.<OrderBy_ThreadedDeadlock>b__1()
[22:43:06] info: ----- Inner Stack Trace -----
[22:43:06] info:    at System.Threading.Thread.AssureBlockingPossible()
[22:43:06] info:    at System.Threading.Monitor.Wait(Object obj, Int32 millisecondsTimeout)
[22:43:06] info:    at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
[22:43:06] info:    at System.Threading.Tasks.Task.SpinThenBlockingWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
[22:43:06] info:    at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
[22:43:11] info: STATE CUE CARD: (? means a positive number, usually 1 or 2, * means any number)
[22:43:11] info: 	0x0	- starting (GOOD, unless the thread is running managed code)
[22:43:11] info: 	0x1	- detached (GOOD, unless the thread is running managed code)
[22:43:11] info: 	0x2	- running (BAD, unless it's the gc thread)
[22:43:11] info: 	0x?03	- async suspended (GOOD)
[22:43:11] info: 	0x?04	- self suspended (GOOD)
[22:43:11] info: 	0x?05	- async suspend requested (BAD)
[22:43:11] info: 	0x6	- blocking (BAD, unless there's no suspend initiator)
[22:43:11] info: 	0x?07	- blocking async suspended (GOOD)
[22:43:11] info: 	0x?08	- blocking self suspended (GOOD)
[22:43:11] info: 	0x?09	- blocking suspend requested (GOOD in coop; BAD in hybrid)
[22:43:11] info: --thread 0x347e368 id 0xdc96c [0] state 109
[22:43:11] info: --thread 0x2085b38 id 0x1b7cad0 [0] state 2  GC INITIATOR
[22:43:11] info: --thread 0x5551900 id 0x36276b8 [0] state 109
[22:43:11] info: --thread 0x382e7d8 id 0x3936d48 [0] state 108
[22:43:11] info: --thread 0x3b3bb48 id 0x3c58ce0 [0] state 6
[22:43:11] info: --thread 0x5a48f80 id 0x72cf068 [0] state 105
[22:43:11] info: WAITING for 1 threads, got 0 suspended
[22:43:11] fail: [0x01b7cad0-dpty 22:43:11.329] [MONO] /__w/1/s/src/mono/mono/utils/mono-threads.c:330 <disabled>
Author: pavelsavara
Assignees: -
Labels:

arch-wasm, blocking-clean-ci, area-VM-threading-mono, Known Build Error, os-browser

Milestone: 9.0.0

@lambdageek
Copy link
Member

This has the same flavor as #81211

@pavelsavara
Copy link
Member Author

It only happens when unit tests are running on deputy thread and throw PNSE from .Wait and I guess we are not handling the exception gracefully. InvalidCastException is strange thou.

This one is bit better log

[16:52:13] info: [FAIL] System.Linq.Parallel.Tests.ExchangeTests.Merge_Ordered_Pipelining(labeled: ThrowOnEnumeration 4, count: 4, options: FullyBuffered)
[16:52:13] info: System.Threading.Tasks.TaskSchedulerException : An exception was thrown by a TaskScheduler.
[16:52:13] info: ---- System.PlatformNotSupportedException : Blocking wait is not supported on the JS interop threads.
[16:52:13] info:    at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
[16:52:13] info:    at System.Linq.Parallel.OrderPreservingSpoolingTask`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Spool(QueryTaskGroupState groupState, PartitionedStream`2 partitions, Shared`1 results, TaskScheduler taskScheduler)
[16:52:13] info:    at System.Linq.Parallel.OrderPreservingMergeHelper`2[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].System.Linq.Parallel.IMergeHelper<TInputOutput>.Execute()
[16:52:13] info:    at System.Linq.Parallel.MergeExecutor`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Execute[Int32](PartitionedStream`2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
[16:52:13] info:    at System.Linq.Parallel.PartitionedStreamMerger`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Receive[Int32](PartitionedStream`2 partitionedStream)
[16:52:13] info:    at System.Linq.Parallel.FirstQueryOperator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WrapHelper[Int32](PartitionedStream`2 inputStream, IPartitionedStreamRecipient`1 recipient, QuerySettings settings)
[16:52:13] info:    at System.Linq.Parallel.FirstQueryOperator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WrapPartitionedStream[Int32](PartitionedStream`2 inputStream, IPartitionedStreamRecipient`1 recipient, Boolean preferStriping, QuerySettings settings)
[16:52:13] info:    at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.ChildResultsRecipient[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Receive[Int32](PartitionedStream`2 inputStream)
[16:52:13] info:    at System.Linq.Parallel.ScanQueryOperator`1.ScanEnumerableQueryOperatorResults[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
[16:52:13] info:    at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
[16:52:13] info:    at System.Linq.Parallel.QueryOperator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOpenedEnumerator(Nullable`1 mergeOptions, Boolean suppressOrder, Boolean forEffect, QuerySettings querySettings)
[16:52:13] info:    at System.Linq.Parallel.QueryOpeningEnumerator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OpenQuery()
[16:52:13] info:    at System.Linq.Parallel.QueryOpeningEnumerator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
[16:52:13] info:    at System.Linq.ParallelEnumerable.GetOneWithPossibleDefault[Int32](QueryOperator`1 queryOp, Boolean throwIfTwo, Boolean defaultIfEmpty)
[16:52:13] info:    at System.Linq.ParallelEnumerable.First[Int32](ParallelQuery`1 source)
[16:52:13] info:    at System.Linq.Parallel.Tests.ExchangeTests.Merge_Ordered_Pipelining(Labeled`1 labeled, Int32 count, ParallelMergeOptions options)
[16:52:13] info:    at System.Object.InvokeStub_ExchangeTests.Merge_Ordered_Pipelining(Object , Span`1 )
[16:52:13] info:    at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[16:52:13] info: ----- Inner Stack Trace -----
[16:52:13] info:    at System.Threading.Thread.AssureBlockingPossible()
[16:52:13] info:    at System.Threading.Monitor.Wait(Object obj, Int32 millisecondsTimeout)
[16:52:13] info:    at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
[16:52:13] info:    at System.Threading.Tasks.Task.SpinThenBlockingWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
[16:52:13] info:    at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
[16:52:13] warn: 
[16:52:13] warn: Unhandled Exception:
[16:52:13] warn: System.InvalidCastException: Specified cast is not valid.
[16:52:13] warn:    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
[16:52:13] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[16:52:13] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[16:52:13] warn:    at System.Threading.Tasks.Task.ProcessChildCompletion(Task childTask)
[16:52:13] warn:    at System.Threading.Tasks.Task.NotifyParentIfPotentiallyAttachedTask()
[16:52:13] warn:    at System.Threading.Tasks.Task.FinishStageThree()
[16:52:13] warn:    at System.Threading.Tasks.Task.FinishStageTwo()
[16:52:13] warn:    at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute)
[16:52:13] warn:    at System.Threading.Tasks.Task.Finish(Boolean userDelegateExecute)
[16:52:13] warn:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[16:52:13] warn:    at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
[16:52:13] warn:    at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
[16:52:13] warn:    at System.Threading.ThreadPoolWorkQueue.Dispatch()
[16:52:13] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkLoopSemaphoreSuccess(LowLevelLifoAsyncWaitSemaphore semaphore, Object stateObject)
[16:52:13] warn:    at System.Threading.LowLevelLifoAsyncWaitSemaphore.PrepareAsyncWait(Int32 timeoutMs, Action`2 onSuccess, Action`2 onTimeout, Object state)
[16:52:13] warn:    at System.Threading.PortableThreadPool.WorkerThread.WaitForWorkLoop(LowLevelLifoAsyncWaitSemaphore semaphore, SemaphoreWaitState state)
[16:52:13] warn:    at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

@pavelsavara pavelsavara changed the title [brower][MT] FATAL UNHANDLED EXCEPTION: System.InvalidCastException: Specified cast is not valid. [browser] FATAL UNHANDLED EXCEPTION Mar 11, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab os-browser Browser variant of arch-wasm
Projects
None yet
Development

No branches or pull requests

2 participants