InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: Ctrl-C does not send terminate signal to Invoke.bat

Open ShaguarWKL opened this issue 3 years ago • 6 comments

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

WindowsTerminal_2023-02-07_22-57-23

Additional context

No response

Contact Details

No response

ShaguarWKL avatar Feb 07 '23 16:02 ShaguarWKL

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 avatar Feb 07 '23 17:02 blessedcoolant

@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.

ShaguarWKL avatar Feb 07 '23 18:02 ShaguarWKL

Could it be that you need to press CTRL+Shift+C 🤔

mauwii avatar Feb 08 '23 00:02 mauwii

When I ^C it works but takes a real long time.

lstein avatar Feb 08 '23 01:02 lstein

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)

ShaguarWKL avatar Feb 08 '23 03:02 ShaguarWKL

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.

blessedcoolant avatar Feb 08 '23 06:02 blessedcoolant

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.

github-actions[bot] avatar Mar 10 '23 01:03 github-actions[bot]

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.

github-actions[bot] avatar Mar 24 '23 06:03 github-actions[bot]

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: @.***>

lstein avatar Mar 24 '23 12:03 lstein

I'm trying to isolate what is blocking it. No luck so far.

blessedcoolant avatar Mar 24 '23 13:03 blessedcoolant

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

ShaguarWKL avatar Mar 25 '23 08:03 ShaguarWKL

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

blessedcoolant avatar Mar 25 '23 09:03 blessedcoolant