-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: use direct process termination instead of console events on Windows #5972
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
Conversation
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.
Important
Looks good to me! 👍
Reviewed everything up to e767e6c in 1 minute and 9 seconds. Click for details.
- Reviewed
117
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
2
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src-tauri/src/core/utils/extensions/inference_llamacpp_extension/cleanup.rs:36
- Draft comment:
Good update for Windows: Direct termination using child.kill() (with a 2‑second timeout) replaces the CTRL-C event, which should help resolve the shutdown delay. Consider logging errors returned by child.kill() for easier debugging if termination fails. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
2. src-tauri/src/core/utils/extensions/inference_llamacpp_extension/server.rs:331
- Draft comment:
In unload_llama_model, the removal of CTRL-C event code and the new direct use of child.kill() on Windows should improve shutdown performance. Again, consider handling or logging any errors from child.kill() for better traceability. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
Workflow ID: wflow_l6xX2DkDM5rEKJSr
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Barecheck - Code coverage reportTotal: 38.61%Your code coverage diff: 0.01% ▴ ✅ All code changes are covered |
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.
Important
Looks good to me! 👍
Reviewed 44e34f2 in 1 minute and 40 seconds. Click for details.
- Reviewed
126
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
3
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src-tauri/Cargo.toml:64
- Draft comment:
The windows-sys dependency is now commented out. Confirm it’s not used elsewhere now that we use direct termination. This cleanup looks correct if console events are no longer needed. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =30%
<= threshold50%
The comment is asking the author to confirm that the windows-sys dependency is not used elsewhere, which is against the rules. However, it also provides a suggestion that the cleanup looks correct if console events are no longer needed, which is somewhat useful. Overall, the comment leans more towards asking for confirmation, which is not allowed.
2. src-tauri/src/core/utils/extensions/inference_llamacpp_extension/cleanup.rs:36
- Draft comment:
In the Windows branch, the PR switches from waiting for a graceful shutdown to using direct kill. This direct call to child.kill() with proper error logging should help avoid the 3–4 second delay. Ensure that any race conditions (e.g. process already terminated) are handled as expected. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =40%
<= threshold50%
The comment is informative and suggests ensuring that race conditions are handled. It doesn't directly ask the author to confirm their intention or to test the change, but it does imply a need for careful handling of potential issues. However, it doesn't provide a specific suggestion or point out a clear issue with the code. It seems to be more of a cautionary note rather than a direct code review comment.
3. src-tauri/src/core/utils/extensions/inference_llamacpp_extension/server.rs:331
- Draft comment:
The unload command’s Windows branch now force-kills the process (with a warning log) instead of attempting a graceful shutdown. The logic is consistent with the cleanup changes and should address the slow shutdown issue. Consider refactoring to a shared helper to avoid duplication. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment accurately describes the change and makes a reasonable suggestion about potential code duplication. However, looking at the full file, I don't see obvious duplication that would benefit from a shared helper - the Unix and Windows code paths are quite different in their approach and error handling. The suggestion seems speculative without clear evidence of problematic duplication. The suggestion about refactoring to a shared helper seems premature without clear evidence of problematic duplication. The Unix and Windows paths handle process termination quite differently. While the comment accurately describes the change, the refactoring suggestion isn't clearly justified by the code structure, as the platform-specific termination logic is necessarily different. The comment should be deleted since it's primarily descriptive of changes that are already clear from the code and makes a speculative suggestion without strong justification.
Workflow ID: wflow_vQ3gQs4CrWUECMTk
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
CREATE_NEW_PROCESS_GROUP prevented GenerateConsoleCtrlEvent from working, causing graceful shutdown failures. Removed to enable proper signal handling.
…andling" This reverts commit 82ace3e.
Simplified Windows process cleanup by removing console attachment logic and using direct child.kill() method. More reliable for headless processes.
Disabled use of windows-sys crate as graceful shutdown on Windows is unreliable in this context. Updated cleanup.rs and server.rs to directly call child.kill().await for terminating processes on Windows. Improved logging for process termination and error handling during kill and wait. Removed timeout-based graceful shutdown attempt on Windows since TerminateProcess is inherently forceful and immediate. This ensures more predictable process cleanup behavior on Windows platforms.
44e34f2
to
5bfed16
Compare
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.
LGTM and works great!
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.
Important
Looks good to me! 👍
Reviewed 48b68f5 in 26 minutes and 3 seconds. Click for details.
- Reviewed
16
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src-tauri/Cargo.toml:64
- Draft comment:
Removed unused windows-sys dependency comments. This cleanup is appropriate since the new direct kill approach on Windows renders these references unnecessary. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
Workflow ID: wflow_Xq3MKkkGmlQVOn9n
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Describe Your Changes
Simplified Windows process cleanup by removing CTRL+C event logic
and using direct child.kill() method. More reliable for headless processes.
Fixes Issues
Self Checklist
Important
Simplifies Windows process termination by using
child.kill()
directly, removingCTRL+C
logic, and updating dependencies and logging.CTRL+C
event logic and usingchild.kill()
directly incleanup_processes()
incleanup.rs
andunload_llama_model()
inserver.rs
.child.kill()
.windows-sys
dependency fromCargo.toml
as it's no longer needed for process termination.cleanup.rs
andserver.rs
to reflect changes in process termination logic.This description was created by
for 48b68f5. You can customize this summary. It will automatically update as commits are pushed.