ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

COMFYUI (0.5.8) not restart when install custom node

Open davidvce opened this issue 1 month ago • 3 comments

Custom Node Testing

Expected Behavior

When confyui end a custom node download, and i press "restart" button, is expected that comfyui close and reopen, but it just close

Actual Behavior

Comfyui just close when i press "restart" button after finish custom node download and i need reopen manually, in previous versions it not occurs

Steps to Reproduce

open comfyui, go to manager, go to custom nodes, install a custom node, wait download finish, press "restart" when this is enabled.

Debug Logs

NA

Other

NA

davidvce avatar Nov 25 '25 13:11 davidvce

My Comfy never restarted on Windows after installing nodes. I had to close it and restart it again.

Axseeee avatar Nov 25 '25 22:11 Axseeee

Same for me on version 0.3.73 : after the console loading at the ComfyUI restart, the screen stays empty, and nothing else happens, even after several minutes. I have to close the window and kill the python process in the task manager, then restart Comfy manually.

JChazottes avatar Nov 26 '25 11:11 JChazottes

I have encountered this numerous times myself. I have to kill the python process in Task Manager before I can reopen. This happens because the Electron process isn't aware of the still running python process.

Proposed fix: In the ComfyUI-Manager\glob\manager_server.py you need to replace the os.execv() approach with a proper process cleanup. Change lines 1604-1638;

`@routes.get("/manager/reboot") def restart(self): if not is_allowed_security_level('middle'): logging.error(SECURITY_MESSAGE_MIDDLE_OR_BELOW) return web.Response(status=403)

try:
    sys.stdout.close_log()
except Exception:
    pass

if '__COMFY_CLI_SESSION__' in os.environ:
    with open(os.path.join(os.environ['__COMFY_CLI_SESSION__'] + '.reboot'), 'w'):
        pass
    print("\nRestarting...\n\n")
    exit(0)

print("\nRestarting... [Legacy Mode]\n\n")

# NEW: For Windows, use subprocess + exit instead of os.execv
if sys.platform.startswith('win32'):
    import subprocess
    sys_argv = sys.argv.copy()
    if '--windows-standalone-build' in sys_argv:
        sys_argv.remove('--windows-standalone-build')
    
    cmds = [sys.executable] + sys_argv
    print(f"Command: {cmds}", flush=True)
    
    # Start new process detached, then exit cleanly
    subprocess.Popen(cmds, 
                    creationflags=subprocess.DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP,
                    close_fds=True)
    exit(0)
else:
    # Keep original behavior for non-Windows
    sys_argv = sys.argv.copy()
    if '--windows-standalone-build' in sys_argv:
        sys_argv.remove('--windows-standalone-build')
    
    if sys_argv[0].endswith("__main__.py"):
        module_name = os.path.basename(os.path.dirname(sys_argv[0]))
        cmds = [sys.executable, '-m', module_name] + sys_argv[1:]
    else:
        cmds = [sys.executable] + sys_argv
    
    print(f"Command: {cmds}", flush=True)
    return os.execv(sys.executable, cmds)`

k3ith-fowl3r avatar Dec 03 '25 05:12 k3ith-fowl3r