[Django] #27820: response_for_exception triggers 500 when exc is RequestDataTooBig

26 views
Skip to first unread message

Django

unread,
Feb 8, 2017, 2:52:29 AM2/8/17
to django-...@googlegroups.com
#27820: response_for_exception triggers 500 when exc is RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Amalia | Owner: nobody
Souček |
Type: Bug | Status: new
Component: Core | Version: 1.10
(Other) | Keywords:
Severity: Normal | DATA_UPLOAD_MAX_MEMORY_SIZE,
| RequestDataTooBig,
Triage Stage: | response_for_exception, 500
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When a RequestDataTooBig is raised response_for_exception tries to access
request data again triggering a new RequestDataTooBig.
This results in an error 500.


{{{
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Traceback (most recent call last):
File "../python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "../python2.7/site-
packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "../python2.7/site-packages/dj_static.py", line 83, in __call__
return self.application(environ, start_response)
File "../python2.7/site-packages/dj_static.py", line 83, in __call__
return self.application(environ, start_response)
File "../python2.7/site-packages/django/core/handlers/wsgi.py", line
175, in __call__
response = self.get_response(request)
File "../python2.7/site-packages/django/core/handlers/base.py", line
124, in get_response
response = self._middleware_chain(request)
File "../python2.7/site-packages/django/core/handlers/exception.py",
line 41, in inner
response = response_for_exception(request, exc)
File "../python2.7/site-packages/django/core/handlers/exception.py",
line 77, in response_for_exception
response = debug.technical_500_response(request, *sys.exc_info(),
status_code=400)
File "../python2.7/site-packages/django/views/debug.py", line 81, in
technical_500_response
text = reporter.get_traceback_text()
File "../python2.7/site-packages/django/views/debug.py", line 323, in
get_traceback_text
return t.render(c)
File "../python2.7/site-packages/django/template/base.py", line 208, in
render
return self._render(context)
File "../python2.7/site-packages/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "../python2.7/site-packages/django/template/base.py", line 994, in
render
bit = node.render_annotated(context)
File "../python2.7/site-packages/django/template/base.py", line 961, in
render_annotated
return self.render(context)
File "../python2.7/site-packages/django/template/defaulttags.py", line
315, in render
return nodelist.render(context)
File "../python2.7/site-packages/django/template/base.py", line 994, in
render
bit = node.render_annotated(context)
File "../python2.7/site-packages/django/template/base.py", line 961, in
render_annotated
return self.render(context)
File "../python2.7/site-packages/django/template/defaulttags.py", line
159, in render
values = self.sequence.resolve(context, True)
File "../python2.7/site-packages/django/template/base.py", line 711, in
resolve
obj = self.var.resolve(context)
File "../python2.7/site-packages/django/template/base.py", line 852, in
resolve
value = self._resolve_lookup(context)
File "../python2.7/site-packages/django/template/base.py", line 893, in
_resolve_lookup
current = getattr(current, bit)
File "../python2.7/site-packages/django/core/handlers/wsgi.py", line
146, in _get_files
self._load_post_and_files()
File "../python2.7/site-packages/django/http/request.py", line 311, in
_load_post_and_files
self._post, self._files = QueryDict(self.body,
encoding=self._encoding), MultiValueDict()
File "../python2.7/site-packages/django/http/request.py", line 269, in
body
raise RequestDataTooBig('Request body exceeded
settings.DATA_UPLOAD_MAX_MEMORY_SIZE.')
RequestDataTooBig: Request body exceeded
settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
}}}

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

Django

unread,
Feb 8, 2017, 3:37:59 AM2/8/17
to django-...@googlegroups.com
#27820: response_for_exception triggers 500 when exc is RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Amalia Souček | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage:
DATA_UPLOAD_MAX_MEMORY_SIZE, | Unreviewed
RequestDataTooBig, |
response_for_exception, 500 |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Amalia Souček):

Please see https://github.com/django/django/pull/8033.

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

Django

