UnreadablePostError from time to time?

We have a Django-based web application that is used to receive POST data from iOS devices (push tokens).

In general, the application seems to be working fine, and every hour we get 1000-2000 POST with valid data. However, I sometimes get error logs from Django with the following data:

Traceback (most recent call last): File "/opt/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/opt/local/lib/python2.7/site-packages/django/views/decorators/vary.py", line 19, in inner_func response = func(*args, **kwargs) File "/opt/local/lib/python2.7/site-packages/django_piston-0.2.3-py2.7.egg/piston/resource.py", line 160, in __call__ request.data = request.POST File "/opt/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 180, in _get_post self._load_post_and_files() File "/opt/local/lib/python2.7/site-packages/django/http/__init__.py", line 372, in _load_post_and_files self._post, self._files = QueryDict(self.body, encoding=self._encoding), MultiValueDict() File "/opt/local/lib/python2.7/site-packages/django/http/__init__.py", line 328, in body self._body = self.read() File "/opt/local/lib/python2.7/site-packages/django/http/__init__.py", line 384, in read return self._stream.read(*args, **kwargs) File "/opt/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 98, in read result = self.buffer + self._read_limited() File "/opt/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 92, in _read_limited result = self.stream.read(size) UnreadablePostError: request data read error 

And the WSGIRequest dump says POST: <could not parse>

I am trying to find additional information about this error, and much of what I see indicates this error, caused by the user canceling the POST request before the message ends. Is this a bug that I have to worry about, or should I just configure the server to filter these error messages? I would say that I receive maybe 8-10 automatic emails a day about this.

+6
source share
1 answer

I'm not sure if you are still awaiting an answer, but basically the comments contain most of the information. So, just to close the question ...

These errors mean that the server receives an invalid request. Someone may have canceled their request, or it was crippled in its path (for example, a poor Internet connection), etc.

You cannot solve these errors directly. However, you can take a look at the page (if it is always the same) and see if, for example, loading takes too long. You can also try to raise an error manually to find out exactly when this will happen and why. If you do not find something relevant, I do not think that you need to really worry about it.

+1
source

Source: https://habr.com/ru/post/925964/


All Articles