Bug 23641 - SocketAsyncEventArgs.DispatcherCB throw Unhandled Exception
Summary: SocketAsyncEventArgs.DispatcherCB throw Unhandled Exception
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-10-06 08:53 UTC by henry
Modified: 2014-10-06 09:50 UTC (History)
1 user (show)

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

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 23641 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 henry 2014-10-06 08:53:48 UTC
use SocketAsyncEventArgs create socket server,When the performance test throws Unhandled Exception
Unhandled Exception:
System.InvalidOperationException: EndSend can only be called once per asynchronous operation
  at System.Net.Sockets.Socket.EndSend (IAsyncResult asyncResult, System.Net.Sockets.SocketError& errorCode) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket.EndSend (IAsyncResult result) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.SocketAsyncEventArgs.SendCallback (IAsyncResult ares) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.SocketAsyncEventArgs.DispatcherCB (IAsyncResult ares) [0x00000] in <filename unknown>:0
Comment 1 henry 2014-10-06 09:40:54 UTC
use 100 connections request and response 3500 per second , did not throw an error
but use 1000 connections request and response 12000 per second ,running for some time  throw  epoll(ADD): 9 Bad file descriptor "EndSend can only be called once per asynchronous operation"  error
Comment 2 henry 2014-10-06 09:50:00 UTC
internal void SendCallback (IAsyncResult ares)
			try {
				BytesTransferred = curSocket.EndSend (ares);
			} catch (SocketException se){
				SocketError = se.SocketErrorCode;
			} catch (ObjectDisposedException) {
				SocketError = SocketError.OperationAborted;
			} finally {
				OnCompleted (this);
see SendCallback's code only handled SocketException and ObjectDisposedException