[bug]: Ctrl-C does not send terminate signal to Invoke.bat
Is there an existing issue for this?
- [X] I have searched the existing issues
OS
Windows
GPU
cuda
VRAM
8GB
What happened?
Ctrl-C doesn't send termination signal to Invoke.bat for some reason so the only way to terminate Invoke.bat is to close the Terminal Window. CMD, Powershell, Powershell 7 all use the Ctrl-C for SIGINT like all popular shells bash, zsh, and tcsh.
Screenshots

Additional context
No response
Contact Details
No response
Actually does but it takes time to receive it between the polling interval that is required to keep the socketio connection to the frontend allow. So it feels like it isn't.
I'm looking into ways to make make the connection threaded somehow but it hasn't been a quick solution.
At the moment its not the biggest priority but if I think of a way to fix this, I'll do it.
@blessedcoolant no rush. just putting it here. I haven't been able to kill the process in Powershell 7 with ctrl-C in 2.2.5 even if i spam ctrl-c. This is a really minor thing. Just figured I get off my behind and log this into Issues.
Could it be that you need to press CTRL+Shift+C 🤔
When I ^C it works but takes a real long time.
ok i just tested it. If I hold ctrl-c for about 20-30 secs, it works. spamming ctrl-c doesn't work (what I did before)
Another hack is, press Ctrl C and then refresh the frontend. This will reset the polling time releasing the backend and triggering the break signal.
There has been no activity in this issue for 14 days. Please reply with a comment to keep the issue open. We recommend testing with the latest release to make sure it hasn't been already fixed.
There has been no activity in this issue for 14 days. If this issue is still being experienced, please reply with an updated confirmation that the issue is still being experienced with the latest release.
I've experienced this issue too. It is very annoying. I'm hoping that someone with better Windows .bat file programming skills can help out here.
On Tue, Feb 7, 2023 at 10:32 PM ShaguarWKL @.***> wrote:
ok i just tested it. If I hold ctrl-c for about 20-30 secs, it works. spamming ctrl-c doesn't work (what I did before)
— Reply to this email directly, view it on GitHub https://github.com/invoke-ai/InvokeAI/issues/2570#issuecomment-1421942752, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA3EVOGFHA4F75CPEQCRV3WWMHWJANCNFSM6AAAAAAUUE2MM4 . You are receiving this because you commented.Message ID: @.***>
I'm trying to isolate what is blocking it. No luck so far.
I'm trying to isolate what is blocking it. No luck so far.
I'm not sure if this will help but the Kohya_SS fork actually added text output when control-c is called in powershell and it is extremely fast to kill the process.
❯ aiko
Validating that requirements are satisfied.
All requirements satisfied.
The arguments passed to this script were: --inbrowser --server_port 7878
Load CSS...
Running on local URL: http://127.0.0.1:7878
To create a public link, set `share=True` in `launch()`.
Keyboard interruption in main thread... closing server.
I assume looking for that "Keyboard Interupption" string might help to see how they did this? https://github.com/bmaltais/kohya_ss
kohya uses Gradio so I guess gradio handles the exit loop.
We're moving to FastAPI in our new migration. I expect this to get resolved with that change because then the FastAPI / Socket combination should handle the exception correctly. But if it still persists even after that, I'll probably need to add in a custom API end point that forces a proper shutdown of the app on Ctrl+C