Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 for Bug 51189 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 19066 [details]
We can deadlock Mono launching a few HttpWebRequests. We can consistently reproduce in our app, but only sometimes happens in the attached program.
We initially detected this on a server pulling data from Azure. It deadlocks and it is unable to handle a single new request (since we rely on Socket.BeginReceive for that, and the callback is never invoked once the deadlock happens).
We suspect it could still be related to this ancient issue: http://www.mono-project.com/archived/articlethreadpool_deadlocks/
I have attached a small sample application to reproduce the issue. It occasionally deadlocks on Mono 18.104.22.168 / 22.214.171.1245 no matter whether the machine has 1 core or 8. What is consistent is that it performs worse than expected and fails. Not sure if this is a hint.
What the app does is:
* It launches 40 HttpWebRequest.GetResponse() in parallel.
* Most of them fail ("The authentication or decryption has failed.", "The request timed out") .
* The program retries if they fail - and retries also fail.
* Too high cpu usage (30% on my test box).
* We also tried the HttpClient class using async calls and no threadpool but result wasn't any better.
Some interesting notes:
* The same code works well in .NET/Windows.
* And launching the 40 concurrent requests is super fast there compared to super slow using Mono.
* It works better with mono-4.0.4 (it ends faster and without errors)
* Running mono with the '--server' flag doesn't make any difference.