I am trying to send multiple files(images and audio) from an android device using `MultipartEntityBuilder` (java) with http request. Everytime request including files reaches server and is working as expected but sometimes(10%) django server is not able to read the content of the request.
After going through all the links related to this problem, I come to know that this problem may happen because of the **broken request** That is if someone cancelled the request in between.
As my request is an `AsyncTask` to the request should not break.
> I know this question is already asked. As I didn't get a proper solution from these posts, I want to reopen the issue. So instead of making this as `duplicate` ,please try to give me some light.
Links: -
-
http://stackoverflow.com/questions/15544124/django-unreadableposterror-request-data-read-error -
http://stackoverflow.com/questions/3823280/ioerror-request-data-read-error/7089413Server Log:
Traceback (most recent call last):
File "/var/www/html/prototype/version1/views.py", line 2515, in manage_app_data
print request.FILES
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 165, in _get_files
self._load_post_and_files()
File "/usr/local/lib/python2.7/site-packages/django/http/request.py", line 215, in _load_post_and_files
self._post, self._files = self.parse_file_upload(self.META, data)
File "/usr/local/lib/python2.7/site-packages/django/http/request.py", line 180, in parse_file_upload
return parser.parse()
File "/usr/local/lib/python2.7/site-packages/django/http/multipartparser.py", line 140, in parse
for item_type, meta_data, field_stream in Parser(stream, self._boundary):
File "/usr/local/lib/python2.7/site-packages/django/http/multipartparser.py", line 598, in __iter__
for sub_stream in boundarystream:
File "/usr/local/lib/python2.7/site-packages/django/utils/six.py", line 473, in next
return type(self).__next__(self)
File "/usr/local/lib/python2.7/site-packages/django/http/multipartparser.py", line 415, in __next__
return LazyStream(BoundaryIter(self._stream, self._boundary))
File "/usr/local/lib/python2.7/site-packages/django/http/multipartparser.py", line 441, in __init__
unused_char = self._stream.read(1)
File "/usr/local/lib/python2.7/site-packages/django/http/multipartparser.py", line 315, in read
out = b''.join(parts())
File "/usr/local/lib/python2.7/site-packages/django/http/multipartparser.py", line 308, in parts
chunk = next(self)
File "/usr/local/lib/python2.7/site-packages/django/utils/six.py", line 473, in next
return type(self).__next__(self)
File "/usr/local/lib/python2.7/site-packages/django/http/multipartparser.py", line 330, in __next__
output = next(self._producer)
File "/usr/local/lib/python2.7/site-packages/django/utils/six.py", line 473, in next
return type(self).__next__(self)
File "/usr/local/lib/python2.7/site-packages/django/http/multipartparser.py", line 391, in __next__
data = self.flo.read(self.chunk_size)
File "/usr/local/lib/python2.7/site-packages/django/http/request.py", line 244, in read
six.reraise(UnreadablePostError, UnreadablePostError(*e.args), sys.exc_info()[2])
File "/usr/local/lib/python2.7/site-packages/django/http/request.py", line 242, in read
return self._stream.read(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 51, in read
result = self.buffer + self._read_limited(size - len(self.buffer))
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 39, in _read_limited
result = self.stream.read(size)
UnreadablePostError: request data read error
How to fix ? what is going wrong?