[tahoe-lafs-trac-stream] [tahoe-lafs] #1770: always include a useful message in calls to log.err
tahoe-lafs
trac at tahoe-lafs.org
Thu Jun 21 22:56:51 UTC 2012
#1770: always include a useful message in calls to log.err
----------------------------+--------------------
Reporter: davidsarah | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 1.10.0
Component: code | Version: 1.9.1
Resolution: | Keywords: error
Launchpad Bug: |
----------------------------+--------------------
Comment (by warner):
Hm, maybe. It'd have to look something like this:
{{{
d = ...
d.addCallback(...)
util.terminateDeferredChain(d)
def terminateDeferredChain(d):
stack = traceback.format_stack(1)
d.addErrback(log.err, why="call stack was %s" % (stack,))
}}}
(since {{{log.err}}} is usually added to the end of a Deferred
chain, by the time it's called, the stack no longer contains any
information about what caused the {{{log.err}}} to be added)
My problem with that is twofold:
* tracebacks are expensive to create, and
{{{terminateDeferredChain()}}} gets called every time, not just
in the case where {{{log.err()}}} gets invoked
* I've rarely found a whole stacktrace to be significantly more
useful than a UMID, at least for async errors. There just aren't
very many different ways to reach the same function: the top
stack frame is enough to guess the rest, and a UMID is enough to
deduce the top frame.
Also, the "util.terminateDeferredChain(d)" at the end of a series
of "d.addCallback" lines would look kind of out-of-place, but maybe
I could get used to it.
It might be worth testing how expensive it is to extract just a
single stack frame, instead of the whole traceback. If
terminateDeferredChain() could grab just the file+lineno+name of
the calling function, that'd contain as much information as a UMID
but tolerate cut-and-paste coding a lot better. OTOH, a static UMID
is super-fast.
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1770#comment:2>
tahoe-lafs <https://tahoe-lafs.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list