[Mono-bugs] [Bug 657593] New: Socket.AcceptAsync causes ObjectDisposedException at the time the socket closes.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Dec 4 04:59:55 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=657593

https://bugzilla.novell.com/show_bug.cgi?id=657593#c0


           Summary: Socket.AcceptAsync causes ObjectDisposedException at
                    the time the socket closes.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: pavlos256 at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=403458)
 --> (http://bugzilla.novell.com/attachment.cgi?id=403458)
Testcase

User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:2.0b8pre) Gecko/20101126
Firefox/4.0b8pre

Closing a listening socket that has had the AcceptAsync method called and is
waiting for a connection causes ObjectDisposedException that can't be caught by
user code (thrown in the ThreadPool?).

The attached testcase demonstrates the problem. It has been tested on .NET and
has no problem there.

More information:
The attached program tries to run the test twice, one time with the
e.AcceptSocket member set to null (before the call to AcceptAsync) and one time
with the e.AcceptSocket member set to a pre-initialized socket. The
ObjectDisposedException is thrown on both cases but when the e.AcceptSocket is
not null, a related but slightly different bug also appears: The Completed
event is raised with the e.AcceptSocket member set to null.

Reproducible: Always

Steps to Reproduce:
1. Run the attached testcase
2.
3.
Actual Results:  
Test with non-null e.AcceptSocket...

Unhandled Exception: System.ObjectDisposedException: The object was used after
being disposed.
  at System.Net.Sockets.Socket.EndAccept (System.Byte[]& buffer, System.Int32&
bytesTransferred, IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket.EndAccept (IAsyncResult result) [0x00000] in
<filename unknown>:0 
  at System.Net.Sockets.SocketAsyncEventArgs.AcceptCallback (IAsyncResult ares)
[0x00000] in <filename unknown>:0 


Test with null e.AcceptSocket...
Error: Completed called with AcceptSocket = null.

Unhandled Exception: System.ObjectDisposedException: The object was used after
being disposed.
  at System.Net.Sockets.Socket.EndAccept (System.Byte[]& buffer, System.Int32&
bytesTransferred, IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket.EndAccept (IAsyncResult result) [0x00000] in
<filename unknown>:0 
  at System.Net.Sockets.SocketAsyncEventArgs.AcceptCallback (IAsyncResult ares)
[0x00000] in <filename unknown>:0 


Expected Results:  
Test with non-null e.AcceptSocket...
OK.

Test with null e.AcceptSocket...
OK.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list