[Mono-bugs] [Bug 690357] New: WebClient and SOAP calls lock up in MonoTouch 4.0.0 and 4.0.1. Works in 3.2.6. Prevents my app from being shipped
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Apr 27 15:42:17 EDT 2011
https://bugzilla.novell.com/show_bug.cgi?id=690357
https://bugzilla.novell.com/show_bug.cgi?id=690357#c0
Summary: WebClient and SOAP calls lock up in MonoTouch 4.0.0
and 4.0.1. Works in 3.2.6. Prevents my app from being
shipped
Classification: Mono
Product: MonoTouch
Version: unspecified
Platform: iPad
OS/Version: Apple iOS 4.3
Status: NEW
Severity: Major
Priority: P5 - None
Component: Runtime
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: ibrainloop at brainloop.com
QAContact: mono-bugs at lists.ximian.com
Found By: Beta-Customer
Blocker: Yes
Created an attachment (id=426916)
--> (http://bugzilla.novell.com/attachment.cgi?id=426916)
A sample to demonstrate the issue
Description of Problem:
My app is making heavy use of webservice calls. Lately, some of the calls got
stuck. After playing around I figured out that it
* happens mostly for release builds
* happens in the Simulator AND on the device (iPad, iOS 4.3)
* happens more often on iPad 1 than on iPad 2
* it is not limited to web services an SOAP but also affects the
System.Net.WebClient
* does not affest [NSString stringWithContentsOfUrl:] if invoked manually,
since not bound
The effect is that the CPU load of the device drops to zero. memory is stable
(in my demo project 8.5MB). If I put Console.WriteLines() everywhere, I can see
that the code is stuck inside one of the WebClient.Download*() methods.
The code below demonstrates that (if built RELEASE with MT 4.0.1, LLVM off or
on does not matter) downloading a file from the web over and over again fails
sometimes right away on the first try, sometimes after 10 times, sometimes
after around 30 downloads. It is totally random. If you think it works, kill
the app and restart it and eventually it will hang.
When building the same using MT 3.2.6, the downloading goes on all day without
issues. It is impossible to break it.
MONO installed is the latest available version.
Actual Results:
Under 4.0.1 downloading stops after some retries.
Expected Results:
Downloads should go on forever.
How often does this happen?
Always.
Additional Information:
See attached code sample.
using System;
using System.IO;
using System.Threading;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace iOSTest
{
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args);
}
}
// The name AppDelegate is referenced in the MainWindow.xib file.
public partial class AppDelegate : UIApplicationDelegate
{
private Thread oThread;
// This method is invoked when the application has loaded its UI and
its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary
options)
{
// Make a release build and run on iPad 1 with iOS 4.3.2.
// Fails after downloading between 1 time and 30 times on MT 4.0.1.
// It is possible that it seems to work. Then just kill the app and
restart and suddenly the effect
// will become visible. If you watch it with Instruments, CPU
suddenly drops to zero. The app then is
// stuck somewhere inside WebClient. After about 10 minutes, an
exception will be thrown (timeout).
// Never fails on MT 3.2.6
Console.WriteLine(MonoTouch.Constants.Version);
// A label that counts how often we downloaded.
UILabel oLbl = new UILabel(new System.Drawing.RectangleF(40, 100,
150, 30));
window.AddSubview(oLbl);
// This thread downloads the same file over and over again.
// The thread is not required to demonstrate the issue. The same
problem occurs
// if the download is running on the main thread.
this.oThread = new Thread(delegate()
{
using(var oPool = new NSAutoreleasePool())
{
int i = 0;
while(true)
{
// Setup webclient and download a file from my website
(around 2.4 MB)
WebClient oClient = new WebClient();
oClient.DownloadFile(new
Uri("http://www.wildsau.net/image.axd?picture=2011%2f4%2fDSC05178.JPG"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
"test.jpg"));
// Increase counter and update label.
i++;
this.InvokeOnMainThread(delegate { oLbl.Text =
i.ToString(); });
Console.WriteLine("Done " + i + " times.");
}
}
});
// Have a button that starts the action.
UIButton oBtn = UIButton.FromType(UIButtonType.RoundedRect);
oBtn.SetTitle("Download", UIControlState.Normal);
oBtn.Frame = new System.Drawing.RectangleF(40, 40, 150, 30);
oBtn.TouchUpInside += delegate(object sender, System.EventArgs e)
{
this.oThread.Start();
};
window.AddSubview(oBtn);
window.MakeKeyAndVisible ();
return true;
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list