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 ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-08-12 15:34 UTC by Dmitry
Modified: 2013-08-12 15:34 UTC (History)
1 user (show)

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

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

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 for Bug 13929 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

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

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