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

[MT][browser] WithExecutionMode fails #91661

Closed
ilonatommy opened this issue Sep 6, 2023 · 3 comments · Fixed by #96215
Closed

[MT][browser] WithExecutionMode fails #91661

ilonatommy opened this issue Sep 6, 2023 · 3 comments · Fixed by #96215
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono disabled-test The test is disabled in source code against the issue
Milestone

Comments

@ilonatommy
Copy link
Member

ilonatommy commented Sep 6, 2023

Failing after enabling all MT library tests (#91536).

[FAIL] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: ParallelEnumerable.Range, requestedDop: 4, expectedDop: 4, operation: Select+SelectMany+foreach, mode: Default)
[FAIL] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: Partitioner.Create, requestedDop: 4, expectedDop: 4, operation: Select+SelectMany+foreach, mode: Default)
[FAIL] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: ParallelEnumerable.Range, requestedDop: 4, expectedDop: 4, operation: Select+SelectMany+foreach, mode: ForceParallelism)
[FAIL] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: Partitioner.Create, requestedDop: 4, expectedDop: 4, operation: Select+SelectMany+foreach, mode: ForceParallelism)
  �[40m�[32minfo�[39m�[22m�[49m: Assert.Equal() Failure
  �[40m�[32minfo�[39m�[22m�[49m: Expected: 4
  �[40m�[32minfo�[39m�[22m�[49m: Actual:   0
  �[40m�[32minfo�[39m�[22m�[49m:    at System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(Labeled`1 labeled, Int32 requestedDop, Int32 expectedDop, Labeled`1 operation, ParallelExecutionMode mode)
  �[40m�[32minfo�[39m�[22m�[49m:    at System.Object.InvokeStub_PlinqModesTests.WithExecutionMode(Object , Span`1 )
  �[40m�[32minfo�[39m�[22m�[49m:    at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

The problematic operation is SelectMany.

@ilonatommy ilonatommy added arch-wasm WebAssembly architecture disabled-test The test is disabled in source code against the issue area-Build-mono area-VM-threading-mono labels Sep 6, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 6, 2023
@ghost
Copy link

ghost commented Sep 6, 2023

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

Issue Details

Failing after enabling all MT library tests (#91536).

[FAIL] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: ParallelEnumerable.Range, requestedDop: 4, expectedDop: 4, operation: Select+SelectMany+foreach, mode: Default)
  �[40m�[32minfo�[39m�[22m�[49m: Assert.Equal() Failure
  �[40m�[32minfo�[39m�[22m�[49m: Expected: 4
  �[40m�[32minfo�[39m�[22m�[49m: Actual:   2
  �[40m�[32minfo�[39m�[22m�[49m:    at System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(Labeled`1 labeled, Int32 requestedDop, Int32 expectedDop, Labeled`1 operation, ParallelExecutionMode mode)
  �[40m�[32minfo�[39m�[22m�[49m:    at System.Object.InvokeStub_PlinqModesTests.WithExecutionMode(Object , Span`1 )
  �[40m�[32minfo�[39m�[22m�[49m:    at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
Author: ilonatommy
Assignees: -
Labels:

arch-wasm, disabled-test, area-Build-mono, area-VM-threading-mono

Milestone: -

@SamMonoRT SamMonoRT removed untriaged New issue has not been triaged by the area owner area-Build-mono labels Sep 13, 2023
@SamMonoRT SamMonoRT added this to the 9.0.0 milestone Sep 13, 2023
@pavelsavara
Copy link
Member

Does this still happen after #94214 ?
If so, it would be good to find root cause.

@radekdoulik
Copy link
Member

radekdoulik commented Dec 20, 2023

The test fails with

  info: [2023-12-20T11:59:51.420Z] [STRT] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: ParallelEnumerable.Range, requestedDop: 4, expectedDop: 4, operation: TakeWhile+Select+ToArray, mode: Default)
  warn: [2023-12-20T11:59:51.443Z] [MONO] Process terminated. Assertion failed.
  warn: [2023-12-20T11:59:51.444Z] [MONO]    at System.Diagnostics.DebugProvider.Fail(String message, String detailMessage) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/DebugProvider.cs:line 22
           at System.Diagnostics.Debug.Fail(String message, String detailMessage) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Debug.cs:line 133
           at System.Diagnostics.Debug.Assert(Boolean condition, String message, String detailMessage) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Debug.cs:line 97
           at System.Diagnostics.Debug.Assert(Boolean condition) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Debug.cs:line 82
           at System.Linq.Parallel.TakeOrSkipWhileQueryOperator`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) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/TakeOrSkipWhileQueryOperator.cs:line 131
           at System.Linq.Parallel.TakeOrSkipWhileQueryOperator`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) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/TakeOrSkipWhileQueryOperator.cs:line 123
           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) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/UnaryQueryOperator.cs:line 161
           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) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/ScanQueryOperator.cs:line 135
           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) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/UnaryQueryOperator.cs:line 130
           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) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/UnaryQueryOperator.cs:line 130
           at System.Linq.Parallel.QueryOperator`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecuteAndGetResultsAsArray() in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/QueryOperator.cs:line 237
           at System.Linq.ParallelEnumerable.ToArray[Int32](ParallelQuery`1 source) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs:line 4822
           at System.Linq.Parallel.Tests.PlinqModesTests.<>c.<EasyUnorderedQueries>b__0_0(UsedTaskTracker verifier, ParallelQuery`1 query) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/tests/PlinqModesTests.cs:line 16
           at System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(Labeled`1 labeled, Int32 requestedDop, Int32 expectedDop, Labeled`1 operation, ParallelExecutionMode mode) in /Users/rodo/git/threads-runtime/src/libraries/System.Linq.Parallel/tests/PlinqModesTests.cs:line 148
           at System.Object.InvokeStub_PlinqModesTests.WithExecutionMode(Object , Span`1 )
           at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 221
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs:line 135
           at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBase.cs:line 56
           at Xunit.Sdk.TestInvoker`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].CallTestMethod(Object testClassInstance) in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 150
           at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_0.<<InvokeTestMethodAsync>b__1>d[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 269
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<<InvokeTestMethodAsync>b__1>d](<<InvokeTestMethodAsync>b__1>d& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_0[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].<InvokeTestMethodAsync>b__1()
           at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in /_/src/xunit.execution/Sdk/Frameworks/ExecutionTimer.cs:line 48
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<AggregateAsync>d__4](<AggregateAsync>d__4& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction)
           at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_0[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].<InvokeTestMethodAsync>b__0() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 242
           at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 90
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__9](<RunAsync>d__9& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code)
           at Xunit.Sdk.TestInvoker`1.<InvokeTestMethodAsync>d__48[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 241
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<InvokeTestMethodAsync>d__48](<InvokeTestMethodAsync>d__48& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestInvoker`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].InvokeTestMethodAsync(Object testClassInstance)
           at Xunit.Sdk.XunitTestInvoker.InvokeTestMethodAsync(Object testClassInstance) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestInvoker.cs:line 112
           at Xunit.Sdk.TestInvoker`1.<<RunAsync>b__47_0>d[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 206
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<<RunAsync>b__47_0>d](<<RunAsync>b__47_0>d& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestInvoker`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].<RunAsync>b__47_0()
           at Xunit.Sdk.ExceptionAggregator.<RunAsync>d__10`1[[System.Decimal, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 107
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__10`1](<RunAsync>d__10`1& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.ExceptionAggregator.RunAsync[Decimal](Func`1 code)
           at Xunit.Sdk.TestInvoker`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 189
           at Xunit.Sdk.XunitTestRunner.InvokeTestMethodAsync(ExceptionAggregator aggregator) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestRunner.cs:line 84
           at Xunit.Sdk.XunitTestRunner.InvokeTestAsync(ExceptionAggregator aggregator) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestRunner.cs:line 67
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<InvokeTestAsync>d__4](<InvokeTestAsync>d__4& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.XunitTestRunner.InvokeTestAsync(ExceptionAggregator aggregator)
           at Xunit.Sdk.TestRunner`1.<>c__DisplayClass43_0[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].<RunAsync>b__0() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestRunner.cs:line 149
           at Xunit.Sdk.ExceptionAggregator.<RunAsync>d__10`1[[System.Tuple`2[[System.Decimal, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 107
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__10`1](<RunAsync>d__10`1& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.ExceptionAggregator.RunAsync[Tuple`2](Func`1 code)
           at Xunit.Sdk.TestRunner`1.<RunAsync>d__43[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestRunner.cs:line 149
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__43](<RunAsync>d__43& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunAsync()
           at Xunit.Sdk.XunitTheoryTestCaseRunner.RunTestAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTheoryTestCaseRunner.cs:line 145
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunTestAsync>d__11](<RunTestAsync>d__11& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.XunitTheoryTestCaseRunner.RunTestAsync()
           at Xunit.Sdk.TestCaseRunner`1.<RunAsync>d__19[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestCaseRunner.cs:line 82
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__19](<RunAsync>d__19& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestCaseRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunAsync()
           at Xunit.Sdk.XunitTheoryTestCase.RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, Object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource) in /_/src/xunit.execution/Sdk/Frameworks/XunitTheoryTestCase.cs:line 51
           at Microsoft.DotNet.XUnitExtensions.SkippedTheoryTestCase.<>n__0(IMessageSink diagnosticMessageSink, IMessageBus messageBus, Object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
           at Microsoft.DotNet.XUnitExtensions.SkippedTheoryTestCase.RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, Object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource) in /_/src/Microsoft.DotNet.XUnitExtensions/src/SkippedTheoryTestCase.cs:line 29
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__2](<RunAsync>d__2& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Microsoft.DotNet.XUnitExtensions.SkippedTheoryTestCase.RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, Object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
           at Xunit.Sdk.XunitTestMethodRunner.RunTestCaseAsync(IXunitTestCase testCase) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestMethodRunner.cs:line 45
           at Xunit.Sdk.TestMethodRunner`1.<RunTestCasesAsync>d__32[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestMethodRunner.cs:line 136
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunTestCasesAsync>d__32](<RunTestCasesAsync>d__32& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestMethodRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunTestCasesAsync()
           at Xunit.Sdk.TestMethodRunner`1.<RunAsync>d__31[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestMethodRunner.cs:line 106
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__31](<RunAsync>d__31& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestMethodRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunAsync()
           at Xunit.Sdk.XunitTestClassRunner.RunTestMethodAsync(ITestMethod testMethod, IReflectionMethodInfo method, IEnumerable`1 testCases, Object[] constructorArguments) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestClassRunner.cs:line 168
           at Xunit.Sdk.TestClassRunner`1.<RunTestMethodsAsync>d__38[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestClassRunner.cs:line 213
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunTestMethodsAsync>d__38](<RunTestMethodsAsync>d__38& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestClassRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunTestMethodsAsync()
           at Xunit.Sdk.TestClassRunner`1.<RunAsync>d__37[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestClassRunner.cs:line 171
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__37](<RunAsync>d__37& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestClassRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunAsync()
           at Xunit.Sdk.XunitTestCollectionRunner.RunTestClassAsync(ITestClass testClass, IReflectionTypeInfo class, IEnumerable`1 testCases) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestCollectionRunner.cs:line 158
           at Xunit.Sdk.TestCollectionRunner`1.<RunTestClassesAsync>d__28[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestCollectionRunner.cs:line 130
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunTestClassesAsync>d__28](<RunTestClassesAsync>d__28& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestCollectionRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunTestClassesAsync()
           at Xunit.Sdk.TestCollectionRunner`1.<RunAsync>d__27[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestCollectionRunner.cs:line 101
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__27](<RunAsync>d__27& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestCollectionRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunAsync()
           at Xunit.Sdk.XunitTestAssemblyRunner.RunTestCollectionAsync(IMessageBus messageBus, ITestCollection testCollection, IEnumerable`1 testCases, CancellationTokenSource cancellationTokenSource) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestAssemblyRunner.cs:line 235
           at Xunit.Sdk.TestAssemblyRunner`1.<RunTestCollectionsAsync>d__42[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestAssemblyRunner.cs:line 231
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunTestCollectionsAsync>d__42](<RunTestCollectionsAsync>d__42& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestAssemblyRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunTestCollectionsAsync(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource)
           at Xunit.Sdk.XunitTestAssemblyRunner.<>n__0(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource)
           at Xunit.Sdk.XunitTestAssemblyRunner.RunTestCollectionsAsync(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestAssemblyRunner.cs:line 165
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunTestCollectionsAsync>d__14](<RunTestCollectionsAsync>d__14& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.XunitTestAssemblyRunner.RunTestCollectionsAsync(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource)
           at Xunit.Sdk.TestAssemblyRunner`1.<RunAsync>d__41[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestAssemblyRunner.cs:line 196
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__41](<RunAsync>d__41& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.TestAssemblyRunner`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunAsync()
           at Xunit.Sdk.XunitTestFrameworkExecutor.RunTestCases(IEnumerable`1 testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFrameworkExecutor.cs:line 95
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunTestCases>d__8](<RunTestCases>d__8& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Xunit.Sdk.XunitTestFrameworkExecutor.RunTestCases(IEnumerable`1 testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions)
           at Xunit.Sdk.TestFrameworkExecutor`1[[Xunit.Sdk.IXunitTestCase, xunit.core, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]].RunTests(IEnumerable`1 testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) in /_/src/xunit.execution/Sdk/Frameworks/TestFrameworkExecutor.cs:line 100
           at Xunit.Xunit2.RunTests(IEnumerable`1 testCases, IMessageSink messageSink, ITestFrameworkExecutionOptions executionOptions) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2.cs:line 110
           at TestFrameworkExtensions.RunTests(ITestFrameworkExecutor executor, IEnumerable`1 testCases, IMessageSinkWithTypes executionMessageSink, ITestFrameworkExecutionOptions executionOptions) in /_/src/xunit.runner.utility/Extensions/TestFrameworkExtensions.cs:line 69
           at Microsoft.DotNet.XHarness.TestRunners.Xunit.ThreadlessXunitTestRunner.Run(IEnumerable`1 testAssemblies)
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<Run>d__6](<Run>d__6& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Microsoft.DotNet.XHarness.TestRunners.Xunit.ThreadlessXunitTestRunner.Run(IEnumerable`1 testAssemblies)
           at Microsoft.DotNet.XHarness.TestRunners.Common.ApplicationEntryPoint.InternalRunAsync(LogWriter logger)
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<InternalRunAsync>d__38](<InternalRunAsync>d__38& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Microsoft.DotNet.XHarness.TestRunners.Common.ApplicationEntryPoint.InternalRunAsync(LogWriter logger)
           at Microsoft.DotNet.XHarness.TestRunners.Common.ApplicationEntryPoint.InternalRunAsync(ApplicationOptions options, TextWriter loggerWriter, TextWriter resultsFile)
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<InternalRunAsync>d__39](<InternalRunAsync>d__39& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Microsoft.DotNet.XHarness.TestRunners.Common.ApplicationEntryPoint.InternalRunAsync(ApplicationOptions options, TextWriter loggerWriter, TextWriter resultsFile)
           at Microsoft.DotNet.XHarness.TestRunners.Common.WasmApplicationEntryPointBase.RunAsync()
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<RunAsync>d__4](<RunAsync>d__4& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Microsoft.DotNet.XHarness.TestRunners.Common.WasmApplicationEntryPointBase.RunAsync()
           at Microsoft.DotNet.XHarness.TestRunners.Xunit.WasmApplicationEntryPoint.Run()
           at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<Run>d__28](<Run>d__28& stateMachine) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
           at Microsoft.DotNet.XHarness.TestRunners.Xunit.WasmApplicationEntryPoint.Run()
           at SimpleWasmTestRunner.Main(String[] args) in /Users/rodo/git/threads-runtime/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs:line 79
           at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[SimpleWasmTestRunner.<Main>d__0, WasmTestRunner, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].ExecutionContextCallback(Object s) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs:line 288
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs:line 179
           at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[SimpleWasmTestRunner.<Main>d__0, WasmTestRunner, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].MoveNext(Thread threadPoolThread) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs:line 368
           at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[SimpleWasmTestRunner.<Main>d__0, WasmTestRunner, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].MoveNext() in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs:line 346
           at System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.<>c.<System.Runtime.CompilerServices.IStateMachineBoxAwareAwaiter.AwaitUnsafeOnCompleted>b__5_0(Object s) in /Users/rodo/git/threads-runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/YieldAwaitable.cs:line 132
           at System.Runtime.InteropServices.JavaScript.JSSynchronizationContext.Pump() in /Users/rodo/git/threads-runtime/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSSynchronizationContext.cs:line 166
           at System.Runtime.InteropServices.JavaScript.JSSynchronizationContext.BackgroundJobHandler() in /Users/rodo/git/threads-runtime/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSSynchronizationContext.cs:line 150

At this assert:

            int partitionCount = inputStream.PartitionCount;
            if (ParallelEnumerable.SinglePartitionMode)
                Debug.Assert(partitionCount == 1);

The issue here is that the ParallelEnumerable.SinglePartitionMode is true, while it should not be.

This is result of FEATURE_WASM_THREADS not being defined.

The draft #96215 fixes this. The PLinq doesn't build yet through, as there are missing pieces. Let try to complete these in the draft.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jan 11, 2024
radekdoulik added a commit that referenced this issue Jan 11, 2024
Add System.Threading.WebAssembly.Threading ref assembly to enable more parts of threading API on wasm
Fix System.Linq.Parallel assembly to work as MT on wasm
Increase the initial thread pool size to 7 to let the System.Linq.Parallel tests pass

Fixes #91661

* [wasm] Enable more MT PLinq areas

Also fix the csproj condition to detect FeatureWasmThreads

* Add missing pieces

* Add System.Threading.WebAssembly.Threading.csproj

* Fix System.Threading to work with the new wasm MT ref assembly

* Enable the failing test

* Use the new ref assembly in the System.Linq.Parallel

* Remove now obsolete API check supressions

* Increase the thread pool size to make the plinq tests pass

* Add API check suppressions for System.Threading

* Always use the API suppressions for System.Threading

* Remove unwanted attributes from the implementation

* Add suppressions to corelib

* Revert "Remove unwanted attributes from the implementation"

This reverts commit aedafd3.

* Build fixes

* Remove unnecessary suppression

* Remove unwanted source file from the list
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jan 11, 2024
tmds pushed a commit to tmds/runtime that referenced this issue Jan 23, 2024
Add System.Threading.WebAssembly.Threading ref assembly to enable more parts of threading API on wasm
Fix System.Linq.Parallel assembly to work as MT on wasm
Increase the initial thread pool size to 7 to let the System.Linq.Parallel tests pass

Fixes dotnet#91661

* [wasm] Enable more MT PLinq areas

Also fix the csproj condition to detect FeatureWasmThreads

* Add missing pieces

* Add System.Threading.WebAssembly.Threading.csproj

* Fix System.Threading to work with the new wasm MT ref assembly

* Enable the failing test

* Use the new ref assembly in the System.Linq.Parallel

* Remove now obsolete API check supressions

* Increase the thread pool size to make the plinq tests pass

* Add API check suppressions for System.Threading

* Always use the API suppressions for System.Threading

* Remove unwanted attributes from the implementation

* Add suppressions to corelib

* Revert "Remove unwanted attributes from the implementation"

This reverts commit aedafd3.

* Build fixes

* Remove unnecessary suppression

* Remove unwanted source file from the list
@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 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 disabled-test The test is disabled in source code against the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants