RuntimeError: <asyncio.locks.Lock object at 0x000002A79E6B2B50 [unlocked, waiters:1]> is bound to a different event loop
Open
whmc76
opened this issue 1 year ago
•
11 comments
Traceback (most recent call last):
File "E:\IMAGE\ComfyUI-base-py311-0329\ComfyUI\main.py", line 254, 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 "asyncio\base_events.py", line 654, in run_until_complete
File "E:\IMAGE\ComfyUI-base-py311-0329\ComfyUI\main.py", line 149, in run
await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop())
File "E:\IMAGE\ComfyUI-base-py311-0329\ComfyUI\server.py", line 621, in publish_loop
await self.send(*msg)
File "E:\IMAGE\ComfyUI-base-py311-0329\ComfyUI\server.py", line 556, in send
await self.send_json(event, data, sid)
File "E:\IMAGE\ComfyUI-base-py311-0329\ComfyUI\server.py", line 607, in send_json
await send_socket_catch_exception(ws.send_json, message)
File "E:\IMAGE\ComfyUI-base-py311-0329\ComfyUI\server.py", line 35, in send_socket_catch_exception
await function(message)
File "E:\IMAGE\ComfyUI-base-py311-0329\python_embeded\Lib\site-packages\aiohttp\web_ws.py", line 351, in send_json
await self.send_str(dumps(data), compress=compress)
File "E:\IMAGE\ComfyUI-base-py311-0329\python_embeded\Lib\site-packages\aiohttp\web_ws.py", line 335, in send_str
await self._writer.send(data, binary=False, compress=compress)
File "E:\IMAGE\ComfyUI-base-py311-0329\python_embeded\Lib\site-packages\aiohttp\http_websocket.py", line 729, in send
await self._send_frame(message, WSMsgType.TEXT, compress)
File "E:\IMAGE\ComfyUI-base-py311-0329\python_embeded\Lib\site-packages\aiohttp\http_websocket.py", line 644, in _send_frame
message = await compressobj.compress(message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\IMAGE\ComfyUI-base-py311-0329\python_embeded\Lib\site-packages\aiohttp\compression_utils.py", line 71, in compress
async with self._compress_lock:
File "asyncio\locks.py", line 15, in aenter
File "asyncio\locks.py", line 106, in acquire
File "asyncio\mixins.py", line 20, in _get_loop
RuntimeError: <asyncio.locks.Lock object at 0x000002A79E6B2B50 [unlocked, waiters:1]> is bound to a different event loop
raceback (most recent call last):
File "/home/kewk/AI/ComfyUI/main.py", line 254, 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 "/home/kewk/anaconda3/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/kewk/AI/ComfyUI/main.py", line 149, in run
await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop())
File "/home/kewk/AI/ComfyUI/server.py", line 621, in publish_loop
await self.send(*msg)
File "/home/kewk/AI/ComfyUI/server.py", line 556, in send
await self.send_json(event, data, sid)
File "/home/kewk/AI/ComfyUI/server.py", line 607, in send_json
await send_socket_catch_exception(ws.send_json, message)
File "/home/kewk/AI/ComfyUI/server.py", line 35, in send_socket_catch_exception
await function(message)
File "/home/kewk/anaconda3/lib/python3.11/site-packages/aiohttp/web_ws.py", line 351, in send_json
await self.send_str(dumps(data), compress=compress)
File "/home/kewk/anaconda3/lib/python3.11/site-packages/aiohttp/web_ws.py", line 335, in send_str
await self._writer.send(data, binary=False, compress=compress)
File "/home/kewk/anaconda3/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 729, in send
await self._send_frame(message, WSMsgType.TEXT, compress)
File "/home/kewk/anaconda3/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 644, in _send_frame
message = await compressobj.compress(message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kewk/anaconda3/lib/python3.11/site-packages/aiohttp/compression_utils.py", line 71, in compress
async with self._compress_lock:
File "/home/kewk/anaconda3/lib/python3.11/asyncio/locks.py", line 15, in aenter
await self.acquire()
File "/home/kewk/anaconda3/lib/python3.11/asyncio/locks.py", line 106, in acquire
fut = self._get_loop().create_future()
^^^^^^^^^^^^^^^^
File "/home/kewk/anaconda3/lib/python3.11/asyncio/mixins.py", line 20, in _get_loop
raise RuntimeError(f'{self!r} is bound to a different event loop')
RuntimeError: <asyncio.locks.Lock object at 0x792c6443d850 [unlocked, waiters:1]> is bound to a different event loop
I need more information about it; I don't have any other report about it (I'm the author of crystools)
dude, I like your plugin so much, and I don't think the root of this problem is yours, but I don't know how to provide you with more information. Do you have any good suggestions?
This appears to be caused by a misconfiguration of threads and async, and it seems difficult to pinpoint because there are so many custom nodes that could cause this issue.
Check if you are using comfyui-deploy, LCM_Inpaint-Outpaint_Comfy, or comfyui-profiler.
These nodes use both thread and send_json.
Just wanted to note that I am also seeing this sort of error fairly frequently. Please let me know what type of information may help to identify root cause and resolve?
This appears to be caused by a misconfiguration of threads and async, and it seems difficult to pinpoint because there are so many custom nodes that could cause this issue.
Check if you are using comfyui-deploy, LCM_Inpaint-Outpaint_Comfy, or comfyui-profiler. These nodes use both thread and send_json.
I am seeing this error and have profiler. I am going to remove it and see if it goes away. I'll report back if that could be the issue.
I'm also having the issue with comfyui-profiler installed.
Is there any talk of adding a built-in profiling feature to Comfy? Seems like it would useful for just about everyone. And then there wouldn't be a third party tool patching into the execution flow. Profiler also broke temporarily with the most recent release.