ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的相关的知识,希望对你有一定的参考价值。
参考技术A 原因:ajax默认是异步提交,可是有时候我们会发现,本来要求请求马上出现,可是异步会导致后面突然再执行,这样就出问题了。ajax请求时加上
async : false,
Django ConnectionAbortedError + TypeError + AttributeError
【中文标题】Django ConnectionAbortedError + TypeError + AttributeError【英文标题】: 【发布时间】:2018-02-26 13:00:12 【问题描述】:我正在使用 Python 3.6.0 + django 1.11 + windows 7 64 位
我的网站运行良好,但我不断收到此错误。
ConnectionAbortedError: [WinError 10053] 已建立连接 被主机中的软件中止
TypeError: 'NoneType' 对象不可下标
AttributeError: 'NoneType' 对象没有属性 'split'
为什么我得到这个..?以及如何修复这些错误?
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Python36\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Python36\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[18/Sep/2017 12:25:10] "GET /api/dashboard/workorder_list/6/?format=json&_=1505708684218 HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 32251)
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Python36\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Python36\lib\socketserver.py", line 775, in write
self._sock.sendall(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:\Python36\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 88, in handle_error
super(ServerHandler, self).handle_error()
File "C:\Python36\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python36\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:\Python36\lib\socketserver.py", line 639, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python36\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python36\lib\socketserver.py", line 696, in __init__
self.handle()
File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 155, in handle
handler.run(self.server.get_app())
File "C:\Python36\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python36\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
【问题讨论】:
它试图在 None 对象上“拆分”,在您的情况下是“self.status”所以,您的响应对象由于某种原因没有状态......是你不要设置它(不确定,它应该默认为 200)或者你将它设置为一些无效的值,它可能会被删除......你需要做更多的挖掘...... 你应该在你的代码中使用异常处理... 你可能遇到过known Python Bug。 这是由客户端的 ajax 调用触发的吗?是什么触发了这个? 【参考方案1】:这已在 Python 中得到修复:https://github.com/python/cpython/pull/9713
它将在下一版本的 Python 3.7 及更高版本中提供。
【讨论】:
以上是关于ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的的主要内容,如果未能解决你的问题,请参考以下文章
ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接