Re: Aggressive exception handler making extra work for itself.

Jesse Vincent <[email protected]> Mon, 19 Mar 2007 19:47:49 -0400
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Mar 19, 2007, at 7:38 PM, Dave Rolsky wrote:

> On Mon, 19 Mar 2007, Jesse Vincent wrote:
>
>> So, $m->comp defines a SIG{__DIE__} handler.  Inside Jifty, we make
>> relatively heavy use of our own microexceptions (trivial eval  
>> blocks). What
>> this means is that every time we call eval {} from within code  
>> that's called
>> by mason, we generate the overhead of a fairly deep  
>> Devel::StackTrace.  Is
>> there some bit of doc I'm missing about how not to hurt myself badly?
>
> I think you mean exec() defines a signal handler, right?

That's right. Sorry for being imprecise.

> The main reason we do this is we want to ensure that errors are turned
> into exception objects, because we use that object and the stack trace
> object to display the nice error page.

Sure. And that's something I (and my users) appreciate quite a bit.   
It's just a bit painful when I'm doing an eval and handling $@ myself.

> One possible solution might be to not mess with $SIG{__DIE__} when
> error_mode is set to fatal. Would that help Jifty? I'm assuming  
> that on a
> production site you'd set error_mode to fatal, so you'd get the speed
> benefit there.

That could work.

> Also, could Jifty throw it's micro-exceptions as something other  
> than a
> string? Mason will simply rethrow a reference if it gets one, so  
> you could
> do something like do:

The problem with that is that as often as not it's deep library code  
evaling a chunk of perl (very often a CPAN module) that's defined to  
fail by 'die'ing.


>   die { micro => 'foo' };


-jesse

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Mason-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-devel
PGP.sig (application/pgp-signature, 186 B) - not displayed