Bug 13929 - HttpListener can't process more than 2 requests in parallel
Summary: HttpListener can't process more than 2 requests in parallel
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-08-12 15:34 UTC by Dmitry
Modified: 2013-08-12 15:34 UTC (History)
1 user (show)

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


Attachments
Tests (4.53 KB, text/x-csharp)
2013-08-12 15:34 UTC, Dmitry
Details

Description Dmitry 2013-08-12 15:34:06 UTC
Created attachment 4612 [details]
Tests

I faced with problem in multi-thread http requests processing with HttpListener. Looks like httpListener.BeginGetContext(_handleRequestCallback, null) can't process more than 2 requests in parallel. In attachments you can find a test (it requires Nunit and log4net to run). With SyncTest all works as expected. In AsyncTest I see that httpListener doesn't call _handleRequestCallback more than 2 times in parallel. 3rd request start processing when any previous request is processed:
01:24:23,885 [(null)-40] INFO  Other.ListenerTest {(null)} - Received request:12
01:24:23,885 [(null)-39] INFO  Other.ListenerTest {(null)} - Received request:5
01:24:24,400 [(null)-39] INFO  Other.ListenerTest {(null)} - Sent response for:5
01:24:24,400 [(null)-40] INFO  Other.ListenerTest {(null)} - Sent response for:12
01:24:24,413 [(null)-20] INFO  Other.ListenerTest {(null)} - Received response:5
01:24:24,414 [(null)-29] INFO  Other.ListenerTest {(null)} - Received response:12
01:24:24,414 [(null)-54] INFO  Other.ListenerTest {(null)} - Received request:0
01:24:24,414 [(null)-53] INFO  Other.ListenerTest {(null)} - Received request:15
...

I ran the same code (but without log4net) on MS .Net and see what I expect:
01:38:40:660 Received request:18
01:38:40:660 Received request:1
01:38:40:660 Received request:0
01:38:40:660 Received request:2
01:38:40:660 Received request:3
....

Note You need to log in before you can comment on or make changes to this bug.