2

I've got this weird behavior. Sometimes, for no reason, on random POST Requests, CsrfViewMiddleware.process_view hangs for ages. Than the entire website becomes unresponsive, than everything gets back to normality.

This server is behind a proxy (squid, I believe) and I'm positive it's something to do with this. I'm in the process of moving the admin out of the proxy, but this has been buggin' me for a long time...

newrelic 001 newrelic 002

Traceback

Internal Server Error: /{{admin-location}}/artigos/artigo/10357/delete/
Traceback (most recent call last):
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/core/handlers/base.py", line 104, in get_response
    response = middleware_method(request, callback, callback_args, callback_kwargs)
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/newrelic-2.44.0.36/newrelic/hooks/framework_django.py", line 226, in wrapper
    return wrapped(*args, **kwargs)
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/middleware/csrf.py", line 174, in process_view
    request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 135, in _get_post
    self._load_post_and_files()
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/http/request.py", line 245, in _load_post_and_files
    self._post, self._files = QueryDict(self.body, encoding=self._encoding), MultiValueDict()
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/http/request.py", line 208, in body
    six.reraise(UnreadablePostError, UnreadablePostError(*e.args), sys.exc_info()[2])
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/http/request.py", line 206, in body
    self._body = self.read()
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/http/request.py", line 267, in read
    six.reraise(UnreadablePostError, UnreadablePostError(*e.args), sys.exc_info()[2])
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/http/request.py", line 265, in read
    return self._stream.read(*args, **kwargs)
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 53, in read
    result = self.buffer + self._read_limited()
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 47, in _read_limited
    result = self.stream.read(size)
  File "{{somepath}}/pyvirt/django17/lib/python2.7/site-packages/newrelic-2.44.0.36/newrelic/api/web_transaction.py", line 767, in read
    data = self.__input.read(*args, **kwargs)
UnreadablePostError: request data read error
  • Possible duplicate: https://stackoverflow.com/questions/12539447/django-unreadableposterror-from-time-to-time? Seems like it's caused by errant POST requests. – Matthew R. Jul 28 '15 at 22:30
  • Maybe but mine are not cancelled posts, the proxy is doing something very wrong... the UnreadablePostError happens because the request itself takes ages to process, this is something to do with the proxy. And why CsrfViewMiddleware.process_view? – Alexei Martchenko Jul 30 '15 at 15:54
  • Another important question: why is it making the entire site unresponsive for 5 minutes? See the NewRelic's gap. – Alexei Martchenko Jul 30 '15 at 16:17

0 Answers0