Django ConnectionAbortedError:[WinError 10053]已建立的连接已被主机中的软件中止

时间:2016-08-02 13:12:52

标签: python django postgresql

我正在使用django和postgresql,每当我尝试保存或删除任何内容时,都会发生此错误 -

Traceback (most recent call last):
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
Not Found: /favicon.ico
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
[02/Aug/2016 18:30:14] "GET /favicon.ico HTTP/1.1" 404 2044
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "c:\program files (x86)\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
[02/Aug/2016 18:30:14] "GET /api/delete/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 1712)
Traceback (most recent call last):
 File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "c:\program files (x86)\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:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "c:\program files (x86)\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:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\sushant\Desktop\projects\drfapi\venv\lib\site-packages\django\core\servers\basehttp.py", line 92, in handle_error
super(ServerHandler, self).handle_error()
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "c:\program files (x86)\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:\program files (x86)\python35-32\Lib\socketserver.py", line 628, in process_request_thread
self.finish_request(request, client_address)
File "c:\program files (x86)\python35-32\Lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\sushant\Desktop\projects\drfapi\venv\lib\site-packages\django\core\servers\basehttp.py", line 99, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "c:\program files (x86)\python35-32\Lib\socketserver.py", line 684, in __init__
self.handle()
File "C:\Users\sushant\Desktop\projects\drfapi\venv\lib\site-packages\django\core\servers\basehttp.py", line 179, in handle
handler.run(self.server.get_app())
File "c:\program files (x86)\python35-32\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "c:\program files (x86)\python35-32\Lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------

每当有数据库save \ delete命令时,会发生两次,第一次没有错误,第二次,抛出此错误,因此,保存两次。

据我所知,有些程序会阻止它(正如错误所示)所以我删除了我所拥有的反病毒但没有任何结论。

有谁知道这是怎么回事?

修改:这是一个Python错误,报告here

6 个答案:

答案 0 :(得分:1)

我已经在Python中检查了此修复程序:https://github.com/python/cpython/pull/9713

它将在下一版Python 3.7和更高版本中提供。

答案 1 :(得分:0)

即使使用Python 3.6.5和django 2.0

,我也遇到了这个错误

我注意到浏览器调试器的网络选项卡中有301个重定向。当我通过在我的html / js中为所有url / api调用添加尾部反斜杠来修复它们时,这个问题就消失了。 urlconf也必须有尾部反斜杠。

答案 2 :(得分:0)

我正在制作一个Web应用程序,并且在Windows 10,python 3.7.6,django 3.0.8中遇到了相同的问题。我尝试了很多东西,终于找到了解决方法。

我正在使用一种称为js函数onsubmit的表单,该表单又发送了一个REST调用,该调用被“ [WinError 10053]在主机提示符下的软件中的软件中止”错误终止。

我添加了参数method ='post',并在js函数中使用了jQuery.ajax,并在函数中添加了event.preventDefault()以及一些成功和失败的回调。我不明白为什么,但是现在我没有得到错误。

希望这对使用js和HTML表单的人有所帮助,直到问题被根源解决。

Github bug正在跟踪问题

答案 3 :(得分:0)

我遇到了相同的错误:ConnectionAbortedError:[WinError 10053]。 Python版本:3.8.1

我重新启动计算机,错误消失了

答案 4 :(得分:0)

这是我过去发生的事情: 就我而言: 我首先在firefox中打开它,然后遇到此错误。 然后我在Microsoft Edge中将其打开,错误消失了。 尝试这个: 在其他浏览器中打开服务器URL,然后查看结果必须正常。

答案 5 :(得分:0)

<块引用>

ConnectionAbortedError: [WinError 10053] 已建立的连接被主机中的软件中止

如果您正在处理视频,当您在视频上传到数据库时发出另一个请求时会发生这种情况。 我建议您在视频标签中使用 preload='none' 或在视频上传时阻止新请求。