[Twisted-Python] Strategy for finding source of unhandled error in Deferred
Barry Scott
barry.scott at forcepoint.com
Mon Mar 26 08:47:00 MDT 2018
On Sunday, 18 March 2018 15:23:58 BST Jean-Paul Calderone wrote:
> On Sun, Mar 18, 2018 at 11:21 AM, Jean-Paul Calderone <
>
> exarkun at twistedmatrix.com> wrote:
> > On Sun, Mar 18, 2018 at 11:04 AM, Alex Railean <ralienpp at gmail.com> wrote:
> >> Hello,
> >>
> >> I have inherited a misbehaving system and am trying to troubleshoot it.
> >> The code
> >> is not documented and I cannot produce a minimal working example that
> >> illustrates
> >> the problem yet, as I don't know which parts are involved and how they
> >> relate.
> >
> > This produces the following entries in the log:
> >> Unhandled error in Deferred:
> >> CRITICAL _legacy twcore Unhandled error in Deferred:
> >>
> >> Traceback (most recent call last):
> >> Failure: __builtin__.type: <class 'twisted.internet.error.TimeoutError'>
> >> CRITICAL _legacy twcore
> >>
> >>
> >>
> >> How can I get more clues about what is going on? I was expecting a line
> >> number,
> >> or a complete call-stack.
>
> Try this:
>
> from twisted.internet.defer import setDebugging
> setDebugging(True)
>
> This gives you creation and callback stacks in the logs.
If you need to track down who put the value into the deferred
you need to patch the defer.py code to log that info.
There are 2 places that a value enters the Deferred.
The first is the callback() call. The other is in
defer.py:653 Deffered._runCallbacks()
653: current.result = callback(current.result, *args,
**kw)
Barry
>
> Jean-Paul
>
> >> What are the recommended troubleshooting steps for finding the Deferred
> >> in which
> >> the error occurred? There are are around 30 of them throughout the code,
> >> is
> >> there a heuristic I can use to narrow down the list of suspects?
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> Twisted-Python mailing list
> >> Twisted-Python at twistedmatrix.com
> >> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
More information about the Twisted-Python
mailing list