Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#31675 closed Cleanup/optimization (fixed)

Add a warning about cyclic references in exceptions to the debug error view.

Reported by: Chris Jerdonek Owned by: Hasan Ramezani
Component: Error reporting Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Issue #29393 fixed a hang in the debug error view if the exception chain has a cycle. However, if it would be even more helpful if the debug error view displayed that the exception had a cycle, along with what the cycle was. The text could be to the effect of, "cycle in exception chain detected: exception <exception value> encountered again."

It would be helpful to surface this because a cycle in the exception chain usually signals an underlying problem, either with user code, Django code, a bug in Python itself, etc.

Change History (6)

comment:1 by Mariusz Felisiak, 4 years ago

Easy pickings: set
Summary: debug error view: show if the exception chain has a cycleAdd a warning about cyclic references in exceptions to the debug error view.
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization
Version: 3.0master

Thanks Chris. I think that adding a warning (warnings.warn(...)) about cyclic references would be an improvement. We should probably add a custom subclass of UserWarning, e.g. CyclicExceptionReferenceWarning, for easy ignoring, if needed.

comment:2 by Hasan Ramezani, 4 years ago

Has patch: set
Owner: set to Hasan Ramezani
Status: newassigned

comment:3 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In a59de6e:

Fixed #31675 -- Added warning to ExceptionReporter when exception chain has a cycle.

comment:4 by Chris Jerdonek, 4 years ago

Will the PR that was committed cause the exception to display in the error view in the list with the other exceptions? What I was suggesting is that it would be helpful if, in the debug error view, the beginning of the first repetition shows in the error view, with a description of what exception was repeated. That way, the full exception chain is visible in the error view.

in reply to:  4 comment:5 by Mariusz Felisiak, 4 years ago

Replying to Chris Jerdonek:

Will the PR that was committed cause the exception to display in the error view in the list with the other exceptions? What I was suggesting is that it would be helpful if, in the debug error view, the beginning of the first repetition shows in the error view, with a description of what exception was repeated. That way, the full exception chain is visible in the error view.

No, a warning will appear only in the development server console. I think it's enough since this is quite niche and I don't have an idea how to add it to the debug view frames without a bigger refactoring. I'd be happy to review a patch with improvements if you want to work on this.

comment:6 by Chris Jerdonek, 4 years ago

Yeah, I could do it as an extension to the other two when I get around to it. The approach I had in mind would use the existing template structure so the repeated exception would display normally, just with a note of some kind next to it. But it would need to come after fixing the other issue.

Note: See TracTickets for help on using tickets.
Back to Top