[Mono-bugs] [Bug 698675] New: Can not make repeated POST requests with HttpWebRequest

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jun 7 20:11:31 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=698675

https://bugzilla.novell.com/show_bug.cgi?id=698675#c0


           Summary: Can not make repeated POST requests with
                    HttpWebRequest
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.10.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: andrew at syncplicity.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7)
AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Safari/534.24

I'm currently experiencing problems with POSTs made with HttpWebRequest.

The attached zip has two programs:
1 - A "hello world" web server
2 - A program that starts a thread per core. Each thread POSTs to the dummy web
server.

On Windows + .Net, these programs run fine without crashing.

In contrast, on Mono 2.10.2, ReproducePOSTCrash becomes unresponsive after
about 600 POSTs. (I'm on a Macbook Pro, Quad Core.)

The actual behavior changes depending on the version of Mono and a few other
tweaks to ReproducePOSTCrash/Main.cs:

Mono 2.10.2: Set line 17 to NumThreads = 1; crashes
Mono 2.10.2: Set line 96 to request.KeepAlive = false; crashes

Mono 2.10.1: When run as-is, runs for about 4-5 times as long as when running
under 2.10.2
Mono 2.10.1: Set line 96 to request.KeepAlive = false; Doesn't Crash!

Mono 2.8: When run as-is, runs about 16 times as long as 2.10.2
Mono 2.8: Set line 17 to NumThreads = 1; Doesn't Crash!


Reproducible: Always

Steps to Reproduce:
1. Build the attached solution
2. In one terminal, start DummyServer.exe. (Note that on Windows you'll need to
grant permission to bind to http://*:1134/)
3. In another terminal, start ReproducePOSTCrash.exe
Actual Results:  
ReproducePOSTCrash.exe hangs

Expected Results:  
ReproducePOSTCrash.exe should run forever and ever and ever

I started writing this program because we're seeing crashes with the following
stack trace in our Mac Client application that uses Mono 2.8:

at System.Net.WebConnection.EndWrite2 (System.Net.HttpWebRequest request,
IAsyncResult result) [0x00000] in <filename unknown>:0 
at System.Net.WebConnectionStream.EndWrite (IAsyncResult r) [0x00000] in
<filename unknown>:0 

It appears that there's a race condition in System.Net.WebConnection.EndWrite2
that's triggered because WebConnectionStream.Write calls EndWrite from two
different threads.

In 2.8, System.Net.WebConnection.EndWrite2, the if (completed) return;
completed = true is probably why our application is crashing. This clause
either needs to run within a lock; or needs to be replaced with using
Interlocked.CompareExchange.

-- 
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