Bug 24852 - ObjectDisposedException at System.Net.WebConnection.EndWrite when using Basic auth
Summary: ObjectDisposedException at System.Net.WebConnection.EndWrite when using Basic...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-11-26 09:38 UTC by Tomek Romaniuk
Modified: 2014-11-26 09:40 UTC (History)
1 user (show)

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


Attachments
simple server with Basic auth (904 bytes, text/plain)
2014-11-26 09:38 UTC, Tomek Romaniuk
Details
steps to reproduce (2.57 KB, text/plain)
2014-11-26 09:40 UTC, Tomek Romaniuk
Details

Description Tomek Romaniuk 2014-11-26 09:38:08 UTC
Created attachment 8879 [details]
simple server with Basic auth

Overview:
Using HttpWebRequest to POST some data to a server from many threads with Basic authentication ends with System.ObjectDisposedException at System.Net.WebConnection.EndWrite.

Environment:
OS: Ubuntu 14.04, x64
Mono: 3.10.0 (tarball Wed Nov  5 12:50:04 UTC 2014)

Full stack trace:
System.AggregateException: One or more errors occurred ---> System.ObjectDisposedException: The object was used after being disposed.
  at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, Boolean throwOnError, IAsyncResult result) [0x00000] in <filename unknown>:0
  at System.Net.WebConnectionStream+<WriteRequestAsync>c__AnonStorey2.<>m__1 (IAsyncResult r) [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.WebResponse].GetResult () [0x00000] in <filename unknown>:0
  at SimpleServerClient.Program+<PostAsync>c__async0.MoveNext () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0
  at System.Threading.Tasks.Task.Wait () [0x00000] in <filename unknown>:0
  at SimpleServerClient.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
 --> (Inner exception 0) System.ObjectDisposedException: The object was used after being disposed.
  at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, Boolean throwOnError, IAsyncResult result) [0x00000] in <filename unknown>:0
  at System.Net.WebConnectionStream+<WriteRequestAsync>c__AnonStorey2.<>m__1 (IAsyncResult r) [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.WebResponse].GetResult () [0x00000] in <filename unknown>:0
  at SimpleServerClient.Program+<PostAsync>c__async0.MoveNext () [0x00000] in <filename unknown>:0


Steps to reproduce:
- Run simple_server.py (see attachments) or any HTTP server with Basic auth
- Run Client.cs (see attachments) to POST some data from many threads

Observations:
- Exception happens ~ 1 on 10 requests and only when using more then one thread so I suspect is related with concurrency.
- Can't be reproduced after setting request.PreAuthenticate = true;
- Can't be reproduced after disabling Basic authentication
Comment 1 Tomek Romaniuk 2014-11-26 09:40:48 UTC
Created attachment 8880 [details]
steps to reproduce

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