Bug 17546 - await Task.Delay seems to block the thread
Summary: await Task.Delay seems to block the thread
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-02-01 13:24 UTC by dzugaru
Modified: 2014-02-20 09:27 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Reproducing code (3.49 KB, text/plain)
2014-02-01 13:24 UTC, dzugaru

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description dzugaru 2014-02-01 13:24:10 UTC
Created attachment 5957 [details]
Reproducing code

Launching many concurrent tasks with await Task.Delay(...) exhaust ThreadPool instantly, as if it just did Thread.Sleep(..) inside ThreadPool thread. Microsoft .Net behaves right. My custom implementation using TaskCompletionSource and System.Timers.Timer works right. Tested in 3.2.3 on openSUSE and CentOS.
Comment 1 dzugaru 2014-02-01 13:26:06 UTC
Forgot to add, I'm using export MONO_THREADS_PER_CPU and --server key, so I've got 100 threads in ThreadPool - more than enough.
Comment 2 Marek Safar 2014-02-03 04:25:50 UTC
It works for me with mono master or mono 3.2.7
Comment 3 Christopher Probst 2014-02-20 09:27:34 UTC
I can confirm the bug running on OS X 10.9.1 using Mono 3.2.6. Using Timer works for me, too.