Bug 23641 - SocketAsyncEventArgs.DispatcherCB throw Unhandled Exception
Summary: SocketAsyncEventArgs.DispatcherCB throw Unhandled Exception
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
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)

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


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

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