unread,
Feb 8, 2017, 4:44:46 AM2/8/17
to django-...@googlegroups.com
#27820: response_for_exception triggers 500 when exc is RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Amalia Souček | Owner: Amalia
| Souček
Type: Bug | Status: assigned

Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage:
DATA_UPLOAD_MAX_MEMORY_SIZE, | Unreviewed
RequestDataTooBig, |
response_for_exception, 500 |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Amalia Souček):

* owner: nobody => Amalia Souček
* status: new => assigned


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

Django

unread,
Feb 9, 2017, 12:58:45 PM2/9/17
to django-...@googlegroups.com
#27820: RequestDataTooBig/TooManyFields fail to render the debug page

-------------------------------------+-------------------------------------
Reporter: Amalia Souček | Owner: Amalia
| Souček
Type: Bug | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
DATA_UPLOAD_MAX_MEMORY_SIZE, |
RequestDataTooBig, |
response_for_exception, 500 |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* component: Core (Other) => HTTP handling
* stage: Unreviewed => Accepted


Comment:

I'm not certain if the fix is in the best spot. It looks like the issue
also affects `TooManyFields`.

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

Django

unread,
Feb 10, 2017, 3:47:47 AM2/10/17
to django-...@googlegroups.com
#27820: RequestDataTooBig/TooManyFields fail to render the debug page
-------------------------------------+-------------------------------------
Reporter: Amalia Souček | Owner: Amalia
| Souček
Type: Bug | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
DATA_UPLOAD_MAX_MEMORY_SIZE, |
RequestDataTooBig, |
response_for_exception, 500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Amalia Souček):

* needs_better_patch: 1 => 0


Comment:

New pull request. Please see https://github.com/django/django/pull/8042.

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

Django

unread,
Feb 13, 2017, 4:43:38 PM2/13/17
to django-...@googlegroups.com
#27820: RequestDataTooBig/TooManyFields fail to render the debug page
-------------------------------------+-------------------------------------
Reporter: Amalia Souček | Owner: Amalia
| Souček
Type: Bug | Status: closed

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
DATA_UPLOAD_MAX_MEMORY_SIZE, |
RequestDataTooBig, |
response_for_exception, 500 |
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: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"2f10216f84b55920de25422842a66260219e393f" 2f10216]:
{{{
#!CommitTicketReference repository=""
revision="2f10216f84b55920de25422842a66260219e393f"
Fixed #27820 -- Fixed RequestDataTooBig/TooManyFieldsSent crash.
}}}

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

Django

unread,
Feb 13, 2017, 4:43:46 PM2/13/17
to django-...@googlegroups.com
#27820: RequestDataTooBig/TooManyFields fail to render the debug page
-------------------------------------+-------------------------------------
Reporter: Amalia Souček | Owner: Amalia
| Souček
Type: Bug | Status: closed
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
DATA_UPLOAD_MAX_MEMORY_SIZE, |
RequestDataTooBig, |
response_for_exception, 500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"b54fff293846d24b3345a86fea223c93926e0c86" b54fff2]:
{{{
#!CommitTicketReference repository=""
revision="b54fff293846d24b3345a86fea223c93926e0c86"
[1.11.x] Fixed #27820 -- Fixed RequestDataTooBig/TooManyFieldsSent crash.

Backport of 2f10216f84b55920de25422842a66260219e393f from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27820#comment:6>

Django

unread,
Feb 13, 2017, 5:24:58 PM2/13/17
to django-...@googlegroups.com
#27820: RequestDataTooBig/TooManyFields fail to render the debug page
-------------------------------------+-------------------------------------
Reporter: Amalia Souček | Owner: Amalia
| Souček
Type: Bug | Status: closed
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
DATA_UPLOAD_MAX_MEMORY_SIZE, |
RequestDataTooBig, |
response_for_exception, 500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"e399272bed9cf28634a6866bea9bb74c71159291" e399272]:
{{{
#!CommitTicketReference repository=""
revision="e399272bed9cf28634a6866bea9bb74c71159291"
[1.10.x] Fixed #27820 -- Fixed RequestDataTooBig/TooManyFieldsSent crash.

Backport of 2f10216f84b55920de25422842a66260219e393f from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27820#comment:7>

Reply all
Reply to author
Forward
0 new messages