Improve signal handling and process cleanup in canary-download#4
Open
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
Open
Conversation
process.kill() was called without process.wait() in both the TimeoutExpired and BaseException exception handlers, leaving the signify-openbsd child as a zombie. Also clean up the subprocess in the SIGTERM/SIGINT signal handler so it is reaped when the outer timeout command terminates canary-download. https://claude.ai/code/session_012TwkQYwRUwxpuNFPUdsZfd
Contributor
|
Accepted with tweaks in ArrayBolt3@5217b86, however this does not actually prevent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change improves the robustness of the canary-download script by implementing proper signal handling and ensuring child processes are cleaned up correctly in all error scenarios.
Key Changes
_signify_processvariable to track the signify subprocesscanary_download_signal_handler()to properly terminate the signify process when a signal is received, preventing orphaned processesprocess.wait()calls afterprocess.kill()in timeout and exception handlers to ensure processes are fully reaped before exit_signify_processas global in the main function to allow the signal handler to access and clean up the subprocessImplementation Details
The changes ensure that:
This prevents resource leaks and ensures clean shutdown in all code paths.
https://claude.ai/code/session_012TwkQYwRUwxpuNFPUdsZfd