AW: [Mono-list] Segmentation fault / StackOverflowException not thrown

Simon Kitching simon@ecnetwork.co.nz
15 Jul 2003 11:25:21 +1200


Some further comments:

The big benefit that *guaranteeing* a StackOverflowException is thrown
instead of segmentation fault occurring is that it makes "plugins" safe.
For example, a database can allow stored procedures to be written in any
CLI-based language with the certainty that no stored procedure can ever
crash the database. This is why Oracle databases allow java-based code
to run in-process (with major performance benefits).

Of course the plugin code can still leak all available memory, or hog a
significant percentage of the CPU, or use up all available file handles,
etc. Still, preventing crashes is a good start. And if you could provide
a mechanism to limit other types of resources allocated by a specific
thread or assembly, then that would be great!

I'm not into C# in a big way yet, but this would definitely be a feature
that I would look for (code cannot crash the application) before moving
from java to C#.

Cheers,

Simon

On Tue, 2003-07-15 at 11:05, Simon Kitching wrote:
> Well, Sun's Java Virtual Machine on Linux manages to detect stack
> overflow and throw an exception so it must be possible.
> 
> 
> On Mon, 2003-07-14 at 22:51, Dietmar Maurer wrote:
> > > -----Ursprüngliche Nachricht-----
> > > Von: Michael Levy [mailto:mlevy@wardium.homeip.net] 
> > > Gesendet: Freitag, 11. Juli 2003 22:29
> > > An: mono-list@lists.ximian.com
> > > Betreff: [Mono-list] Segmentation fault / 
> > > StackOverflowException not thrown
> > > 
> > > 
> > > Hello,
> > > 	I am fairly new to C# (and mono) but I think that I may 
> > > have found a potential bug. I have attached a short peice of 
> > > (silly) code which shows the problem. The code basically 
> > > causes a method (or property, depending on what you have 
> > > un-commented) to recursivly call itsel until it blows the 
> > > stack. I would expect that this sort of pathological 
> > > recursion should generate 
> > > a StackoverflowException when executed, but it simpley causes 
> > > a Segmentation fault. I have not been able to confirm this 
> > > behaviour on Windows. I am using the lates release of mono (0.25).
> > 
> > The problem is that Unix has no real support to catch stack overflow, i.e.
> > it is highly system specific. So we decided to do a Segmentation fault in
> > that case.
> > 
> > Anyways, it should be possible to detect simple cases at compile time -  so
> > the c# compiler could emit a warning in that case.
> > 
> > - Dietmar
> >  
> > 
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> > 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>