[Mono-dev] The request timed out at HttpWebRequest.EndGetResponse

mrgreen xyznyc at rocketmail.com
Sat May 15 20:03:35 EDT 2010

I am having a devil of a time with requests made by my ASP.NET application
via HttpWebRequest.GetResponse (or WebClient.DownloadString, which clearly
uses HttpWebRequest under the hood).

The calls in question are simple. Here's an example:

private string _url = "http://www.sitemapxml.co.uk/sitemap.xml";
protected void Button2_Click(object sender, EventArgs e)
		using (WebClient webClient = new WebClient())
			string text = webClient.DownloadString(_url);
			this.mMessageLabel2.Text = text;
	catch (Exception ex)
		this.mMessageLabel2.Text = ex.ToString();

After a couple of days of testing this sample method, in my main app and in
a simple sample app, on a few different platforms, the result is:

1) On Windows/IIS, method succeeds in both main app and sample app.

2) On my openSUSE 11.2 test system (Pentium dual-core 1.80GHz, 1GB RAM),
method succeeds in sample app, fails in main app.

3) On hosted VPS (OpenVZ) running openSUSE 11.2, method succeeds in sample
app, fails in main app.

4) On shared web hosting platform (CentOS), method succeeds in both main app
and sample app.

I'm using Apache 2.2 (prefork, although I've also tested with both worker
and ITK - same results) on the openSUSE systems, and I've read and
implemented various mod_mono tuning suggestions for this issue
(MONO_THREADS_PER_CPU=2000, etc. - happy to discuss details but going for
overview first).

Clearly there is something different between my main app and my sample app.
The main app is moderately complex (reads data from database at startup,
tracks user session state, etc.). The sample app couldn't be simpler: one
page with three buttons to run methods like the one shown above.

I am guessing that resources used by my main app when loading the website
are depriving the HttpWebRequest object of resources it would need to make a
successful call.

However, it is interesting that the method above works even in the context
of my main app on the CentOS platform. I suspect this issue can (must?) be
resolved by tuning openSUSE and Apache.

So, in terms of how to approach debugging this, I can slowly add features
from my main app to my sample app, deploy on openSUSE at each step, and see
where the breaking point is. However, I'd rather not go down that road if I
can avoid it.

Can anybody give suggestions on how to tune openSUSE/Apache to resolve this?
Or perhaps on ways to measure or reduce resource consumption in my main app?
In top, I can see that Apache/system never consume a ton of RAM (max 150mb,
so around 850mb free - except when I set MPM to worker then RAM usage goes
way up).

View this message in context: http://mono.1490590.n4.nabble.com/The-request-timed-out-at-HttpWebRequest-EndGetResponse-tp2218213p2218213.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list