[Django] #24455: Debug-page now shown when traceback contains LazyObjects which raise exceptions when evaluated

30 views
Skip to first unread message

Django

unread,
Mar 7, 2015, 5:10:06 AM3/7/15
to django-...@googlegroups.com
#24455: Debug-page now shown when traceback contains LazyObjects which raise
exceptions when evaluated
------------------------------+-----------------------
Reporter: bpeschier | Owner: bpeschier
Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Keywords: ams2015
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+-----------------------
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.
}}}

2. Go to {{{localhost:8000/admin/}}} in browser
3. 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/24455>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 7, 2015, 7:28:04 AM3/7/15
to django-...@googlegroups.com
#24455: Debug-page now shown when traceback contains LazyObjects which raise
exceptions when evaluated
------------------------------+--------------------------------------

Reporter: bpeschier | Owner: bpeschier
Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:

Keywords: ams2015 | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by bpeschier):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

PR at https://github.com/django/django/pull/4259

--
Ticket URL: <https://code.djangoproject.com/ticket/24455#comment:1>

Django

unread,
Mar 7, 2015, 7:32:21 AM3/7/15
to django-...@googlegroups.com
#24455: Debug-page not shown when traceback contains LazyObjects which raise
exceptions when evaluated
------------------------------+--------------------------------------

Reporter: bpeschier | Owner: bpeschier
Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:

Keywords: ams2015 | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/24455#comment:2>

Django

unread,
Mar 7, 2015, 8:31:59 AM3/7/15
to django-...@googlegroups.com
#24455: Debug-page now shown when traceback contains LazyObjects which raise
exceptions when evaluated
------------------------------+--------------------------------------

Reporter: bpeschier | Owner: bpeschier
Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:

Keywords: ams2015 | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by bmispelon):

* needs_docs: 0 => 1
* has_patch: 0 => 1


Comment:

Left some comments on the PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/24455#comment:3>

Django

unread,
Mar 7, 2015, 8:36:41 AM3/7/15
to django-...@googlegroups.com
#24455: Debug-page now shown when traceback contains LazyObjects which raise
exceptions when evaluated
-------------------------------------+-------------------------------------

Reporter: bpeschier | Owner: bpeschier
Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: ams2015 | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_docs: 1 => 0
* stage: Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24455#comment:4>

Django

unread,
Mar 9, 2015, 8:39:07 PM3/9/15
to django-...@googlegroups.com
#24455: Debug-page now shown when traceback contains LazyObjects which raise
exceptions when evaluated
-------------------------------------+-------------------------------------
Reporter: bpeschier | Owner: bpeschier
Type: Bug | Status: closed

Component: Core (Other) | Version: master
Severity: Normal | Resolution: fixed

Keywords: ams2015 | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"756cee46d25a52108fd7190f787a7e636962df5d"]:
{{{
#!CommitTicketReference repository=""
revision="756cee46d25a52108fd7190f787a7e636962df5d"
Fixed #24455 -- Fixed crash in debug view with lazy objects
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24455#comment:5>

Reply all
Reply to author
Forward
0 new messages