Bug 54059 - Sporadic objectDisposed exception in client http POST request
Summary: Sporadic objectDisposed exception in client http POST request
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 4.8.0 (C9)
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-03-27 14:41 UTC by Béla Klotz
Modified: 2017-07-26 05:49 UTC (History)
2 users (show)

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


Attachments
sample-client-server (10.02 KB, application/x-compressed)
2017-03-27 14:41 UTC, Béla Klotz
Details


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 54059 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:
Status:
NEW

Description Béla Klotz 2017-03-27 14:41:39 UTC
Created attachment 20899 [details]
sample-client-server

We have updated to mono 4.4.2.11 (but the problem exists also in 4.8.0.495 and even in mono 2.10.8, but in that old version occurs very ralely) and faced a strange exception on client side when POSTing request, The post request ends properly on server side, but on client a strange exception is thrown (attached the demo server and client, problem is visible even using one thread, but not reproduceable running on microsoft .NET, so its maybe time to adapt the reference code)
mono WebClient.exe 1 2
Start threads:1
Failed:1, Succeed:403, Exception:System.Net.WebException: An exception occurred during a WebClient request. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
  at System.Net.WebConnectionStream.EndWrite (System.IAsyncResult r) [0x000af] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebConnectionStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x00059] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient+UploadBitsState.WriteBytes () [0x0017a] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadBits (System.Net.WebRequest request, System.IO.Stream readStream, System.Byte[] buffer, System.Int32 chunkSize, System.Byte[] header, System.Byte[] footer, System.Net.CompletionDelegate uploadCompletionDelegate, System.Net.CompletionDelegate downloadCompletionDelegate, System.ComponentModel.AsyncOperation asyncOp) [0x0006f] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadDataInternal (System.Uri address, System.String method, System.Byte[] data, System.Net.WebRequest& request) [0x0002e] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
   --- End of inner exception stack trace ---
  at System.Net.WebClient.UploadDataInternal (System.Uri address, System.String method, System.Byte[] data, System.Net.WebRequest& request) [0x000a6] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadString (System.Uri address, System.String method, System.String data) [0x00054] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadString (System.String address, System.String data) [0x00019] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at (wrapper remoting-invoke-with-check) System.Net.WebClient:UploadString (string,string)
  at MyWebClient.MyWebClient.WebClientPost (System.String url, System.String data) [0x00008] in <6164c46a8bb64c29b00119162cb9bff2>:0 
  at MyWebClient.MultiClient.Start () [0x00033] in <6164c46a8bb64c29b00119162cb9bff2>:0 
Failed:2, Succeed:705, Exception:System.Net.WebException: An exception occurred during a WebClient request. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
  at System.Net.WebConnectionStream.EndWrite (System.IAsyncResult r) [0x000af] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebConnectionStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x00059] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient+UploadBitsState.WriteBytes () [0x0017a] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadBits (System.Net.WebRequest request, System.IO.Stream readStream, System.Byte[] buffer, System.Int32 chunkSize, System.Byte[] header, System.Byte[] footer, System.Net.CompletionDelegate uploadCompletionDelegate, System.Net.CompletionDelegate downloadCompletionDelegate, System.ComponentModel.AsyncOperation asyncOp) [0x0006f] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadDataInternal (System.Uri address, System.String method, System.Byte[] data, System.Net.WebRequest& request) [0x0002e] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
   --- End of inner exception stack trace ---
  at System.Net.WebClient.UploadDataInternal (System.Uri address, System.String method, System.Byte[] data, System.Net.WebRequest& request) [0x000a6] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadString (System.Uri address, System.String method, System.String data) [0x00054] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadString (System.String address, System.String data) [0x00019] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at (wrapper remoting-invoke-with-check) System.Net.WebClient:UploadString (string,string)
  at MyWebClient.MyWebClient.WebClientPost (System.String url, System.String data) [0x00008] in <6164c46a8bb64c29b00119162cb9bff2>:0 
  at MyWebClient.MultiClient.Start () [0x00033] in <6164c46a8bb64c29b00119162cb9bff2>:0 
Failed:3, Succeed:1209, Exception:System.Net.WebException: An exception occurred during a WebClient request. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
  at System.Net.WebConnection.BeginWrite (System.Net.HttpWebRequest request, System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.AsyncCallback cb, System.Object state) [0x0002e] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebConnectionStream.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.AsyncCallback cb, System.Object state) [0x00258] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
   --- End of inner exception stack trace ---
  at System.Net.WebClient.UploadDataInternal (System.Uri address, System.String method, System.Byte[] data, System.Net.WebRequest& request) [0x000a6] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadString (System.Uri address, System.String method, System.String data) [0x00054] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at System.Net.WebClient.UploadString (System.String address, System.String data) [0x00019] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at (wrapper remoting-invoke-with-check) System.Net.WebClient:UploadString (string,string)
  at MyWebClient.MyWebClient.WebClientPost (System.String url, System.String data) [0x00008] in <6164c46a8bb64c29b00119162cb9bff2>:0 
  at MyWebClient.MultiClient.Start () [0x00033] in <6164c46a8bb64c29b00119162cb9bff2>:0
Comment 1 msv_box 2017-07-26 05:49:34 UTC
This problem still persists in 5.0.1.1 (Mono JIT compiler version 5.0.1.1 (2017-02/5077205 Thu May 25 09:19:18 UTC 2017)).