Bug 4576 - WebRequest fails during monodevelop debug but not on command line.
Summary: WebRequest fails during monodevelop debug but not on command line.
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-04-21 04:35 UTC by jd
Modified: 2017-07-11 23:06 UTC (History)
5 users (show)

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

Code snippet that fails. (373 bytes, text/plain)
2012-04-21 04:35 UTC, jd

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 GitHub or Developer Community 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 jd 2012-04-21 04:35:20 UTC
Created attachment 1720 [details]
Code snippet that fails.

During a debug session in MonoDevelop (and a "The Request timed out" WebException is thrown. This does not happen if:

1. The debug executable is run from the command line.
2. The .NET runtimes are switched to Microsoft .NET

Mono version: 2.10.8.
Platform: Windows 7 64-bit
Comment 1 jd 2012-04-21 05:50:12 UTC
A little more info:

Still present using:
- MonoDevelop 2.9.4 (alpha).
- Mono 2.11 runtimes.

It looks like (in mono 2.10.4) the eventual timeout occurs because a WaitHandle times out, however, internally this is reported by WaitOne_internal, WaitHandle.cs:376, which can only return false if the wait failed or timed out. The timeout the default timeout is 10 seconds and WaitOne_internal returns immediately. (See https://github.com/mono/mono/blob/ee240bb13a20510bd4398251046324a8a44e3c3c/mono/metadata/threads.c#L1669)

Seems like the wait is failing.
Comment 2 jd 2012-04-21 12:24:10 UTC
This bug does not present on Ubuntu 10.04, Monodevelop 2.8.6, Mono 2.10.8.
Comment 3 jd 2012-04-22 01:22:17 UTC
This bug does not present on Ubuntu 10.04, Monodevelop 2.8.6, Mono 2.10.8.
Comment 4 Jeffrey Stedfast 2012-04-22 15:23:53 UTC
Sounds like this bug has been fixed in newer versions of Mono then
Comment 5 jd 2012-04-26 06:56:42 UTC
I probably wasn't being clear. It seems it's ONLY a windows bug, it didn't show up in the Linux versions I mentioned above. I still saw it using Windows Monodevelop 2.9.4/Mono 2.11.

Or maybe you're talking about something else.

Per my Comment 1, it does appear that the WaitOne_internal call (used in WaitHandle) does fall through with a WAIT_IO_COMPLETE, though the APC it launches (WebConnection.cs - InitConnection) doesn't complete.

I'm looking a little further into it. I'd kick this to a Mono bug but it only seems to appear during MonoDevelop debug session.
Comment 6 Mikayla Hutchinson [MSFT] 2012-04-26 13:36:09 UTC
Sounds like the soft debugger interrupt code and the io-layer aren't getting on well on Windows.
Comment 7 jd 2012-04-27 14:35:59 UTC
Ya, I was thinking something like that. Any hints as to where to start digging around on that one?
Comment 8 Rodrigo Kumpera 2017-07-11 23:06:15 UTC
The io-layer and abort code were rewritten since this bug was reported.

Please reopen it if it still happens with a recent version of mono