[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?
8<------------------------------------------------------------------------
   ...
    Monitor.Enter( workers );
    int n = workers.Count;
    foreach ( Thread t in workers )
    {
     try
     {
      t.Abort();
     }
     catch ( ThreadAbortException ) {}
     catch ( NullReferenceException ) {}
     catch ( Exception e )
     {
      MCException.WriteException( "ADP0005", "Error occured while trying to
stop worker!", e );
     }
    }
    Monitor.Exit( workers );
    workers = null;
   ...
8<------------------------------------------------------------------------
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)
aborting...

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
info
** 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)
aborting...
./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
code...
I'm using Mono 0.31. This code was working well on Mono 0.29.


Any help would be appreciated!

Vadim B. Guzev
http://u.pereslavl.ru/~vadim/MCSharp/




More information about the Mono-devel-list mailing list