[Mono-list] Critical sections

Dick Porter dick@ximian.com
20 Jun 2004 20:13:40 +0100

On Sat, 2004-06-19 at 22:43, Vadim B. Guzev wrote:
> Hello ,
> I'm constantly getting the following error:
> ** ERROR **: file critical-sections.c: line 89 (DeleteCriticalSection): assertion failed: (ret == 0)
> aborting...
> And after that application crashes...
> What do these "critical sections" mean? Is it related to sockets,
> mutexes, monitors, threads or what?

Something is causing the runtime to delete a locked critical section (an
internal mutex.)  This is an internal bug.

> I can't understand what's wrong with my program. It happens when I call
> System.Environment.Exit(0) from one of the running threads.
> Also sometimes I get this warning
> ** (/home/vadim/mcsharp.cluster/bin/wn.exe:1737): WARNING **: : unref on 18 called when ref was already 0

I suspect this (and the critical section problem) is due to aborting the
running threads when you are exiting the application.

> I'm using:
> Mono 0.91
> Linux skif 2.4.25 #2 SMP Fri Apr 23 14:03:00 MSD 2004 i686 athlon i386 GNU/Linux
> gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

Newer versions have a much improved thread abort, but still need a bit
of work in this area.  It might be good enough at the moment for you
already though.  The SMP part seems to make thread abort problems much
more apparent, btw.

If you can demonstrate this problem in a short test application, it
would help us if you add it to bugzilla.  I suspect you're seeing
http://bugzilla.ximian.com/show_bug.cgi?id=58065 so that might be worth
a look.

- Dick