Code

Opened 14 months ago

Closed 9 months ago

#20534 closed Bug (duplicate)

Make TECHNICAL_500 more resilient (against large variables and non-utf-8)

Reported by: wdoekes Owned by: nobody
Component: Core (Other) Version: 1.4
Severity: Normal Keywords:
Cc: wdoekes Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

I recently had errors that didn't provide a nice TECHNICAL_500_TEMPLATE mail.

The cause turned out to be two things:
(1) large variables caused a mail so large that the MXs refused to deliver them
(2) non-utf8 representations of objects caused errors while handling the error

The attached fix fixed it.

This was done against Django 1.4. Apologies in advance if this is fixed somewhere already. I couldn't find a relevant bug report.

Triggering (1) should be a matter of generating an error up the stack with a huge variable. Triggering (2) can be done like this:

urlpatterns = (
    # Error test
    (r'500$', (lambda r: Crap())),  # ExplodeInYourFaceError
)

class Crap(Exception):
    def __init__(self):
        raise self
    def __repr__(self):
        return 'X\xe9X'

Regards,
Walter Doekes
OSSO B.V.

Attachments (1)

django20534_make_debug_more_resilient.patch (1.0 KB) - added by wdoekes 14 months ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 13 months ago by wim@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Good idea to trim large variables.

Shouldn't objects always be presented in utf-8 unicode by default?

comment:2 Changed 13 months ago by wdoekes

Shouldn't objects always be presented in utf-8 unicode by default?

Should and should. In this particular case it was (a) a third party lib (b) throwing an exception with binary data in the representation.

We can argue all day about whether that's right, but error reporting shouldn't choke on it.

comment:3 Changed 9 months ago by timo

Duplicate of #20368

comment:4 Changed 9 months ago by timo

  • Resolution set to duplicate
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.