Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event loop error in asyncio Lock #7

Closed
dcondic opened this issue Jan 8, 2024 · 23 comments
Closed

Event loop error in asyncio Lock #7

dcondic opened this issue Jan 8, 2024 · 23 comments
Assignees

Comments

@dcondic
Copy link

dcondic commented Jan 8, 2024

Describe the bug
After update 1/8/2024 3:44AM it worked for a while but now gives error every time
asyncio.locks.lock object at 0x00000217c74b1360 [unlocked, waiters:1]> is bound to a different event loop

To Reproduce
occurs in all workflow

Expected behavior
when disabled "ComfyUI-Crystools.disable" everything works again

Screenshots
image

Version:
Loading: ComfyUI-Manager (V1.25.2)
ComfyUI Revision: 1886 [6a10640f] | Released on '2024-01-08'

Additional context
Total VRAM 8191 MB, total RAM 16302 MB
xformers version: 0.0.23.post1+cu118
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3070 : cudaMallocAsync
VAE dtype: torch.bfloat16
Torch version: 2.1.2+cu118

@crystian
Copy link
Owner

crystian commented Jan 8, 2024

@dcondic ok, I will check, but for now, can you try to disable the monitors on settings? I like to know if it is working
thanks!

@crystian
Copy link
Owner

crystian commented Jan 8, 2024

btw, which version of python do you have?

@crystian crystian self-assigned this Jan 8, 2024
@dcondic
Copy link
Author

dcondic commented Jan 8, 2024

crystian thanks for answer

With monitors enabled same error happend
image
image

as you suggested:
With monitors disabled everything works fine
image

Python ver.
image

@ada-lovecraft
Copy link

ada-lovecraft commented Jan 8, 2024

Adding to this:

Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\dev-tools\stable-diffusion\Comfy-UI\main.py", line 241, 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 "C:\ProgramData\anaconda3\envs\comfy\Lib\asyncio\base_events.py", line 650, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "D:\dev-tools\stable-diffusion\Comfy-UI\main.py", line 143, in run
    await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop())
  File "D:\dev-tools\stable-diffusion\Comfy-UI\server.py", line 624, in publish_loop
    await self.send(*msg)
  File "D:\dev-tools\stable-diffusion\Comfy-UI\server.py", line 559, in send
    await self.send_json(event, data, sid)
  File "D:\dev-tools\stable-diffusion\Comfy-UI\server.py", line 612, in send_json
    await send_socket_catch_exception(self.sockets[sid].send_json, message)
  File "D:\dev-tools\stable-diffusion\Comfy-UI\server.py", line 40, in send_socket_catch_exception
    await function(message)
  File "C:\ProgramData\anaconda3\envs\comfy\Lib\site-packages\aiohttp\web_ws.py", line 352, in send_json
    await self.send_str(dumps(data), compress=compress)
  File "C:\ProgramData\anaconda3\envs\comfy\Lib\site-packages\aiohttp\web_ws.py", line 336, in send_str
    await self._writer.send(data, binary=False, compress=compress)
  File "C:\ProgramData\anaconda3\envs\comfy\Lib\site-packages\aiohttp\http_websocket.py", line 729, in send
    await self._send_frame(message, WSMsgType.TEXT, compress)
  File "C:\ProgramData\anaconda3\envs\comfy\Lib\site-packages\aiohttp\http_websocket.py", line 644, in _send_frame
    message = await compressobj.compress(message)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\comfy\Lib\site-packages\aiohttp\compression_utils.py", line 71, in compress
    async with self._compress_lock:
  File "C:\ProgramData\anaconda3\envs\comfy\Lib\asyncio\locks.py", line 15, in __aenter__
    await self.acquire()
  File "C:\ProgramData\anaconda3\envs\comfy\Lib\asyncio\locks.py", line 106, in acquire
    fut = self._get_loop().create_future()
          ^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\comfy\Lib\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 0x00000160D0C32550 [unlocked, waiters:1]> is bound to a different event loop

