Opened 12 years ago

Last modified 11 years ago

#130 new defect

problems in CopiedFailure

Reported by: Brian Warner Owned by:
Priority: major Milestone: undecided
Component: error-handling Version: 0.4.1
Keywords: Cc:


While trying to debug a remote exception (which turned out to be in remote_decref, being called on a CLID which had already gone away), I was frustrated to see that the trial output was an extremely terse [ERROR] "KeyError: 1". Asking trial for more detail (by passing it --tbformat=verbose provoked an internal trial error, no attribute ".count" while trying to do printTraceback.

There are several overlapping problems:

  • Twisted's Failure object has acquired some new attributes in recent versions. In particular, each Failure instance gets a unique .count attribute, assigned in the constructor, and Failure.printTraceback will include it in the rendered traceback if tbformat==verbose. Foolscap was not sending a copy of .count over the wire.
  • the receiving process is getting an actual Failure instance, rather than a CopiedFailure instance. In particular, Failure.printTraceback is being called instead of CopiedFailure.printTraceback, so the lack of .count is more troublesome. I don't understand why this could be the case. I think what we do is instantiate a CopiedFailure and then set its __dict__ to the deserialized attribute dictionary. Perhaps that __dict__ set also manages to set __class__ and thus changes the method lookup behavior. But __class__ isn't supposed to be part of the attribute dictionary that is sent over the wire.
  • if CopiedFailure could produce a .frames attribute that looked more like what Failure was expecting, this wouldn't be such a problem.

Attachments (1)

send-count.diff (1.2 KB) - added by Brian Warner 12 years ago.
patch to include .count attribute in CopiedFailure? dict

Download all attachments as: .zip

Change History (3)

comment:1 Changed 12 years ago by Brian Warner

note that modifying twisted.trial.reporter.Reporter._formatFailureTraceback to print fail.traceback will display the missing debug information. CopiedFailure.printTraceback does this, but it's not getting called (instead Failure.printTraceback is called, which tries to render .frames instead of .traceback, and CopiedFailures don't have .frames).

Changed 12 years ago by Brian Warner

Attachment: send-count.diff added

patch to include .count attribute in CopiedFailure? dict

comment:2 Changed 11 years ago by Brian Warner

Component: unknownerror-handling
Note: See TracTickets for help on using tickets.