-
Notifications
You must be signed in to change notification settings - Fork 13.4k
llama : fix ctrl+c handler #11731
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
llama : fix ctrl+c handler #11731
Conversation
For correct processing ctrl+c signal
|
Can you explain why this change is needed and which case does it fix? |
|
What you explained is not related to this change. I don't see why ctrl+c handler is related to that |
|
Wow, sorry about that! I made two changes. Regarding these changes: To allow the user to use Ctrl+C at any time, I think we need to register the event earlier in the process. |
That's why you should have a proper title and description for each PR. |
|
This introduce another bug, now I can no longer interrupt model loading. |
|
ref #11605 |
|
I'll double check everything today. Could you please clarify what operating system you use? |
|
I'm using MacOS. It should be the same on all platforms. I think you moved the handler to before model loading. |
|
Hi @ngxson @ggerganov (twice pressing ctrl+c) Linux Ubuntu log_1 of ctrl+c (before server initialsation) - processed ok (once pressing ctrl+c) Linux Ubuntu log_2 of ctrl+c (after server initialsation) - processed ok (twice pressing ctrl+c) Windows log_1 of ctrl+c (before server initialsation) - processed ok (once pressing ctrl+c) Windows log_2 of ctrl+c (after server initialsation) - processed ok |
did you ctrl+C twice? |
|
There are both - Log_1 - twice, Log_2 - once |
|
Same for windows, you ctrl+C twice and this is not expected. Server should exit after you hit ctrl+C just once. Inside container environment, terminal signal is only delivered once. |
|
on Windows - if we try register ctl+c event after ctx_server.queue_tasks.start_loop(); it didnt work and didnt proces ctrl+c events. |
|
also tested in docker By hit ctrl+C just once in docker |
| // struct that contains llama context and inference | ||
| server_context ctx_server; | ||
|
|
||
| shutdown_handler = [&](int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why this whole code block must be this higher up. Can't it be move to just right before ctx_server.queue_tasks.start_loop(); ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ngxson , I think yes.
|
I'm closing as #11795 is already addressed this issue (also the case where SIGTERM arrives when server is busy processing an on-going request) |
ref #11605, ggml-org/llama.vim#35
For correct processing ctrl+c signal
Make sure to read the contributing guidelines before submitting a PR