workflow (1)

Python 3.11

I hope we can get this fixed because this immediately became an essential tool for me. I use ComfyUI remotely from the install and being able to see the resource usage is super helpful.

@crystian
Copy link
Owner

crystian commented Jan 8, 2024

Remotely? Can you explain it to me, please? Because I think the reason can come from there
Thanks!

@crystian
Copy link
Owner

crystian commented Jan 8, 2024

I didn't test with colab or others ¯_(ツ)_/¯

@ada-lovecraft
Copy link

It's running on my pc on my local network. Happens when I sit at the computer and use the same workflow, lol. It's not running in a cloud environment or anything.

@crystian
Copy link
Owner

crystian commented Jan 8, 2024

@ada-lovecraft Oh, ok hehe, I'll check right now, meantime you can deactivate the monitors from the settings

@crystian
Copy link
Owner

crystian commented Jan 8, 2024

btw, I tried it on colab and works! :)

@crystian
Copy link
Owner

crystian commented Jan 9, 2024

@crystian
Copy link
Owner

crystian commented Jan 9, 2024

Could you test it? @ada-lovecraft @dcondic on dev

@LuckyFan
Copy link

LuckyFan commented Jan 9, 2024

Hi @crystian
I tested your dev branch, it still happens, but not causing Comfyui to quit anymore like before
image

But the gadgets stopped working
image

@crystian
Copy link
Owner

crystian commented Jan 9, 2024

@LuckyFan thanks! I release that and still working on it

@crystian
Copy link
Owner

crystian commented Jan 9, 2024

I tried different scenarios, and I can't reproduce it :(

May you reinstall all dependencies again (removing venv folder)

You can use something like my gist to install ComfyUI with some extensions in less than 10 minutes

@crystian
Copy link
Owner

crystian commented Jan 9, 2024

the same for you @dcondic and @ada-lovecraft , thanks

@snottyone
Copy link

snottyone commented Jan 10, 2024

i got the same error, comfyui dies in the background
first sign is that the graphs stop working (except the progress bar)
or comfyui just crashes without that happening first
happens so often (as in: every ~5th runs) that i removed the whole package for now

edit to add: whole SD installation is a few days old, so no ancient python etc

@crystian
Copy link
Owner

crystian commented Jan 10, 2024

I need more info @snottyone please, copy, paste and refill:


Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Please attach a workflow file to make it easier for others to reproduce the error!

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Error in console:
If applicable, add the error message from the console.

Versions:
Copy the output of the console (4 parts), like this:

** Python version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Total VRAM 12287 MB, total RAM 130996 MB
Set vram state to: NORMAL_VRAM
### Loading: ComfyUI-Manager (V1.25.3)
### ComfyUI Revision: 1886 [6a10640f] | Released on '2024-01-08'
[Crystools INFO] Crystools version: 1.4.0
[Crystools INFO] CPU: AMD Ryzen 9 5950X 16-Core Processor - Arch: AMD64 - OS: Windows 10
[Crystools INFO] NVIDIA Driver detected - 546.33 - cuda:0 NVIDIA GeForce RTX 3080 Ti : cudaMallocAsync

Additional context
Add any other context about the problem here.

@crystian
Copy link
Owner

crystian commented Jan 10, 2024

I made a change, it (may) will fix this issue, it is on dev; if you want to try it, you need to do:

cd custom_nodes\ComfyUI-Crystools
git checkout -b dev origin/dev

@snottyone
Copy link

I made a change, it (may) will fix this issue, it is on dev; if you want to try it, you need to do:

for me, fixed it, thank you very much :)

@crystian
Copy link
Owner

just for the check, on dev? @snottyone

@ada-lovecraft
Copy link

@crystian I'll install the latest dev version and give it a try.

@snottyone
Copy link

just for the check, on dev? @snottyone

yes, followed your instructions, dev works like charm

@crystian
Copy link
Owner

Merge! You can install it normally; thanks for your help! @snottyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants