#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:1 by , 9 years ago
comment:2 by , 9 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
comment:3 by , 9 years ago
| Component: | Core (Other) → HTTP handling | 
|---|---|
| Has patch: | set | 
| Patch needs improvement: | set | 
| Summary: | response_for_exception triggers 500 when exc is RequestDataTooBig → RequestDataTooBig/TooManyFields fail to render the debug page | 
| Triage Stage: | Unreviewed → Accepted | 
I'm not certain if the fix is in the best spot. It looks like the issue also affects TooManyFields.
comment:4 by , 9 years ago
| Patch needs improvement: | unset | 
|---|
New pull request. Please see https://github.com/django/django/pull/8042.
  Note:
 See   TracTickets
 for help on using tickets.
    
Please see https://github.com/django/django/pull/8033.