Skip to content

RuntimeError: Event loop is closed #117

@Chaoses-Ib

Description

@Chaoses-Ib

Originally commented at r/comfyui:

Clearly there is something I'm not understanding.. I codify a workflow without a problem, but after the "with workflow()" .. Section if I want to do anything process of the image output I get (save, view, etc):

ComfyScript: Failed to watch, will retry in 5 seconds: Event loop is closed

Traceback (most recent call last):
  File "/[..]/ComfyScript/.venv/lib/python3.13/site-packages/comfy_script/runtime/__init__.py", line 482, in _watch
    await task._set_results_threadsafe(outputs, self._watch_display_task)
  File "/[..]/ComfyScript/.venv/lib/python3.13/site-packages/comfy_script/runtime/__init__.py", line 826, in _set_results_threadsafe
    self.get_loop().call_soon_threadsafe(f)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/[..]/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 878, in call_soon_threadsafe
    self._check_closed()
    ~~~~~~~~~~~~~~~~~~^^
  File "/[..]/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 556, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

And there is no documentation on how to properly shutdown the connection. It doesn't affect the processing I'm doing afterwards, but it is annoying and unsightly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingruntime

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions