Bug 49846 - Deadlock in AsyncManager.Run
Summary: Deadlock in AsyncManager.Run
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.3.0 (C9)
Hardware: PC Mac OS
: High normal
Target Milestone: 4.3.0 (C9)
Assignee: Bugzilla
URL:
Depends on:
Blocks: 51580
  Show dependency tree
 
Reported: 2016-12-13 16:29 UTC by Alan McGovern
Modified: 2017-02-21 20:54 UTC (History)
6 users (show)

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

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 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:
Status:
VERIFIED FIXED

Description Alan McGovern 2016-12-13 16:29:16 UTC
This code in MonoAndroidFlavouredProject is deadlock prone:

> try
> {
> 	AsyncManager.Run (designerProject.DisposeAsync);
> }
> catch (Exception e)
> {
> 	tracer.Error(e, e.Message);
> }

AsyncManager is not doing what we think. It is blocking the main loop, thus preventing tasks from being able to complete if they need to sync to the main thread for whatever reason. The result is a deadlock.

An example of the deadlock is: https://gist.github.com/alanmcgovern/77e16acf64ca7629332139296a804eb6
Comment 1 Daniel Cazzulino 2016-12-14 04:14:35 UTC
The stack trace is useful, but I'd appreciate some repro steps. It seems DisposeDesignerProject is being called right after a CreateProject, so I assume there's an active Android designer session and you're creating another new project while it's open? Does it matter what kind of new project it is?

tnx
Comment 2 xamarin-release-manager 2016-12-15 20:55:18 UTC
Fixed in version 4.3.0.485 (cycle9)

Author: jmt
Commit: f18ef199b768479ba936908ba82d24b9ade032b1 (xamarin/XamarinVS)
Comment 3 Shruti 2017-02-02 08:03:46 UTC
Hey @Alan,

It would be great If you check this issue at your end. As per comment2 this issue does not exist any more.

Thanks