[Mono-bugs] [Bug 72637][Wis] New - DeleteCriticalSection assertion failed error

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 16 Feb 2005 07:01:57 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by vguzev@yandex.ru.

http://bugzilla.ximian.com/show_bug.cgi?id=72637

--- shadow/72637	2005-02-16 07:01:57.000000000 -0500
+++ shadow/72637.tmp.8029	2005-02-16 07:01:57.000000000 -0500
@@ -0,0 +1,111 @@
+Bug#: 72637
+Product: Mono: Runtime
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: Linux skif 2.4.25 #2 SMP Fri Apr 23 14:03:00 MSD 2004 i686 athlon i386 GNU/Linux
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vguzev@yandex.ru               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DeleteCriticalSection assertion failed error
+
+Hi!
+
+
+Does anyone know what does this error mean?
+--8<------------------------------------------
+** ERROR **: file critical-sections.c: line 89 (DeleteCriticalSection): 
+assertion failed: (ret == 0)
+aborting...
+Aborted
+--8<------------------------------------------
+
+I think that it's thrown when I call Environment.Exit() - my application 
+where I get this error uses a lot of threads and quite complex, so 
+unfortunately I can't provide a small sample that can reproduce this 
+error. It appears just before the application finish it's execution, but 
+not always (approximately once per 20 launches).
+
+I see that there's only one place where it could be in 
+DeleteCriticalSection:
+--8<--mono/io-layer/critical-sections.c-------
+ret = mono_mutex_destroy(&section->mutex);
+g_assert (ret == 0);
+--8<------------------------------------------
+
+In this function:
+--8<--mono/io-layer/mono-mutex.c--------------
+int
+mono_mutex_destroy (mono_mutex_t *mutex)
+{
+        int ret = 0;
+        int thr_ret;
+
+        switch (mutex->type) {
+        case MONO_MUTEX_NORMAL:
+                ret = pthread_mutex_destroy (&mutex->mutex);
+                break;
+        case MONO_MUTEX_RECURSIVE:
+                if ((ret = pthread_mutex_destroy (&mutex->mutex)) == 0) {
+                        thr_ret = pthread_cond_destroy (&mutex->cond);
+                        g_assert (thr_ret == 0);
+                }
+        }
+
+        return ret;
+}
+--8<------------------------------------------
+
+It seems that the mutex passed as parameters is NULL!
+
+Here's what is written in pthread.c (this can be different if you use 
+other version of pthread)
+--8<---pthread.c------------------------------
+int pthread_mutex_destroy(pthread_mutex_t *mutex)
+{
+    if (mutex == NULL)
+        return pth_error(EINVAL, EINVAL);
+    free(*mutex);
+    *mutex = NULL;
+    return OK;
+}
+--8<------------------------------------------
+
+So, the only one place where this function can return value != 0 is when 
+mutex == NULL.
+And here's what "man" says about pthread functions:
+
+--8<--man-------------------------------------
+RETURN VALUE
+pthread_mutex_init always returns 0. The other mutex functions return 0
+on success and a non-zero error code on error.
+--8<------------------------------------------
+
+Can we add some checkings for (mutex != null) to get rid of this annoying 
+message?
+
+Additional info:
+--8<-----------------------------------------
+[vadim@skif io-layer]$ uname -a
+Linux skif 2.4.25 #2 SMP Fri Apr 23 14:03:00 MSD 2004 i686 athlon i386 
+GNU/Linux
+[vadim@skif io-layer]$ mono --version
+Mono JIT compiler version 1.0.5, (C) 2002-2004 Novell, Inc and 
+Contributors. www.go-mono.com
+        TLS:           __thread
+        GC:            Included Boehm (with typed GC)
+        SIGSEGV      : normal
+        Globalization: ICU
+--8<-----------------------------------------
+
+
+Best regards,
+Vadim B. Guzev
+http://u.pereslavl.ru/~vadim/MCSharp/