Bug 41697 - AppleTLS and Managed HTTP Implementation cause HttpClient methods to hang
Summary: AppleTLS and Managed HTTP Implementation cause HttpClient methods to hang
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 9.8 (tvOS / C7)
Hardware: PC Mac OS
: High major
Target Milestone: C7SR0
Assignee: Martin Baulig
URL:
: 41830 ()
Depends on:
Blocks:
 
Reported: 2016-06-10 12:35 UTC by John Miller [MSFT]
Modified: 2016-06-20 06:04 UTC (History)
8 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 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:
Status:
VERIFIED FIXED

Description John Miller [MSFT] 2016-06-10 12:35:19 UTC
**Overview:**

   When using the AppleTLS and Managed Http Implementation settings in an iOS project, HttpClient methods hang for 60 seconds before finally working. (SendAsync, ReadAsStringAsync)

**Steps to Reproduce:**

  1. Run the attached private sample on an iOS Simulator
  2. Press the Do Request button

**Actual Results:**

   Once the following line executes, it seems to hang for 60 seconds before returning:

   > client.SendAsync(...)

**Expected Results:**

   SendAsync should return relatively quickly, assuming proper internet connection. You can change the TLS back to the Mono implementation and it works OK. Or, you can change the Http Implementation to NSUrlSession (keeping AppleTLS) and it will work as expected. 

**Build Date & Platform:**

=== Xamarin Studio Enterprise ===

Version 6.0 (build 5174)
Installation UUID: e01c3049-a2d2-4e0a-aad8-afe6fb627c4d
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch-c7-baseline/5995f74) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000182

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.1.0.71 (Xamarin Enterprise)
Android SDK: /Users/johnmiller/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin Inspector ===

Version: 0.8.1.0
Hash: 95792d1
Branch: master
Build date: Thu May 12 22:20:04 UTC 2016

=== Apple Developer Tools ===

Xcode 7.3 (10183.3)
Build 7D175

=== Xamarin.iOS ===

Version: 9.8.0.323 (Xamarin Enterprise)
Hash: 39ebb77
Branch: cycle7
Build date: 2016-06-01 21:23:15-0400

=== Xamarin.Mac ===

Version: 2.8.0.323 (Xamarin Enterprise)

=== Build Information ===

Release ID: 600005174
Git revision: 694a75f040b7f2309bc43d4f78a3a6572ca898bf
Build date: 2016-06-01 17:28:08-04
Xamarin addins: 33f406fa2dcf214012c78cb846585f062b2e1d24
Build lane: monodevelop-lion-cycle7-baseline

=== Operating System ===

Mac OS X 10.11.2

=== Enabled user installed addins ===

Xamarin Inspector 0.8.1.0
Comment 3 Alex Soto [MSFT] 2016-06-11 07:14:42 UTC
I can report the hang described in comment #0 running this sample
Comment 4 Stefan Moonen 2016-06-13 09:26:08 UTC
I've noticed changing to NSUrlSession does not solve this issue in the project where the problem originally occurred. Changing back to Mono TLS does always "solve" the problem.
Comment 6 Matt Corley 2016-06-15 20:20:49 UTC
*** Bug 41830 has been marked as a duplicate of this bug. ***
Comment 7 Martin Baulig 2016-06-16 00:00:55 UTC
This is very likely a duplicate of #41206, which fixed a very nasty bug in AppleTls.  The test case is working fine for me with the build which fixed #41206.
Comment 8 Brendan Zagaeski (Xamarin Team, assistant) 2016-06-16 00:09:58 UTC
The candidate fix from Bug 41206, Comment 19 (as tested in development builds) also resolves this issue in my tests.  At first glance that does seem fairly sensible considering the summary of the fix for that bug: "[AppleTls]: Correctly handle large read/write sizes."

I will mark this bug as RESOLVED to set it up for further verification for the upcoming "Cycle 7 – Service Release 0" release.




## Preliminary verification

BAD:  Xamarin.iOS 9.8.0.323 (39ebb77) (Cycle 7)
GOOD: Xamarin.iOS 9.8.0.325 (1caf99d) (In-progress development build)