Author mahmoud
Recipients adaptivelogic, eric.snow, gvanrossum, mahmoud, martius, ncoghlan, pitrou, rbcollins, rhettinger, vstinner, xonatius, yselivanov
Date 2015-02-10.23:08:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1423609704.46.0.287540976693.issue17911@psf.upfronthosting.co.za>
In-reply-to
Content
Hey all, great to see this being worked on so diligently for so long. Having worked in this area for a while (at home and at PayPal), we've got a few learnings to share:

1) linecache is textbook not-threadsafe. For example, https://hg.python.org/cpython/file/default/Lib/linecache.py#l38

For a lightweight traceback wrapper to be concurrency-friendly, we've had to catch KeyErrors, like so: https://github.com/mahmoud/boltons/blob/master/boltons/tbutils.py#L115

It's kind of a blanket approach, but maybe we could make a separate issue and help out with a linecache refresh?

2) We use something like (filename, lineno) in our DeferredLine class, but for very lightweight areas (e.g., greenlet creation) we just save a reference to the code object, as the additional attribute accesses do end up showing up in the profiles.

3) Generally we've found the APIs in TracebackInfo here to be pretty sufficient/functional: 

https://github.com/mahmoud/boltons/blob/master/boltons/tbutils.py#L134

Let me know if you've got any questions on that, and keep up the good work!
History
Date User Action Args
2015-02-10 23:08:24mahmoudsetrecipients: + mahmoud, gvanrossum, rhettinger, ncoghlan, pitrou, vstinner, rbcollins, eric.snow, yselivanov, adaptivelogic, martius, xonatius
2015-02-10 23:08:24mahmoudsetmessageid: <1423609704.46.0.287540976693.issue17911@psf.upfronthosting.co.za>
2015-02-10 23:08:24mahmoudlinkissue17911 messages
2015-02-10 23:08:23mahmoudcreate