launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #06786
Re: [performance] Twisted Exception "features"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/29/2011 08:24 AM, Andrew Bennetts wrote:
> John Arbash Meinel wrote:
> [...]
>>
>> Best case time, 350ms. Apparently those aren't the expensive exceptions.
>> So it does help (350ms is better than 480ms.) But not as much as
>> 'tb=None' ~180ms.
>
> Hmm, interesting. It might be worth patching Failure and Deferred on
> your system to see where the other calls to Failure() [i.e. with no
> args] are coming from. Specifically patch the part of
> Deferred._runCallbacks that calls Failure() to say which callback
> triggered it, and patch Failure.__init__ to report when it is called
> without args too, because there may be some places that don't happen
> directly in Deferred…
I believe there are things like Failure.trap() and xmlrpc.trap_fault()
that can do a bare 'raise' to re-raise the original exception because it
doesn't match the exact type that the error handler can handle.
>
> The most obvious other point I can see is in twisted.web.xmlrpc.Proxy,
> which is hard to avoid nicely. I've pushed up an ugly revision to my
> branch to try suppress that too, but it's pretty nasty (I have to copy a
> 15 line method just to change 2 lines). I'm not sure that we'd actually
> be triggering failing XML-RPC calls in this case though, so it may make
> no difference. It'd be nice to get hard data on where the other
> Failure() calls are coming from so we know if there's just one or two
> places we can adjust, or if it's too widespread to fix this way.
>
> -Andrew.
>
Sure, I can certainly hack in some trace.mutter(traceback()) sort of
thing to the code just for diagnostic purposes.
Also, the documentation seems to disagree with your idea:
For C{exc_tb} only L{traceback} instances or C{None} are allowed.
If C{None} is supplied for C{exc_value}, the value of C{exc_tb} is
ignored, otherwise if C{exc_tb} is C{None}, it will be found from
execution context (ie, L{sys.exc_info}).
At least as I read that, if you pass an object for 'exc_value' but pass
None for 'exc_tb' it will find the traceback from sys.exc_info. I have
to actually audit the code to make sure that is the case.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk2Rhs8ACgkQJdeBCYSNAAMDMgCglrU5S8Rwq7rIs6MUtXwfM0Mg
tg0An1PcDYOTc5Jy9N3NDbXOjbm1cDAv
=Mxrp
-----END PGP SIGNATURE-----
Follow ups
References