[Mono-dev] SIGILL in finally clause without catch

Zoltan Varga vargaz at gmail.com
Fri Apr 25 08:30:40 EDT 2008


Hi,

SIGILL means invalid instruction encountered by the cpu. Currently,
mono converts
this to an exception which can be caught and ignored. This behaviour
might change
in the future, cause we already handle SIGSEGV and SIGABRT by aborting the
process.

                 Zoltan

On Fri, Apr 25, 2008 at 1:51 PM, Christian Stümpel
<mail at christian-stuempel.de> wrote:
> Hi Zoltan,
>
>
>
> > the (managed-to-native) wrapper. So the problem is usually in the native
> code.
> >
> >
>  But then why does introducing the "catch" and rethrowing resolve the
> matter?
>
>  platform is Mac OS X i386.
>
>         Christian
>
>
>  Am 25.04.2008 um 12:01 schrieb Zoltan Varga:
>
>
>
>
> >                                      Hi,
> >
> >  Mono throws that exception when it receives a SIGILL signal while
> > executing some
> > code. If it receives it while executing native code, it appears that
> > it is thrown by
> > the (managed-to-native) wrapper. So the problem is usually in the native
> code.
> >
> > What platform/os is this ?
> >
> >               Zoltan
> >
> > 2008/4/23 Christian Stümpel <mail at christian-stuempel.de>:
> >
> > > In code I have to port from MS .NET to mono I observed several SIGILL
> > > crashes at points in code, where calls to external code are made within
> a
> > > try block followed by a finally but *without* a catch statement.
> > >
> > >
> > >  try {
> > >  unrar.dosomething();
> > >  throw new Exception("test");
> > >  }
> > >
> > >  // no catch here
> > >
> > >  finally
> > >  {
> > >  unrar.close(); // calls unmanaged code
> > >
> > >  }
> > >
> > > The unmanaged code called in unrar.dosomething() is C++ code compiled
> with
> > > exceptions enabled but it does not throw the exception, but the managed
> code
> > > that follows. The call to unrar.close() (which does not throw any
> exception)
> > > in the finally clause crashes with:
> > >
> > > System.ExecutionEngineException: SIGILL  at (wrapper managed-to-native)
> > > NntpApp.nntp.rar.Unrar:RARCloseArchive (intptr)  at
> > > NntpApp.nntp.rar.Unrar.Close () [0x00000]   at
> > > usenextapp.FilegroupPreview.ExtractFileFromRar (System.String path)
> > > [0x00000]
> > >
> > > The SIGILL does not appear if I catch the exception and rethrow it in
> the
> > > finally clause
> > >
> > >  Exception e=null;
> > >
> > >  try {
> > >  unmanaged1();
> > >  throw new Exception("test");
> > >  }
> > >
> > >  catch(Exception ex)
> > >  {
> > >  e= ex;
> > >  }
> > >
> > >  finally
> > >  {
> > >  cleanup();
> > >  if (e!=null)
> > >  throw e;
> > >  }
> > >
> > > Any thoughts on that?
> > >
> > > Christian Stümpel
> > >
> > >
> > >
> > > _______________________________________________
> > >  Mono-devel-list mailing list
> > >  Mono-devel-list at lists.ximian.com
> > >  http://lists.ximian.com/mailman/listinfo/mono-devel-list
> > >
> > >
> > >
> >
>
>


More information about the Mono-devel-list mailing list