6

We've got a Django-based web application that is used for receiving POST data from iOS devices (push notification tokens).

All in all, the application seems to be working fine, and we're receiving a 1000-2000 POSTs with valid data every hour. However, I'm occasionally receiving 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've been trying to find more information on this error, and a lot of what I'm seeing points to this error being caused by a user canceling a POST request before the post completes. Is this an error that I should be concerned about, or should I just set up the server to filter out these error messages? I'd say that I get maybe 8-10 automated emails per day about this.

kromenak
  • 479
  • 5
  • 13
  • I think you could safely ignore such broken requests. – demalexx Sep 22 '12 at 08:08
  • 5
    These are cancelled post requests. However, you may need to check that these are genuine cancels or users stopped them because request was taking long time. For later case, you would need to check if there is any bottleneck in your app. – Rohan Sep 22 '12 at 13:44
  • Are these during file upload? If yes - Either the user has uploaded a file, submits, and aborts request, session time out, or the hardware is corrupt, so when it is trying access file contents from some particular memory location, it throws the error due to bad data. – karthikr Sep 22 '12 at 14:07
  • This isn't occurring really with a file upload per say; we are using the Unity game engine, but basically we are doing a POST to a server address that is simply a dictionary like `{"token"="1234567890", "sandbox"="False"}. I suppose someone could cancel the request if they quit the game at just the right time? If not that, then I'll have to check the server for bottlenecks... – kromenak Sep 24 '12 at 22:10

1 Answers1

1

I'm not sure whether you're still waiting for the answer but basically the comments contain most of the information. So, just to close the question up...

These errors mean that a malformed request arrived to the server. Someone might have cancelled their request or it got mangled on its way (e.g. bad internet connection), etc.

You can't solve these errors directly. However you can take a look at the page (if it's always the same one) and check if for example the loading doesn't take too long. You can also try and cause the error manually to see when exactly it happens and why. Unless you find something relevant, I don't think you need to worry about it much.

geckon
  • 8,316
  • 4
  • 35
  • 59