Closed rharder closed 2 months ago
RuntimeError
Traceback (most recent call last)
<ipython-input-38-ba914d8d2dcd> in <module>
38 loop = asyncio.get_event_loop()
39 loop.create_task(setup())
---> 40 loop.run_forever()
41 cv2.imshow("my photo",photo)
c:\users\singhharvin\documents\python36\lib\asyncio\base_events.py in run_forever(self)
552 self._check_closed()
553 if self.is_running():
--> 554 raise RuntimeError('This event loop is already running')
555 if events._get_running_loop() is not None:
556 raise RuntimeError(
RuntimeError: This event loop is already running
still after running your reproduction code
Think this needs clearer steps to reproduce if this is still an issue.
Long story short
When the TCP connection to my websocket server is forcibly closed (outside Python's control, such as with TCPView), there is an infinite loop of Exceptions that my user-level code cannot catch.
Expected behaviour
I would expect to get a connection closed message or exception as with other kinds of service interruptions.
Actual behaviour
I get an infinite loop of exceptions that cannot be caught.
Steps to reproduce
The code below is a smallest-representation of the problem. Run the websocket server on localhost, and connect to it with a client such as the tool at http://www.websocket.org/echo.html?location=ws://localhost:9999 . Then forcibly close the TCP connection using a tool like TCPView to simulate an OS-level event.
Your environment