Opened 17 years ago
Last modified 16 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: |
Description
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
Failureobject has acquired some new attributes in recent versions. In particular, each Failure instance gets a unique .count attribute, assigned in the constructor, andFailure.printTracebackwill 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
CopiedFailureinstance. In particular,Failure.printTracebackis being called instead ofCopiedFailure.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
CopiedFailurecould produce a .frames attribute that looked more like whatFailurewas expecting, this wouldn't be such a problem.
Attachments (1)
Change History (3)
comment:1 Changed 17 years ago by
Changed 17 years ago by
| Attachment: | send-count.diff added |
|---|
patch to include .count attribute in CopiedFailure? dict
comment:2 Changed 16 years ago by
| Component: | unknown → error-handling |
|---|
Note: See
TracTickets for help on using
tickets.

note that modifying
twisted.trial.reporter.Reporter._formatFailureTracebackto printfail.tracebackwill display the missing debug information.CopiedFailure.printTracebackdoes this, but it's not getting called (insteadFailure.printTracebackis called, which tries to render .frames instead of .traceback, and CopiedFailures don't have .frames).