Opened 9 years ago

Closed 9 years ago

#24455 closed Bug (fixed)

Debug-page now shown when traceback contains LazyObjects which raise exceptions when evaluated

Reported by: Bas Peschier Owned by: Bas Peschier
Component: Core (Other) Version: dev
Severity: Normal Keywords: ams2015
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Reproduce it by:

  1. Create new project:
$ django-admin.py startproject djtest
$ cd djtest
$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.

March 07, 2015 - 09:57:35
Django version 1.9.dev20150306212014, using settings 'djtest.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
  1. Go to localhost:8000/admin/ in browser
  2. You get an error in the console django.db.utils.OperationalError: no such table: django_session and A server error occurred. Please contact the administrator. in your browser

What happens is request.user is queried, which triggers an error for table django_session which is not migrated yet. While creating the 500 technical debug page, all information is cleansed for sensitive information and this also triggers the evaluation of the lazy user object. Since this happens in the creation of the debug page, the exception is raised and not caught. This results in the console-error instead of the debug page.

The evaluation of LazyObject in cleanse_special_types in debug.py is correct and should happen (it might contain stuff to be cleansed), but any exception while evaluating can be safely ignored so we can display the original error.

Change History (5)

comment:2 by Bas Peschier, 9 years ago

Summary: Debug-page now shown when traceback contains LazyObjects which raise exceptions when evaluatedDebug-page not shown when traceback contains LazyObjects which raise exceptions when evaluated

comment:3 by Baptiste Mispelon, 9 years ago

Has patch: set
Needs documentation: set
Summary: Debug-page not shown when traceback contains LazyObjects which raise exceptions when evaluatedDebug-page now shown when traceback contains LazyObjects which raise exceptions when evaluated

Left some comments on the PR.

comment:4 by Tim Graham, 9 years ago

Needs documentation: unset
Triage Stage: UnreviewedReady for checkin

comment:5 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 756cee46d25a52108fd7190f787a7e636962df5d:

Fixed #24455 -- Fixed crash in debug view with lazy objects

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