Issue27682
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016-08-04 12:33 by SG, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 9713 | merged | Petter S, 2018-11-04 18:26 | |
PR 13043 | merged | miss-islington, 2019-05-01 17:32 | |
PR 13748 | closed | Petter S, 2019-06-02 18:59 |
Messages (26) | |||
---|---|---|---|
msg271969 - (view) | Author: Sushant (SG) | Date: 2016-08-04 12:33 | |
While saving, this error shows up and is whatever is saving gets saved twice- Traceback (most recent call last): File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 138, in run self.finish_response() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 180, in finish_response self.write(data) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 274, in write self.send_headers() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 332, in send_headers self.send_preamble() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 453, in _write result = self.stdout.write(data) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 593, in write return self._sock.send(b) ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine [04/Aug/2016 17:25:59] "GET /api/importeop/ HTTP/1.1" 500 59 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 51082) Traceback (most recent call last): File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 138, in run self.finish_response() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 180, in finish_response self.write(data) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 274, in write self.send_headers() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 332, in send_headers self.send_preamble() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 453, in _write result = self.stdout.write(data) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 593, in write return self._sock.send(b) ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 141, in run self.handle_error() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\servers\basehttp.py", line 92, in handle_error super(ServerHandler, self).handle_error() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 368, in handle_error self.finish_response() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 180, in finish_response self.write(data) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 274, in write self.send_headers() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 331, in send_headers if not self.origin_server or self.client_is_modern(): File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 344, in client_is_modern return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' TypeError: 'NoneType' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 625, in process_request_thread self.finish_request(request, client_address) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 354, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\servers\basehttp.py", line 99, in __init__ super(WSGIRequestHandler, self).__init__(*args, **kwargs) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 681, in __init__ self.handle() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\servers\basehttp.py", line 179, in handle handler.run(self.server.get_app()) File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 144, in run self.close() File "C:\Users\Sushant Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\simple_server.py", line 36, in close self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split' ---------------------------------------- |
|||
msg271973 - (view) | Author: R. David Murray (r.david.murray) * | Date: 2016-08-04 13:18 | |
The traceback looks like wsgiref.close() was called before handle_error() was called (perhaps for a second time?) We'll probably need a reproducer (as simple as possible please) to debug this further, which might be difficult since it may be tricky to simulate the windows error. But you might also want to, say, post to python-list and see if anyone can spot a problem with your code. Could it be that it is calling wsgiref.close at the wrong time? |
|||
msg271975 - (view) | Author: Sushant (SG) | Date: 2016-08-04 13:40 | |
The code is actually quite simple, I'll post it over here- def import_eop(request): with open('C:/Users/sg/Desktop/projects/drfapi/venv/drf/prices_companies_indices_transpose.csv') as f: contents = f.readlines() dates = contents[0] dates = dates.split(",") dates = dates[1:] d = [] for i in range(len(dates)): d.append(Dates(date=dates[i])) Dates.objects.bulk_create(d) companies = [] entry = [] for i in range(1, len(contents)): csline = contents[i].split(",") prices = csline[1:len(csline)] company = csline[0] prices =[float(x) for x in prices] entry = (Endday(company=company, eop=prices)) entry.save() f.close() print('Saved to database') return HttpResponse('Ok') Now as you see, I'm not even handling wsgiref.close() at all. This isn't a django issue since django community themselves pointed me to this direction. Let me know if I can be of any help. |
|||
msg271977 - (view) | Author: R. David Murray (r.david.murray) * | Date: 2016-08-04 14:05 | |
If the save is happening twice, that must mean that that method is getting called twice, and I'm guessing that the second time it is called wsgiref is closed and thus you get the error. But that's just a guess, your code snippet by itself isn't enough to see how everything fits together. |
|||
msg271984 - (view) | Author: Sushant (SG) | Date: 2016-08-04 14:59 | |
There have been a few times when this code ran perfectly fine, without any errors whatsoever. So the structure is like this- This code reads a csv, processes it and save it in a model- class Endday(models.Model): company = models.TextField(null=True) eop = models.TextField(max_length=100000) Now the database is postgresql, as soon as save is called, data is posted there. This code runs fine on my colleague's computer(same code) but he has windows 7. Thinking this might be a windows error, I re-installed windows 10 from the scratch. But to no help. At last, I had to knock python's door. |
|||
msg271985 - (view) | Author: Sushant (SG) | Date: 2016-08-04 15:01 | |
Also, since I re-installed everything, I got python 3.5 too |
|||
msg271989 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2016-08-04 16:09 | |
Which browser do you use? How big is the CSV file? Modern browsers tend to do aggressive prefetching so this might be the cause here. |
|||
msg271994 - (view) | Author: Sushant (SG) | Date: 2016-08-04 17:49 | |
The CSV is around 75 MB, not that big I guess. And I've tried Chrome, Edge and Firefox |
|||
msg272208 - (view) | Author: Philip Lee (iMath) | Date: 2016-08-09 02:31 | |
I use the following django view function also produce the same exception def sendFiles(request): fileName = request.GET['fileName'] pathToFile = os.path.join(filesDir, fileName) response = FileResponse(open(pathToFile, 'rb')) response['Content-Type'] = 'application/octet-stream' response[ 'Content-Disposition'] = 'attachment; fileName="{}"'.format(fileName) response['Content-Length'] = os.path.getsize(pathToFile) # HttpResponse(open(os.path.join(os.getcwd(), 'LYYDownloaderServer.log'), 'r'), content_type='text/plain') return response Tested with sending file Git-2.8.4-32-bit.exe (29.8MB), if tested with sending file GitHubSetup.exe(670kb),then no exception occurred. the exception like the following return self._sock.send(b) ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接 。 [09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 5 00 59 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 62237) Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 138, in run self.finish_response() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 180, in finish_response self.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 274, in write self.send_headers() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 332, in send_headers self.send_preamble() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 453, in _write result = self.stdout.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socket.py", lin e 593, in write return self._sock.send(b) ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接 。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 141, in run self.handle_error() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 92, in handle_error super(ServerHandler, self).handle_error() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 368, in handle_error self.finish_response() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 180, in finish_response self.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 274, in write self.send_headers() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 331, in send_headers if not self.origin_server or self.client_is_modern(): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 344, in client_is_modern return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' TypeError: 'NoneType' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 625, in process_request_thread self.finish_request(request, client_address) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 354, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 99, in __init__ super(WSGIRequestHandler, self).__init__(*args, **kwargs) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 681, in __init__ self.handle() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 179, in handle handler.run(self.server.get_app()) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 144, in run self.close() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\simple_ server.py", line 36, in close self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split' ---------------------------------------- [09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 2 00 8192 Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 138, in run self.finish_response() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 180, in finish_response self.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 274, in write self.send_headers() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 332, in send_headers self.send_preamble() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 453, in _write result = self.stdout.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socket.py", lin e 593, in write return self._sock.send(b) ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接 。 [09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 5 00 59 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 62229) Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 138, in run self.finish_response() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 180, in finish_response self.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 274, in write self.send_headers() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 332, in send_headers self.send_preamble() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 453, in _write result = self.stdout.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socket.py", lin e 593, in write return self._sock.send(b) ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接 。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 141, in run self.handle_error() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 92, in handle_error super(ServerHandler, self).handle_error() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 368, in handle_error self.finish_response() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 180, in finish_response self.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 274, in write self.send_headers() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 331, in send_headers if not self.origin_server or self.client_is_modern(): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 344, in client_is_modern return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' TypeError: 'NoneType' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 625, in process_request_thread self.finish_request(request, client_address) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 354, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 99, in __init__ super(WSGIRequestHandler, self).__init__(*args, **kwargs) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 681, in __init__ self.handle() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 179, in handle handler.run(self.server.get_app()) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 144, in run self.close() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\simple_ server.py", line 36, in close self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split' ---------------------------------------- [09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 2 00 8192 Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 138, in run self.finish_response() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 180, in finish_response self.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 274, in write self.send_headers() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 332, in send_headers self.send_preamble() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 453, in _write result = self.stdout.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socket.py", lin e 593, in write return self._sock.send(b) ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接 。 [09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 5 00 59 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 62231) Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 138, in run self.finish_response() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 180, in finish_response self.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 274, in write self.send_headers() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 332, in send_headers self.send_preamble() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 453, in _write result = self.stdout.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socket.py", lin e 593, in write return self._sock.send(b) ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接 。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 141, in run self.handle_error() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 92, in handle_error super(ServerHandler, self).handle_error() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 368, in handle_error self.finish_response() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 180, in finish_response self.write(data) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 274, in write self.send_headers() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 331, in send_headers if not self.origin_server or self.client_is_modern(): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 344, in client_is_modern return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' TypeError: 'NoneType' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 625, in process_request_thread self.finish_request(request, client_address) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 354, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 99, in __init__ super(WSGIRequestHandler, self).__init__(*args, **kwargs) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py ", line 681, in __init__ self.handle() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d jango\core\servers\basehttp.py", line 179, in handle handler.run(self.server.get_app()) File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler s.py", line 144, in run self.close() File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\simple_ server.py", line 36, in close self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split' ---------------------------------------- |
|||
msg272228 - (view) | Author: Kristján Valur Jónsson (kristjan.jonsson) * | Date: 2016-08-09 09:45 | |
This error is a protocol error. It is the analog to WSAECONNRESET. ECONNRESET occurs when the local host receives a RST packet from the peer, usually because the peer closed the connection. WSAECONNABORT occurs when the local tcp layer decides that the connection is dead, (it may have sent RST to the peer itself). This can occur for various reasons. Often because the client has cone away, closed the connection or other things. It is best to treat WSACONNRESET as WSACONNABORT, i.e., there was a TCP protocol error and the transaction (http request) probably wasn't completed completely by both parties. See also here: https://www.chilkatsoft.com/p/p_299.asp In your case, I would expect a problem with the client uploading the file. It probably closes the connection after sending the data without waiting for the http response. |
|||
msg272244 - (view) | Author: R. David Murray (r.david.murray) * | Date: 2016-08-09 13:23 | |
Given that django is involved, it looks like it is most likely django that is calling the method after wsgiref is closed. This doesn't *look* like a stdlib problem from what we can see so far, but it certainly could be. We'd need a reproducer that didn't involve django to make any further progress from our side. |
|||
msg272252 - (view) | Author: Kristján Valur Jónsson (kristjan.jonsson) * | Date: 2016-08-09 14:03 | |
As already stated, this error bubbles up from the TCP layer. It means that the tcp stack, for example, gave up resending a tcp frame and timed out, determining that the recipient was no longer listening. You cannot create this error yourself. If you, for example, call s.shutdown(SHUT_WR), you get a WSAESHUTDOWN error. If the connection is closed (via s.close()) you get a EBADF error. Now, the interaction with the client may cause the client to misbehave, but this sort of error is usually either due to the network (other host becomes unreachable) or misconfiguration of the local host's tcp stack. |
|||
msg272255 - (view) | Author: R. David Murray (r.david.murray) * | Date: 2016-08-09 14:17 | |
Kristján: right, what I'm saying about the possible bug is the final part of the traceback resulting from (apparently) wsgiref being closed and a new operation being attempted. *Probably* that is a django bug in handling a network error, but maybe it is a wsgiref bug in handling the network error. (I'm assuming here that the Windows error is triggered by the retry, but I could of course be completely wrong about that.) |
|||
msg310363 - (view) | Author: William Hingston (William Hingston) | Date: 2018-01-20 22:24 | |
I'm still seeing this with Python 3.6.3 Django 2.0.1 Windows 10 Pro Version 1709 Was this determined to be a Django bug? |
|||
msg327564 - (view) | Author: Karthikeyan Singaravelan (xtreak) * | Date: 2018-10-12 06:39 | |
I think this is an issue with wsgiref handling client closure rather than a Windows/Django bug. I saw this sporadically but not consistently while running `make serve` to serve the docs which uses wsgiref simple server to serve docs on my Mac OS. Related issue34547 with a PR that catches ConnectionAbortedError and returns. PR link : https://github.com/python/cpython/pull/9713/ Sample traceback while serving docs locally with `make serve` on Mac OS: 127.0.0.1 - - [12/Oct/2018 10:56:57] "GET /_sources/library/asyncio-eventloop.rst.txt HTTP/1.1" 500 59 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 50436) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 138, in run self.finish_response() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 180, in finish_response self.write(data) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 274, in write self.send_headers() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 332, in send_headers self.send_preamble() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 453, in _write result = self.stdout.write(data) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 796, in write self._sock.sendall(b) BrokenPipeError: [Errno 32] Broken pipe During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 141, in run self.handle_error() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 368, in handle_error self.finish_response() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 180, in finish_response self.write(data) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 274, in write self.send_headers() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 331, in send_headers if not self.origin_server or self.client_is_modern(): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 344, in client_is_modern return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' TypeError: 'NoneType' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 313, in _handle_request_noblock self.process_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 344, in process_request self.finish_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 357, in finish_request self.RequestHandlerClass(request, client_address, self) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 717, in __init__ self.handle() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/simple_server.py", line 133, in handle handler.run(self.server.get_app()) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 144, in run self.close() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/simple_server.py", line 35, in close self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split' Thanks |
|||
msg327571 - (view) | Author: Petter S (Petter S) * | Date: 2018-10-12 08:23 | |
The Github pull request https://github.com/python/cpython/pull/9713 addresses this. |
|||
msg329171 - (view) | Author: Chris Jerdonek (chris.jerdonek) * | Date: 2018-11-02 23:21 | |
This seems like a bug in wsgiref.BaseHandler to me. BaseHandler.run() calls handle_error() if an error occurs inside finish_response(): https://github.com/python/cpython/blob/e2ed5adcb5db2d70cfa72da1ba8446f7aa9e05cd/Lib/wsgiref/handlers.py#L141 However, finish_response() calls close() in its finally block: https://github.com/python/cpython/blob/e2ed5adcb5db2d70cfa72da1ba8446f7aa9e05cd/Lib/wsgiref/handlers.py#L177-L183 |
|||
msg329221 - (view) | Author: Martin Panter (martin.panter) * | Date: 2018-11-04 09:53 | |
There seem to be at least two different issues raised here (and in Issue 34547): 1. Double exceptions due to “self.environ” and “self.status” being None when the error handler is called. This problem was specifically raised in Issue 29183. 2. What to do about exceptions such as ConnectionAbortedError, which are caused by the network or the client, and are outside the server’s control. I find it annoying when these exceptions are logged, and tend to add handlers for these exception types to silence them. I think this is what Petter is trying to do in <https://github.com/python/cpython/pull/9713>. |
|||
msg329248 - (view) | Author: Petter S (Petter S) * | Date: 2018-11-04 18:28 | |
> I think this is what Petter is trying to do in <https://github.com/python/cpython/pull/9713>. That's right. |
|||
msg339438 - (view) | Author: Petter S (Petter S) * | Date: 2019-04-04 09:16 | |
The pull request solves this problem, but the discussion over there is really slow. |
|||
msg341217 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2019-05-01 17:32 | |
New changeset 3d37ea25dc97e4cb024045581979570835deb13c by Berker Peksag (Petter Strandmark) in branch 'master': bpo-27682: Handle client connection terminations in wsgiref (GH-9713) https://github.com/python/cpython/commit/3d37ea25dc97e4cb024045581979570835deb13c |
|||
msg341219 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2019-05-01 17:52 | |
New changeset 47ffc1a9f6fab1c17cdcc325d4af066317369ed7 by Berker Peksag (Miss Islington (bot)) in branch '3.7': bpo-27682: Handle client connection terminations in wsgiref (GH-9713) https://github.com/python/cpython/commit/47ffc1a9f6fab1c17cdcc325d4af066317369ed7 |
|||
msg341220 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2019-05-01 18:01 | |
Thank you! |
|||
msg348301 - (view) | Author: Petter S (Petter S) * | Date: 2019-07-22 18:03 | |
The following message can still appear in the log when running the Django development server: ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 50713) Traceback (most recent call last): File "d:\python37\Lib\socketserver.py", line 650, in process_request_thread self.finish_request(request, client_address) File "d:\python37\Lib\socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "d:\python37\Lib\socketserver.py", line 720, in __init__ self.handle() File "D:\Virtualenvs\***\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle self.handle_one_request() File "D:\Virtualenvs\***\lib\site-packages\django\core\servers\basehttp.py", line 179, in handle_one_request self.raw_requestline = self.rfile.readline(65537) File "d:\python37\Lib\socket.py", line 589, in readinto return self._sock.recv_into(b) ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine ---------------------------------------- This is much better than before but even this message is completely uninteresting as web browsers disconnect from servers all the time. However, this could be better to fix in Django. |
|||
msg348302 - (view) | Author: Petter S (Petter S) * | Date: 2019-07-22 18:12 | |
Could potentially already be fixed in Django: https://github.com/django/django/commit/7785e03ba89aafbd949191f126361fb9103cb980#diff-f6d1c75ec606389da5af6558bf57f171L51 |
|||
msg348303 - (view) | Author: Petter S (Petter S) * | Date: 2019-07-22 18:17 | |
No it is not fixed in Django, but I verified that adding ConnectionAbortedError on this line https://github.com/django/django/blob/c6581a40be3bb4c1e13861f0adbb3fe01f09107f/django/core/servers/basehttp.py#L55 fixes the error. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:34 | admin | set | github: 71869 |
2019-07-22 18:17:19 | Petter S | set | messages: + msg348303 |
2019-07-22 18:12:23 | Petter S | set | messages: + msg348302 |
2019-07-22 18:03:12 | Petter S | set | messages: + msg348301 |
2019-06-02 18:59:29 | Petter S | set | pull_requests: + pull_request13630 |
2019-05-03 08:11:06 | wkoot | set | nosy:
+ wkoot |
2019-05-01 18:01:07 | berker.peksag | set | status: open -> closed versions: - Python 3.5, Python 3.6 messages: + msg341220 resolution: fixed stage: patch review -> resolved |
2019-05-01 17:52:46 | berker.peksag | set | messages: + msg341219 |
2019-05-01 17:32:49 | miss-islington | set | pull_requests: + pull_request12963 |
2019-05-01 17:32:22 | berker.peksag | set | messages: + msg341217 |
2019-04-04 09:16:32 | Petter S | set | messages: + msg339438 |
2019-01-10 12:52:20 | lorcan | set | nosy:
+ lorcan |
2018-11-04 18:28:59 | Petter S | set | messages: + msg329248 |
2018-11-04 18:26:17 | Petter S | set | keywords:
+ patch stage: test needed -> patch review pull_requests: + pull_request9624 |
2018-11-04 09:53:55 | martin.panter | set | nosy:
+ martin.panter messages: + msg329221 |
2018-11-02 23:21:23 | chris.jerdonek | set | nosy:
+ chris.jerdonek messages: + msg329171 |
2018-11-02 23:15:06 | chris.jerdonek | set | title: wsgiref: Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine -> wsgiref BaseHandler / SimpleHandler can raise additional errors when handling an error stage: test needed type: behavior versions: + Python 3.6, Python 3.7, Python 3.8 |
2018-11-02 23:08:33 | chris.jerdonek | link | issue34547 superseder |
2018-10-12 08:23:54 | Petter S | set | nosy:
+ Petter S messages: + msg327571 |
2018-10-12 06:39:52 | xtreak | set | nosy:
+ xtreak messages: + msg327564 |
2018-01-20 22:24:13 | William Hingston | set | nosy:
+ William Hingston messages: + msg310363 |
2016-08-17 13:32:31 | vstinner | set | title: Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine -> wsgiref: Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine |
2016-08-09 14:17:49 | r.david.murray | set | messages: + msg272255 |
2016-08-09 14:03:20 | kristjan.jonsson | set | messages: + msg272252 |
2016-08-09 13:23:25 | r.david.murray | set | messages: + msg272244 |
2016-08-09 09:45:18 | kristjan.jonsson | set | messages: + msg272228 |
2016-08-09 02:31:23 | iMath | set | nosy:
+ iMath messages: + msg272208 |
2016-08-04 17:49:13 | SG | set | messages: + msg271994 |
2016-08-04 16:09:35 | berker.peksag | set | nosy:
+ berker.peksag messages: + msg271989 |
2016-08-04 15:01:30 | SG | set | messages: + msg271985 |
2016-08-04 14:59:17 | SG | set | messages: + msg271984 |
2016-08-04 14:05:44 | r.david.murray | set | messages: + msg271977 |
2016-08-04 13:40:26 | SG | set | nosy:
+ SG messages: + msg271975 |
2016-08-04 13:18:53 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg271973 |
2016-08-04 12:44:11 | SG | set | nosy:
+ pje, kristjan.jonsson, tim.golden, asvetlov, steve.dower, - SG |
2016-08-04 12:33:13 | SG | create |