[Mono-bugs] [Bug 684944] New: assertion failure and abort at exit if GC.SuppressFinalize is called on a Socket

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 4 14:21:08 EDT 2011



           Summary: assertion failure and abort at exit if
                    GC.SuppressFinalize is called on a Socket
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.10.x
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: io-layer
        AssignedTo: lupus at novell.com
        ReportedBy: Csaba.Halasz at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Created an attachment (id=423038)
 --> (http://bugzilla.novell.com/attachment.cgi?id=423038)
test case

User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20100101

If GC.SuppressFinalize is called on a Socket, mono will run into an assertion
failure and abort during process shutdown. Seems to have no harmful effect
during operation.

The problem is that socket_close is called from handle_cleanup after WSACleanup
has already been run. The actual assertion failure and abort only happens
because the socket code is trying to call SetLastError to indicate the problem.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff7ff0740 (LWP 27286)]
0x00007ffff7206165 in *__GI_raise (sig=<value optimized out>) at
64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
        in ../nptl/sysdeps/unix/sysv/linux/raise.c
Current language:  auto
The current source language is "auto; currently c".
(gdb) bt
#0  0x00007ffff7206165 in *__GI_raise (sig=<value optimized out>) at
#1  0x00007ffff7208f70 in *__GI_abort () at abort.c:92
#2  0x00000000005cebcf in monoeg_g_logv (log_domain=0x600a5c "",
log_level=G_LOG_LEVEL_ERROR, format=<value optimized out>,
    args=<value optimized out>) at goutput.c:134
#3  0x00000000005cec67 in monoeg_assertion_message (format=0x6 <Address 0x6 out
of bounds>) at goutput.c:154
#4  0x00000000005a44ca in SetLastError (code=<value optimized out>) at
#5  0x00000000005b5376 in _wapi_handle_unref (handle=<value optimized out>) at
#6  0x00000000005b5954 in handle_cleanup () at handles.c:215
#7  0x00007ffff720a5e2 in __run_exit_handlers (status=0, listp=0x7ffff752f4a8,
run_list_atexit=true) at exit.c:78
#8  0x00007ffff720a635 in *__GI_exit (status=27286) at exit.c:100
#9  0x00007ffff71f2c54 in __libc_start_main (main=<value optimized out>,
argc=<value optimized out>,
    ubp_av=<value optimized out>, init=<value optimized out>, fini=<value
optimized out>, rtld_fini=<value optimized out>,
    stack_end=0x7fffffffeb28) at libc-start.c:260
#10 0x0000000000414459 in _start ()

source code of error.c:
     63 void SetLastError(guint32 code)
     64 {
     65         int ret;
     67         /* Set the thread-local error code */
     68         mono_once(&error_key_once, error_init);
     69         ret = pthread_setspecific(error_key, GUINT_TO_POINTER(code));
*    70         g_assert (ret == 0);
     71 }

source code of handles.c:
   1176                 if (close_func != NULL) {
   1177                         if (is_shared) {
   1178                                 close_func (handle,
   1179                         } else {
*  1180                                 close_func (handle, &handle_data.u);
   1181                         }
   1182                 }

Reproducible: Always

Steps to Reproduce:
Create a socket and call GC.SuppressFinalize on it (see attached test case)
Actual Results:  
* Assertion at error.c:70, condition `ret == 0' not met


Expected Results:  
Normal exit.

Happens with mono 2.10.1 on debian 6.0 and 5.0, mono 2.6.7 on the same machines
work. Reportedly fails on centos as well.

This problem is triggered by the MySql Connector/.NET, at least versions 6.1.3
and 6.3.6.

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

More information about the mono-bugs mailing list