[GH-ISSUE #357] Server refuses to shutdown (w/ ctrl+c) if ComfyUI-Manager is installed #182

Closed
opened 2026-10-27 21:14:22 +00:00 by bsakaguchi · 6 comments
Owner

Originally created by @rgthree on GitHub (Jan 23, 2024).
Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/357

At some point recently we can no longer press ctrl + c alone to shutdown ComfyUI. This only happens when ComfyUI-Manager is installed. On windows, portable.

When ctrl+c is pressed, nothing happens in the terminal, until another http request is attempted (browser refresh button, new tab and navigate, etc.).

Originally created by @rgthree on GitHub (Jan 23, 2024). Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/357 At some point recently we can no longer press `ctrl + c` alone to shutdown ComfyUI. This only happens when ComfyUI-Manager is installed. On windows, portable. When ctrl+c is pressed, nothing happens in the terminal, until another http request is attempted (browser refresh button, new tab and navigate, etc.).
Author
Owner

@rgthree commented on GitHub (Jan 23, 2024):

A reset --hard to a farther back commit works as expected (ctrl + c stops the server immediately). I can binary search for the culprit...

EDIT: Looks like it's github.com/ltdrdata/ComfyUI-Manager@b4ffaee5dc, specifically this addition in prestartup_script.py:

if platform.system() == 'Windows':
    try:
        import asyncio
        import asyncio.windows_events
        asyncio.set_event_loop_policy(asyncio.windows_events.WindowsSelectorEventLoopPolicy())
        print(f"[ComfyUI-Manager] Windows event loop policy mode enabled")
    except Exception as e:
        print(f"[ComfyUI-Manager] WARN: Windows initialization fail: {e}")

FYI, removing/commenting this addition fixes the issue here (server stops as expected) and seems to have no further issues on my setup.

<!-- gh-comment-id:1905135586 --> @rgthree commented on GitHub (Jan 23, 2024): A `reset --hard` to a farther back commit works as expected (ctrl + c stops the server immediately). I can binary search for the culprit... EDIT: Looks like it's https://github.com/ltdrdata/ComfyUI-Manager/commit/b4ffaee5dc3b9568161314846eca26b924339c78, specifically this addition in `prestartup_script.py`: ```python if platform.system() == 'Windows': try: import asyncio import asyncio.windows_events asyncio.set_event_loop_policy(asyncio.windows_events.WindowsSelectorEventLoopPolicy()) print(f"[ComfyUI-Manager] Windows event loop policy mode enabled") except Exception as e: print(f"[ComfyUI-Manager] WARN: Windows initialization fail: {e}") ``` FYI, removing/commenting this addition fixes the issue here (server stops as expected) and seems to have no further issues on my setup.
Author
Owner

@ltdrdata commented on GitHub (Jan 24, 2024):

This patch is related to the issue at https://github.com/ltdrdata/ComfyUI-Manager/issues/339. The problem is occurring on Windows.
It seems like some thoughtful consideration may be needed.

What is your Windows version?

<!-- gh-comment-id:1907175652 --> @ltdrdata commented on GitHub (Jan 24, 2024): This patch is related to the issue at https://github.com/ltdrdata/ComfyUI-Manager/issues/339. The problem is occurring on Windows. It seems like some thoughtful consideration may be needed. What is your Windows version?
Author
Owner

@rgthree commented on GitHub (Jan 24, 2024):

I'm on Windows 11 Pro, Version: 23H2, OS Build: 22631.3007

<!-- gh-comment-id:1907247577 --> @rgthree commented on GitHub (Jan 24, 2024): I'm on Windows 11 Pro, Version: 23H2, OS Build: 22631.3007
Author
Owner

@ltdrdata commented on GitHub (Jan 25, 2024):

Now this is optional (default false)
https://github.com/ltdrdata/ComfyUI-Manager?tab=readme-ov-file#troubleshooting

<!-- gh-comment-id:1909252180 --> @ltdrdata commented on GitHub (Jan 25, 2024): Now this is optional (default false) https://github.com/ltdrdata/ComfyUI-Manager?tab=readme-ov-file#troubleshooting
Author
Owner

@rgthree commented on GitHub (Jan 25, 2024):

Groovy, thanks!

Though, I think there's a bug on line 470, that 'bypass_ssl' is likely meant to be 'windows_selector_event_loop_policy':

- if 'bypass_ssl' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true':
+ if 'windows_selector_event_loop_policy' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true':

Shouldn't really matter since there's an outer try/except.. I guess unless someone has windows_selector_event_loop_policy and not bypass_ssl defined.

<!-- gh-comment-id:1909284450 --> @rgthree commented on GitHub (Jan 25, 2024): Groovy, thanks! Though, I think there's a bug on line 470, that `'bypass_ssl'` is likely meant to be `'windows_selector_event_loop_policy'`: ```diff - if 'bypass_ssl' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true': + if 'windows_selector_event_loop_policy' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true': ``` Shouldn't really matter since there's an outer try/except.. I guess unless someone has windows_selector_event_loop_policy and _not_ bypass_ssl defined.
Author
Owner

@ltdrdata commented on GitHub (Jan 25, 2024):

Groovy, thanks!

Though, I think there's a bug on line 470, that 'bypass_ssl' is likely meant to be 'windows_selector_event_loop_policy':

- if 'bypass_ssl' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true':
+ if 'windows_selector_event_loop_policy' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true':

Shouldn't really matter since there's an outer try/except.. I guess unless someone has windows_selector_event_loop_policy and not bypass_ssl defined.

oops...

<!-- gh-comment-id:1909319835 --> @ltdrdata commented on GitHub (Jan 25, 2024): > Groovy, thanks! > > Though, I think there's a bug on line 470, that `'bypass_ssl'` is likely meant to be `'windows_selector_event_loop_policy'`: > > ```diff > - if 'bypass_ssl' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true': > + if 'windows_selector_event_loop_policy' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true': > ``` > > Shouldn't really matter since there's an outer try/except.. I guess unless someone has windows_selector_event_loop_policy and _not_ bypass_ssl defined. oops...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#182
No description provided.