Bug 21477 - Mono's HttpClientHandler deadlocks in async contexts with automatic decompression enabled
Summary: Mono's HttpClientHandler deadlocks in async contexts with automatic decompres...
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.12.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2014-07-21 11:36 UTC by Mike Rousos
Modified: 2014-08-12 13:05 UTC (History)
2 users (show)

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

Repro project and parallel stacks screenshot (43.47 KB, application/x-zip-compressed)
2014-07-21 11:36 UTC, Mike Rousos

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 or GitHub 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 Mike Rousos 2014-07-21 11:36:30 UTC
Created attachment 7436 [details]
Repro project and parallel stacks screenshot

Making http requests from within asynchronous tasks is leading to deadlocks in Android apps when automatic decompression is enabled.

This causes deadlocks when using Azure Mobile Services, as they will implicitly use an http client with automatic decompression. To avoid deadlocks with AMS in async scenarios, it's necessary to specify an explicit HttpClientHandler without automatic decompression enabled.

The Visual Studio debugger gives very little information about async Android scenarios, but I've included a screenshot of the parallel stacks window while deadlocked in the repro zip attached.

I've also included a small project that reliably repro's the issue on an emulator running Android 4.0.3.
Comment 1 Parmendra Kumar 2014-07-24 14:35:49 UTC
I have checked this issue with Xamarin 3.1.224 and with given attached zip sample.
I observed that the deadlock is not generate and I am able to build application successfully. 

Could you please check this with latest stable build?  and let me know if you get same issue.


VS 2013
Xamarin 3.1.224

=== Xamarin Studio ===

Version 5.1.4 (build 0)
Installation UUID: 917f9508-3cad-494a-8fd9-cc9e3683ecc5
	Microsoft .NET 4.0.30319.34014
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

=== Xamarin.Android ===

Version: 4.12.6 (Business Edition)
Android SDK: D:\SDKndk\AndroidSDK\android-sdk
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: C:\Program Files\Java\jdk1.6.0_31
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode)

=== Build Information ===

Release ID: 501040000
Git revision: 7d45bbe2ee22625f125d0c52548524f02d005cca
Build date: 2014-07-14 13:38:46-04
Xamarin addins: c78f1d88e57baa928aeee1484d96e6f8edf8de33

=== Operating System ===

Windows 6.2.9200.0
Comment 2 Mike Rousos 2014-08-12 13:05:26 UTC
Thanks, Parmendra. Sorry to be so slow in getting back to you.

I updated to the latest build and the bug does appear to be fixed now. Thanks for investigating the issue and I'm glad to see it's been taken care of.