Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#27820 closed Bug (fixed)

RequestDataTooBig/TooManyFields fail to render the debug page

Reported by: Amalia Souček Owned by: Amalia Souček
Component: HTTP handling Version: 1.10
Severity: Normal Keywords: DATA_UPLOAD_MAX_MEMORY_SIZE, RequestDataTooBig, response_for_exception, 500
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (7)

comment:2 by Amalia Souček, 7 years ago

Owner: changed from nobody to Amalia Souček
Status: newassigned

comment:3 by Tim Graham, 7 years ago

Component: Core (Other)HTTP handling
Has patch: set
Patch needs improvement: set
Summary: response_for_exception triggers 500 when exc is RequestDataTooBigRequestDataTooBig/TooManyFields fail to render the debug page
Triage Stage: UnreviewedAccepted

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

comment:4 by Amalia Souček, 7 years ago

Patch needs improvement: unset

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

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

Resolution: fixed
Status: assignedclosed

In 2f10216:

Fixed #27820 -- Fixed RequestDataTooBig/TooManyFieldsSent crash.

comment:6 by Tim Graham <timograham@…>, 7 years ago

In b54fff2:

[1.11.x] Fixed #27820 -- Fixed RequestDataTooBig/TooManyFieldsSent crash.

Backport of 2f10216f84b55920de25422842a66260219e393f from master

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

In e399272:

[1.10.x] Fixed #27820 -- Fixed RequestDataTooBig/TooManyFieldsSent crash.

Backport of 2f10216f84b55920de25422842a66260219e393f from master

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