Re: Http request with multiple files is not able to read by django server
Den 25/04/2014 kl. 14.39 skrev kousik chowdhury: > 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. Clients can still abort the request or close the connection in many ways - the client application crashing, the device crashing, shutting down or running out of battery, losing network connection or switching networks etc. You should probably just ignore these errors unless you suspect the error is happening despite any of the above reasons. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/F66FD1CA-855F-448B-8E18-53A09601C2BC%40cederstrand.dk. For more options, visit https://groups.google.com/d/optout.
RE: Http request with multiple files is not able to read by django server
Hello, There may be some web-proxy between client and server that limits request size or time. Server may limit it as well. * Remove all proxies between client and server * Try to use different client (browser for example) * Check your server configuration for request size and timeout. Ilya Kazakevich, JetBrains PyCharm (Best Python/Django IDE) http://www.jetbrains.com/pycharm/ "Develop with pleasure!" >-Original Message- >From: django-users@googlegroups.com >[mailto:django-users@googlegroups.com] On Behalf Of kousik chowdhury >Sent: Friday, April 25, 2014 4:39 PM >To: django-users@googlegroups.com >Subject: Http request with multiple files is not able to read by django server > >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-req >uest-data-read-error > > - >http://stackoverflow.com/questions/3823280/ioerror-request-data-read-error/7 >089413 > > > > > >Server 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? > > >-- >You received this message because you are subscribed to the Google Groups >"Django users" group. >To unsubscribe from this group and stop receiving emails from it, send an >email to
Http request with multiple files is not able to read by django server
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/7089413 Server 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? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f58b9cb-4ca6-48d6-aab4-649ec024142b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.