Django throws ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

ⅰ亾dé卋堺 提交于 2021-01-29 16:39:26

问题


Sorry in advance if my question looks obscure. This is the error thrown by Django when I'm trying to serve multiple Django media(videos) URLs in my React homepage.This is the stacktrace:

    Exception happened during processing of request from ('127.0.0.1', 5511)
  File "D:\Django\myproject\app\env\lib\site-packages\django\core\servers\basehttp.py", line 174, in handle
    self.handle_one_request()
Traceback (most recent call last):
  File "C:\Users\Anshul\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "D:\Django\myproject\app\env\lib\site-packages\django\core\servers\basehttp.py", line 182, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "C:\Users\Anshul\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\Anshul\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
----------------------------------------
  File "C:\Users\Anshul\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "D:\Django\myproject\app\env\lib\site-packages\django\core\servers\basehttp.py", line 174, in handle
    self.handle_one_request()
  File "D:\Django\myproject\app\env\lib\site-packages\django\core\servers\basehttp.py", line 182, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "C:\Users\Anshul\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, 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 the React snippet:

<video 
 preload="metadata"
 id={this.props.id} 
 muted
 ref={this.videoRef}
 onClick={this.play.bind(this,1,this.props.id)} 
 onTimeUpdate={this.updateTime.bind(this,this.props.id)} 
 onCanPlay={this.getReady.bind(this,this.props.id)}> 
       <source src={this.props.source} type="video/mp4"/>
 </video>

where video source refers to django media url provided by drf serializer.E.g

this.props.source = 'http://localhost:8000/media/buck_bunny.mp4'

The homepage contains multiple videos.The media URLs are fetched through API calls.Its a content feed page.Subsequent API calls to fetch media URLs are made when the user scrolls down the homepage for a certain amount. This is where the problem arises. If the user scrolls down very fast then API calls also get executed quickly leading to this error.

来源:https://stackoverflow.com/questions/62456075/django-throws-connectionabortederror-winerror-10053-an-established-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!