Bug 523 - WebClient locks up under load on iPad 1
Summary: WebClient locks up under load on iPad 1
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 4.x
Hardware: Macintosh Mac OS
: High major
Target Milestone: 6.4.x (post async)
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2011-08-29 11:49 UTC by ric3kg
Modified: 2013-07-15 09:45 UTC (History)
7 users (show)

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:

Description ric3kg 2011-08-29 11:49:01 UTC
The following code locks up/freezes when run on iPad 1 with heavy download load. The thread just stops responding and 5 minutes later throws timeout error. Server logs indicate the device stops sending requests.

public void GetFile(string fileName, string url)
				Timer timer = new Timer(SafetyValve);
				WriteLog("GetFile: "+fileName+" at url: "+url);
				Console.WriteLine("GetFile: "+fileName+" at url: "+url);
		       	WebClient wc = new WebClient();
                Uri uri = new Uri(url);
				timer.Change (0, 500); // Trigger it now and every 500ms
                byte[] bytes = wc.DownloadData(uri);
				timer.Change (Timeout.Infinite, Timeout.Infinite);
				string path = Path.Combine(tmpPath, fileName);
                File.WriteAllBytes(path, bytes);
			catch(Exception ex)
				Console.WriteLine("Error in GetFile "+ex.ToString());
				WriteLog("Error in GetFile "+ex.ToString());

static void SafetyValve(object state)
			//Do nothing
//			Console.WriteLine("SafetyValve fired");

Compiled with MT 4.0.6.
Comment 1 Gonzalo Paniagua Javier 2011-08-29 14:00:16 UTC
To whoever takes care of this bug: the 'Timer' related code in this sample is a workaround for the threadpool bug I fixed. My guess is that once the fix is released this problem will go away, but I can't test this.
Comment 2 Miguel de Icaza [MSFT] 2011-08-29 19:21:14 UTC
What version of MonoTouch are you using? 

We release an update that fixes this problem.
Comment 3 ric3kg 2011-08-29 19:24:50 UTC
Comment 4 René Ruppert 2011-12-12 18:27:26 UTC
Has this bug been reintroduced? I'm experiencing problems with large downloads in 5.0.1. It gets stuck on the device and times out.  It worked in later MT 4 versions.
I would like to try the timer workaround, but how exactly does it work?
Comment 5 René Ruppert 2012-01-23 03:35:08 UTC
The project attached to this bug: http://bugzilla.xamarin.com/show_bug.cgi?id=2843 has a full test case for the FaultException.
Comment 6 Miguel de Icaza [MSFT] 2012-01-23 16:00:16 UTC
Rolf would you mind taking a look a tthis?
Comment 7 Rolf Bjarne Kvinge [MSFT] 2012-01-30 09:23:09 UTC
René: are your comment #4 for this bug or for bug #2859?

And for this bug, are you downloading data just like the original bug reporter (WebClient.DownloadData), or are you using some other methods?
Comment 8 René Ruppert 2012-01-30 09:37:04 UTC
My comment 4 here is for this bug. Comment 5 however does not make a lot of sense. This should not be here and belongs to bug 2859. I copied it there.
Comment 9 Rolf Bjarne Kvinge [MSFT] 2012-02-01 05:52:13 UTC
René: are you downloading data just like the original bug reporter (WebClient.DownloadData), or are you using some other methods?
Comment 10 René Ruppert 2012-02-01 06:07:49 UTC
I am using Webservices 2.0 (SOAP) with an async call to download Base64 encoded XML.
Comment 12 PJ 2013-07-09 03:03:30 UTC
Hi ric3kg, Rene, it looks like you answered all the questions way back when for this bug - sorry we never got to the bottom of it. We're cleaning things up a bit
and at this point we might need an update. 

It looks like there was a fix from Gonzalo back in comment 1 that has been released since. Have you been able to reproduce in any recent MonoTouch (Xamarin.iOS) build?

In the interest of bugzilla sanity,
if we can't make forward progress here I will end up marking it as resolved
during the next release cycle.

Moving milestone to 6.4.x
Comment 13 René Ruppert 2013-07-15 07:02:13 UTC
To my knowledge, this issue has been resolved long ago.
Comment 14 Rolf Bjarne Kvinge [MSFT] 2013-07-15 09:45:32 UTC
Closing this then. Feel free to reopen if it still occurs.