comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
52.49k stars 5.54k forks source link

Windows `ConnectionResetError: Cannot write to closing transport` #651

Open space-nuko opened 1 year ago

space-nuko commented 1 year ago

Sometimes when refreshing the page I get this error on the backend:

Traceback ``` Exception in callback _ProactorBasePipeTransport._call_connection_lost(None) handle: Traceback (most recent call last): File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 165, in _call_connection_lost self._sock.shutdown(socket.SHUT_RDWR) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host Exception in callback _ProactorBasePipeTransport._call_connection_lost(None) handle: Traceback (most recent call last): File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 165, in _call_connection_lost self._sock.shutdown(socket.SHUT_RDWR) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host Exception in callback _ProactorBasePipeTransport._call_connection_lost(None) handle: Traceback (most recent call last): File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 165, in _call_connection_lost self._sock.shutdown(socket.SHUT_RDWR) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host Exception in callback _ProactorBasePipeTransport._call_connection_lost(None) handle: Traceback (most recent call last): File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 165, in _call_connection_lost self._sock.shutdown(socket.SHUT_RDWR) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host Exception in callback _ProactorBasePipeTransport._call_connection_lost(None) handle: Traceback (most recent call last): File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 165, in _call_connection_lost self._sock.shutdown(socket.SHUT_RDWR) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host Exception in callback _ProactorBasePipeTransport._call_connection_lost(None) handle: Traceback (most recent call last): File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 165, in _call_connection_lost self._sock.shutdown(socket.SHUT_RDWR) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host Traceback (most recent call last): File "E:\ComfyUI\main.py", line 111, in loop.run_until_complete(run(server, address=args.listen, port=args.port, verbose=not args.dont_print_server, call_on_start=call_on_start)) File "C:\Users\a\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete 14%|████████████████████▉ | 1411/10000 [09:29<1:09:33, 2.06it/s] return future.result() File "E:\ComfyUI\main.py", line 40, in run await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop()) File "E:\ComfyUI\server.py", line 398, in publish_loop await self.send(*msg) File "E:\ComfyUI\server.py", line 386, in send await self.sockets[sid].send_str(message) File "E:\build\ComfyUI\venv\lib\site-packages\aiohttp\web_ws.py", line 308, in send_str await self._writer.send(data, binary=False, compress=compress) File "E:\build\ComfyUI\venv\lib\site-packages\aiohttp\http_websocket.py", line 690, in send await self._send_frame(message, WSMsgType.TEXT, compress) File "E:\build\ComfyUI\venv\lib\site-packages\aiohttp\http_websocket.py", line 653, in _send_frame self._write(header + message) File "E:\build\ComfyUI\venv\lib\site-packages\aiohttp\http_websocket.py", line 663, in _write raise ConnectionResetError("Cannot write to closing transport") ConnectionResetError: Cannot write to closing transport ```

And then the entire backend crashes so I have to restart it

S0LTIS commented 10 months ago

Don't use "refresh"(via browser)(F5), If you have to "refresh" then re-start all comfyui.