ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Comfyui stops when I leave my pc

Open BrechtCorbeel opened this issue 1 year ago • 5 comments

Expected Behavior

keep running

Actual Behavior

stops

Steps to Reproduce

happens at random

Debug Logs

/

Other

I've had it multiple times by now that comfy runs for like 5-15 min after I shut off my screens and then return hours later only for nothing to have happened in the mean time and then suddenly as I turn on my screens to check progress that the queue starts again 1-2 min later only for it not to have generated a single image in the time I was not there, very strange behaviour.

BrechtCorbeel avatar Sep 04 '24 14:09 BrechtCorbeel

I'm having a similar issue. I'm launching comfyui from within a tmux virtual terminal on linux - but the server seems to die when the client session goes to sleep - despite the virtual terminal a full queue.

`Traceback (most recent call last): File "/usr/lib/python3.10/asyncio/selector_events.py", line 862, in _read_ready__data_received data = self._sock.recv(self.max_size) TimeoutError: [Errno 110] Connection timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/[USER]/ComfyUI/main.py", line 270, 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 "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/[USER]/ComfyUI/main.py", line 163, in run await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop()) File "/home/[USER]/ComfyUI/server.py", line 739, in publish_loop await self.send(*msg) File "/home/[USER]/ComfyUI/server.py", line 670, in send await self.send_image(data, sid=sid) File "/home/[USER]/ComfyUI/server.py", line 707, in send_image await self.send_bytes(BinaryEventTypes.PREVIEW_IMAGE, preview_bytes, sid=sid) File "/home/[USER]/ComfyUI/server.py", line 717, in send_bytes await send_socket_catch_exception(self.sockets[sid].send_bytes, message) File "/home/[USER]/ComfyUI/server.py", line 40, in send_socket_catch_exception await function(message) File "/home/[USER]/ComfyUI/venv/lib/python3.10/site-packages/aiohttp/web_ws.py", line 394, in send_bytes await self._writer.send(data, binary=True, compress=compress) File "/home/[USER]/ComfyUI/venv/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 724, in send await self._send_frame(message, WSMsgType.BINARY, compress) File "/home/[USER]/ComfyUI/venv/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 688, in _send_frame await self.protocol._drain_helper() File "/home/[USER]/ComfyUI/venv/lib/python3.10/site-packages/aiohttp/base_protocol.py", line 95, in _drain_helper await asyncio.shield(waiter) ConnectionError: Connection lost terminate called without an active exception Aborted (core dumped) `

VeryAngrySquirrel avatar Sep 05 '24 18:09 VeryAngrySquirrel

Me too, exactly the same.

easylolicon avatar Sep 12 '24 03:09 easylolicon

I have the same issue. Running on Runpod with Flux.

2024-09-13T11:02:11.778477815Z   File "/usr/lib/python3.10/asyncio/selector_events.py", line 862, in _read_ready__data_received
2024-09-13T11:02:11.778482425Z     data = self._sock.recv(self.max_size)
2024-09-13T11:02:11.778486145Z ConnectionResetError: [Errno 104] Connection reset by peer
2024-09-13T11:02:11.778489655Z 
2024-09-13T11:02:11.778492965Z The above exception was the direct cause of the following exception:
2024-09-13T11:02:11.778496925Z 
2024-09-13T11:02:11.778499905Z Traceback (most recent call last):
2024-09-13T11:02:11.778503015Z   File "/workspace/ComfyUI/main.py", line 250, in <module>
2024-09-13T11:02:11.778506325Z     loop.run_until_complete(run(server, address=args.listen, port=args.port, verbose=not args.dont_print_server, call_on_start=call_on_start))
2024-09-13T11:02:11.778509785Z   File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
2024-09-13T11:02:11.778513175Z     return future.result()
2024-09-13T11:02:11.778516985Z   File "/workspace/ComfyUI/main.py", line 163, in run
2024-09-13T11:02:11.778520385Z     await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop())
2024-09-13T11:02:11.778524015Z   File "/workspace/ComfyUI/server.py", line 805, in publish_loop
2024-09-13T11:02:11.778527065Z     await self.send(*msg)
2024-09-13T11:02:11.778530225Z   File "/workspace/ComfyUI/server.py", line 736, in send
2024-09-13T11:02:11.778533275Z     await self.send_image(data, sid=sid)
2024-09-13T11:02:11.778536205Z   File "/workspace/ComfyUI/server.py", line 773, in send_image
2024-09-13T11:02:11.778539195Z     await self.send_bytes(BinaryEventTypes.PREVIEW_IMAGE, preview_bytes, sid=sid)
2024-09-13T11:02:11.778542205Z   File "/workspace/ComfyUI/server.py", line 783, in send_bytes
2024-09-13T11:02:11.778545325Z     await send_socket_catch_exception(self.sockets[sid].send_bytes, message)
2024-09-13T11:02:11.778555185Z   File "/workspace/ComfyUI/server.py", line 42, in send_socket_catch_exception
2024-09-13T11:02:11.778558485Z     await function(message)

The only way to avoid a crash seems to be disabling any kind of preview method.

dneckel avatar Sep 13 '24 12:09 dneckel

I think i have the same issue I start my server and then i use comfyui all is ok at this point. I stop to use Comfyui it but still stay in up. I come back and the machine is completely crashed i have to restart entirely it manually. When i don't use comfyui but is launch and not used, the machine don't crash.. it's when i use Cmfyuin after that it will crshed the machine. I tried to clean modules and this is the same. I mean I d'ont understand....

iznogood avatar Apr 23 '25 09:04 iznogood

Please disable all custom nodes and test again.

ltdrdata avatar Apr 27 '25 05:04 ltdrdata

I had similar issue of comfyui going idle after ~10m when set to instant generation even when PC remains powered and up. I was able to resolve by excluding comfyui URL from tab power-saving mode in my browser. (Latest comfyui version are set to stop the generation queue if client (browser) disconnects - and tab in powersave mode is disconnected. )

avnersender avatar May 07 '25 09:05 avnersender

Same error here! Please see the attached log!

We calls the comfyui API to implement the image generation task, and everything works fine. However, if the client stops calling the comfyui API for more than two hours, the problem occurs when calling it again.

Description of the log

line 0 ~ line 816, from 9:42:39 ~ 9:42:40 Client got many 'type=progress_state' logs in 2 seconds.

line 816 ~ line 1211, from 9:42:40 ~ 9:44:02 no log is got from the comfyuiserver more then 1 minute. Actually, from the terminal of comfyui, the tasks is already done! Seems the websocket messages were jammed.

line 1211 ~ line 1272, from 9:44:02 ~ 9:44:02 received the remaining logs

jammed.log

gkn1fexxx avatar Aug 11 '25 07:08 gkn1fexxx