[Mono-devel-list] Call to Thread.Abort causes to Application failure!

Vadim B. Guzev vguzev at yandex.ru
Tue Apr 13 14:22:44 EDT 2004

Hello, mono-list at lists.ximian.com !

Can anyone explain me what's wrong with the following code?
    Monitor.Enter( workers );
    int n = workers.Count;
    foreach ( Thread t in workers )
     catch ( ThreadAbortException ) {}
     catch ( NullReferenceException ) {}
     catch ( Exception e )
      MCException.WriteException( "ADP0005", "Error occured while trying to
stop worker!", e );
    Monitor.Exit( workers );
    workers = null;
Collection "workers" is the ArrayList that contains running or already
stopped Threads collection.
This collection can contain hundreds of Threads.

Sometimes it works well, but almost always throws the following exception:

** ERROR **: file exceptions-x86.c: line 1061 (mono_arch_handle_exception):
assertion failed: (jit_tls->end_of_stack)

Sometimes it can halt with the following message:

Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object
** (xsp.exe:17631): WARNING **: Exception inside function without unwind
** ERROR **: file exceptions-x86.c: line 1091 (mono_arch_handle_exception):
should not be reached

Or something like this:
** ERROR **: file exceptions-x86.c: line 1062 (mono_arch_handle_exception):
assertion failed: (jit_tls->abort_func)
./runxsp: line 1: 17653 Aborted                 mono xsp.exe --port
10000 --applications /:../share/doc/xsp/test/,/fib:../fib,/webapp:../webapp

How can I debug my applications in such cases and find out the reasons of
these failures?
It was very difficult for me to figure out this code from thousands lines of
I'm using Mono 0.31. This code was working well on Mono 0.29.

Any help would be appreciated!

Vadim B. Guzev

More information about the Mono-devel-list mailing list