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.98k stars 5.61k forks source link

`No route to host` exception when accessing UI remotely #1442

Open WeeBull opened 1 year ago

WeeBull commented 1 year ago

Git Version: 5f101f4da14e0b4a360ca1d0c380fab174d301bf (31st Aug)

Steps to reproduce:

  1. Start ComfyUI with --listen so that connections can be made from other machines
  2. Connect from a laptop
  3. Setup and queue jobs which will take a long time to complete
  4. Sleep the laptop so it is no longer accessible over the network

Expected behaviour:

ComfyUI would continue with the flow without issue.

Observed behaviour:

ComfyUI will crash with the following traceback (I think it's when it wants to update preview images in the UI)

Traceback (most recent call last):
  File "/home/pauls/StableDiffusion/ComfyUI/./main.py", line 187, in <module>
    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 "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/pauls/StableDiffusion/ComfyUI/./main.py", line 102, in run
    await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop())
  File "/home/pauls/StableDiffusion/ComfyUI/server.py", line 603, in publish_loop
    await self.send(*msg)
  File "/home/pauls/StableDiffusion/ComfyUI/server.py", line 536, in send
    await self.send_image(data, sid=sid)
  File "/home/pauls/StableDiffusion/ComfyUI/server.py", line 573, in send_image
    await self.send_bytes(BinaryEventTypes.PREVIEW_IMAGE, preview_bytes, sid=sid)
  File "/home/pauls/StableDiffusion/ComfyUI/server.py", line 582, in send_bytes
    await send_socket_catch_exception(self.sockets[sid].send_bytes, message)
  File "/home/pauls/StableDiffusion/ComfyUI/server.py", line 40, in send_socket_catch_exception
    await function(message)
  File "/home/pauls/StableDiffusion/ComfyUI/venv/lib/python3.11/site-packages/aiohttp/web_ws.py", line 315, in send_bytes
    await self._writer.send(data, binary=True, compress=compress)
  File "/home/pauls/StableDiffusion/ComfyUI/venv/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 688, in send
    await self._send_frame(message, WSMsgType.BINARY, compress)
  File "/home/pauls/StableDiffusion/ComfyUI/venv/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 659, in _send_frame
    await self.protocol._drain_helper()
  File "/home/pauls/StableDiffusion/ComfyUI/venv/lib/python3.11/site-packages/aiohttp/base_protocol.py", line 90, in _drain_helper
    await asyncio.shield(waiter)
  File "/usr/lib/python3.11/asyncio/selector_events.py", line 995, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 113] No route to host
terminate called without an active exception
TijuanaKez commented 2 months ago

Getting this now, never used to before. Loosing the process and the queue is becoming a huge problem. Why Comfy doesn't store everything it needs for the queue locally is beyond me. Having the entire queue clear when it crashes is also a great way of loosing a lot of time and effort, and is immensely frustrating.