Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: reactivate sigint handler after each Ctrl-C #736

Merged
merged 1 commit into from
Apr 3, 2023

Conversation

mgroeber9110
Copy link
Contributor

When using main.exe on Windows in interactive mode, I found that only the first Ctrl-C would interrupt generation. If I later used Ctrl-C again, it always exited the application.

The reason appears to be what is described here: https://stackoverflow.com/questions/43959514/why-the-second-sigint-cant-be-captured-on-win32 - Windows will reset the SIGINT handler to default as soon as a signal was received.

My solution is to capture the signal again each time interactive mode is entered.

@mgroeber9110 mgroeber9110 changed the title Windows: reactive sigint handler after each Ctrl-C Windows: reactivate sigint handler after each Ctrl-C Apr 3, 2023
@prusnak
Copy link
Collaborator

prusnak commented Apr 3, 2023

Can someone with Windows confirm they see this issue on their machine and that this PR fixes the issue?

@KASR
Copy link
Contributor

KASR commented Apr 3, 2023

Can someone with Windows confirm they see this issue on their machine and that this PR fixes the issue?

Tested on windows 10, cmake 3.24.3, msvc and works. See conversation below where i interrupted several times successfully and still was able to continue the conversation. You can see where I interrupted since 'user:' is not printed.

(also note that bob didn't mind assisting 😄)

image

edit: forgot to paste the before picture... the behavior is as described: you can interrupt 1 time, the 2nd time llama exits.

image

@howard0su
Copy link
Collaborator

Also confirm this do fix the issue on Windows 10.

@prusnak prusnak merged commit 53dbba7 into ggerganov:master Apr 3, 2023
@prusnak
Copy link
Collaborator

prusnak commented Apr 3, 2023

Thanks for the confirmations, merging!

@mgroeber9110 mgroeber9110 deleted the win-sigint branch May 26, 2023 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants