Commit Graph
90 Commits
Author SHA1 Message Date
Ludovic Henry 916abe5f57 [bcl] Restore ThreadPool number of threads configuration after each test 2014-10-23 11:00:47 -04:00
Ludovic Henry a142d922aa [threadpool] Fix deadlock/starvation of the thread pool
The issue was with the new heuristic of the thread pool which would not create new threads, leading to deadlock between dependent tasks.
The fix is to check if every worker threads are sleeping, waiting or joining, and if that's the case, then we create a new thread because we might be in the case where the tasks being currently run depends on one still being enqueued in the cq or one of the wsq.

The following tests would previously fail :

1) MonoTests.System.Threading.Tasks.TaskTests.DoubleWaitTest :   #1
  Expected: True
  But was:  False

at MonoTests.System.Threading.Tasks.TaskTests.<DoubleWaitTest>m__27 () [0x00077] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:800
at MonoTests.System.Threading.Tasks.ParallelTestHelper.Repeat (System.Action action, Int32 numRun) [0x00007] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs:48
at MonoTests.System.Threading.Tasks.TaskTests.DoubleWaitTest () [0x00000] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:790
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

2) MonoTests.System.Threading.Tasks.TaskTests.HideSchedulerTest :   #1
  Expected: True
  But was:  False

at MonoTests.System.Threading.Tasks.TaskTests.HideSchedulerTest () [0x0003d] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:1914
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

3) MonoTests.System.Threading.Tasks.TaskTests.WaitAll_TimeoutWithExceptionsAfter :   #1
  Expected: True
  But was:  False

at MonoTests.System.Threading.Tasks.TaskTests.WaitAll_TimeoutWithExceptionsAfter () [0x00070] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:317
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

4) MonoTests.System.Threading.Tasks.TaskTests.WaitAll_TimeoutWithExceptionsBefore :   #1
  Expected: True
  But was:  False

at MonoTests.System.Threading.Tasks.TaskTests.WaitAll_TimeoutWithExceptionsBefore () [0x00070] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:341
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

5) MonoTests.System.Threading.Tasks.TaskTests.WaitAnyTest :   #3
  Expected: not -1
  But was:  -1

at MonoTests.System.Threading.Tasks.TaskTests.<WaitAnyTest>m__0 () [0x00026] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:142
at MonoTests.System.Threading.Tasks.ParallelTestHelper.Repeat (System.Action action, Int32 numRun) [0x00007] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs:48
at MonoTests.System.Threading.Tasks.ParallelTestHelper.Repeat (System.Action action) [0x00000] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs:42
at MonoTests.System.Threading.Tasks.TaskTests.WaitAnyTest () [0x00000] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:128
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

6) MonoTests.System.Threading.Tasks.TaskTests.WaitChildTestCase :   #0b
  Expected: True
  But was:  False

at MonoTests.System.Threading.Tasks.TaskTests.<WaitChildTestCase>m__25 () [0x0006d] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:705
at MonoTests.System.Threading.Tasks.ParallelTestHelper.Repeat (System.Action action, Int32 numRun) [0x00007] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs:48
at MonoTests.System.Threading.Tasks.TaskTests.WaitChildTestCase () [0x00000] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:684
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

7) MonoTests.System.Threading.Tasks.TaskTests.WaitingForChildrenToComplete :   #3
  Expected: True
  But was:  False

at MonoTests.System.Threading.Tasks.TaskTests.WaitingForChildrenToComplete () [0x00048] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:734
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
2014-10-22 17:09:11 -04:00
Zoltan Varga bb86670c28 [bcl] Fix races in task tests. 2014-10-22 14:22:17 -04:00
Zoltan Varga 5a22dacd4e [bcl] Remove some verbose test output. 2014-10-06 14:56:32 -04:00
Marek Safar f39cc88e58 [corlib] Notify parent task when child task uses NotOnFaulted. Fixes #23594 2014-10-05 14:36:05 -04:00
Marek Safar ebcc2ee853 [corlib] Task never is CompletedSynchronously 2014-08-20 12:01:42 +02:00
Zoltan Varga 262ef7eb34 [bcl] Increase a timeout to fix a corlib+llvm test failure. 2014-07-17 23:15:49 +02:00
Zoltan Varga cd35ca1fe9 [bcl] Fix a race in a Task test. Fixes #20921. 2014-07-12 00:31:47 +02:00
Alex Rønne Petersen 4d59f61b23 Revert "[corlib] Re-enable TaskContinuationChainLeak test."
This reverts commit 265060cc22.

The test is still failing:

2) MonoTests.System.Threading.Tasks.TaskTests.TaskContinuationChainLeak :   Expected: False
  But was:  True

