Bug 766 - Runtime crashes when SocketAsyncEventArgs is disposed
Summary: Runtime crashes when SocketAsyncEventArgs is disposed
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Gonzalo Paniagua Javier
Depends on:
Reported: 2011-09-12 17:58 UTC by AmandaK
Modified: 2011-09-13 00:08 UTC (History)
2 users (show)

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

Repro case. (667 bytes, application/octet-stream)
2011-09-12 17:58 UTC, AmandaK

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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description AmandaK 2011-09-12 17:58:58 UTC
Created attachment 333 [details]
Repro case.

Originally reported at: https://bugzilla.novell.com/show_bug.cgi?id=691076

The runtime crashes when a SocketAsyncEventArgs is disposed before the socket
is closed, and async activity occurs. This prevents the use of the async socket API.

Reproducible: Always

Steps to Reproduce:
1. gmcs AsyncCrash.cs (attached)
2. mono AsyncCrash.exe
3. While process is running, do "telnet localhost 8888" and press Enter to send
Actual Results:  

Native stacktrace:

    0   mono                                0x000b6ea9 0x0 + 749225
    1   mono                                0x00006e0e 0x0 + 28174
    2   libSystem.B.dylib                   0x9542a45b _sigtramp + 43
    3   ???                                 0xffffffff 0x0 + 4294967295
    4   mono                                0x001f7993 0x0 + 2062739
    5   mono                                0x001f983a 0x0 + 2070586
    6   mono                                0x001f98da 0x0 + 2070746
    7   mono                                0x0023796b 0x0 + 2324843
    8   mono                                0x00268e87 0x0 + 2526855
    9   libSystem.B.dylib                   0x953f17fd _pthread_start + 345
    10  libSystem.B.dylib                   0x953f1682 thread_start + 34

Debug info from gdb:

/tmp/mono-gdb-commands.HsN6bi:1: Error in sourced command file:
unable to debug self

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

Abort trap

Expected Results:  
Not to crash.

Mono versions 2.8.x seem fine.
Comment 1 Gonzalo Paniagua Javier 2011-09-13 00:08:06 UTC
Fixed in Mono master/b96b00c and mono-2-10/b404033