at MonoTests.System.Threading.Tasks.TaskTests+TaskContinuationChainLeakTester.Verify () [0x00000] in /var/lib/jenkins/workspace/Mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:1991
at MonoTests.System.Threading.Tasks.TaskTests.TaskContinuationChainLeak () [0x00022] in /var/lib/jenkins/workspace/Mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:1948
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /var/lib/jenkins/workspace/Mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
2014-07-03 05:54:01 +02:00
Alex Rønne Petersen 265060cc22 [corlib] Re-enable TaskContinuationChainLeak test.
This is hopefully fixed after a57fb5b.
2014-07-01 21:53:56 +02:00
Alex Rønne Petersen 1633666e82 [corlib] Disable TaskContinuationChainLeak test on non-mobile too. 2014-06-23 14:11:40 +02:00
Marek Safar aad8d4924b [corlib] Disable test 2014-05-27 18:14:27 +02:00
Marek Safar a10df86558 [corlib] Better checks for release of parent task 2014-04-08 15:31:53 +02:00
BrandonLWhite 5e5f3a19fd Fixed memory leak in Task when child tasks are continually created.
This resolves bug # 18398 and other OOM scenarios in long running applications that make use of FromAsync, ContinueWith, etc. to "rearm" asynchronous operations.
2014-04-08 15:31:52 +02:00
Marek Safar c52a372c78 [corlib] Set test failure when test hangs 2014-04-07 19:22:17 +02:00
Rodrigo Kumpera 51d2b75664 [corlib] Fix 4.0 test suite compilation. 2014-02-12 18:53:10 -05:00
Marek Safar 1383b1834d [corlib] Better recovery when tasks run on broken scheduler 2014-02-06 18:08:37 +01:00
Marek Safar e83bf13866 [corlib] Mark all promise-style task exceptions observed. Fixes #17015 2014-01-06 17:52:19 +01:00
Marek Safar a2850fc7da Merge pull request #799 from kebby/master
Task.WhenAllCore<T> now handles empty argument list correctly. Fixes #15956
2013-11-12 00:38:48 -08:00
Tammo 'kb' Hinrichs a3bf4b4356 Added tests for Task.WhenAll w/ empty list 2013-11-06 15:55:32 +01:00
Marek Safar cf2ac2171b Make Task.Delay more reliable. Fixes #14585 2013-10-08 10:16:19 +02:00
Marek Safar 20aaf27c90 Fixes scheduling of non-inlined sychronous continuations. 2013-07-16 10:00:15 +02:00
Marek Safar 8b7cf63dd3 Implement Task::AsyncWaitHandle. Fixes #12342 2013-05-23 11:11:25 +02:00
Marek Safar 146a289d36 Fix failing test 2013-02-18 11:48:39 +01:00
Marek Safar d6af35c68f Fix more mobile tests 2013-02-12 20:02:07 +01:00
Marek Safar c1437f237f Fix TaskCreationOptions.AttachedToParent to avoid NRE on TaskCreationOptions.DenyChildAttach and deadlock on Wait 2013-02-12 14:25:58 +01:00
Marek Safar 65518ad2ca RunSynchronously cannot be used with continuation 2013-02-12 14:25:58 +01:00
Zoltan Varga b5afc5a2ae Fix up class library test so they at least compile when running make check in runtime/. Add a 'test' target to compile them. 2012-10-18 16:02:19 +02:00
Jeremie Laval 5877a9423b [corlib] Honor LazyCancellation flag 2012-09-24 12:28:25 +01:00
Jeremie Laval 2de1ee29c8 [corlib] Honor HideScheduler flag 2012-09-24 11:47:06 +01:00
Jeremie Laval 2ce078ba52 [corlib] Honor DenyChildAttach flag 2012-09-24 11:21:45 +01:00
Jeremie Laval 0b5eddeaff [corlib] Make Task.Run specify TaskScheduler.Default and fix Task.Run (Task<Task>) 2012-09-24 11:11:46 +01:00
Marek Safar f93ac4c461 Bump DoubleWaitTest timeout 2012-06-26 13:57:55 +01:00
Marek Safar c0b3d91a9a Improve task test 2012-06-11 12:11:35 +01:00
Jeremie Laval c0e097203a [corlib] Fix DoubleWait unit test 2012-06-01 13:22:42 +01:00
Marek Safar 455b845157 Fix scheduling of inlined tasks. 2012-05-30 12:08:08 +01:00
Marek Safar 1e3f458c21 Add another Task test 2012-05-29 16:13:45 +01:00
Marek Safar 46dacaa4cb Bump test timeout 2012-04-23 17:06:43 +01:00
Marek Safar c23a7f49d1 Fix task delay tests 2012-04-20 16:12:41 +01:00
Marek Safar 91fd88ea6d Increase timeout for some task tests 2012-04-16 17:49:38 +01:00
Jeremie Laval fa8a7b41b8 Fix Task child waiting for RunSynchronously 2012-04-16 12:38:00 +01:00
Jeremie Laval 366aa16f08 Don't overwrite the current variable without first saving its value in case a Task is executed inline inside another task 2012-04-13 20:11:03 +01:00
Jeremie Laval a3ed8990eb Correctly propagate faulted status and exception from child to parent in attached case 2012-04-13 17:25:48 +01:00
Marek Safar 5b9a3f9e9a Remove unused parameter 2012-04-11 10:01:17 +01:00
Marek Safar 4a09ddbf31 Implement Task::LongRunning option 2012-04-11 09:53:43 +01:00
Jeremie Laval 6db76648fb Add unit test for bug #2007 2012-04-10 14:24:45 +01:00
Jeremie Laval a9d60b1175 Do not execute a Task continuation when it has already been canceled externally 2012-04-10 12:39:03 +01:00
Jeremie Laval d878721e31 Refactor TaskTests.WaitChildTestCase test 2012-04-10 12:39:02 +01:00
Marek Safar 35ca4a994f Implement more Task 4.5 members 2012-04-05 11:21:42 +01:00
Marek Safar 40c3a4c5f2 Implement Task::WhenAll 2012-04-04 10:38:20 +01:00