Repository navigation
Conversation
Device, Router, Lab and AsRoot each repeated the code that spawns a command on a namespace's sync worker. It now lives in two NetnsManager methods. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A command from spawn_command or spawn_command_sync kept running after the patchbay process died, for example on `kill -9`, and after its lab or device was gone. The kernel now sends it SIGKILL when the spawning namespace worker ends (PR_SET_PDEATHSIG). The worker ends with the patchbay process, with the lab, and when its device or router is removed. The signal does not reach processes that the command starts, nor a setuid program or one with file capabilities. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
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
Commands from
spawn_commandandspawn_command_sync(on a device, a router, the IX, andas_root) outlived the patchbay process. Afterkill -9, they kept running, and also after a normal exit if their handles were dropped. They also outlived their lab, device, or router.The kernel now sends such a process
SIGKILLwhen the namespace worker thread that spawned it ends (PR_SET_PDEATHSIG). That thread ends with the patchbay process, with the lab, and when its device or router is removed.Ctrl-C in a terminal already ended these commands, because they share the foreground process group. That still holds, and now also for a command that ignores
SIGINT.The first commit moves the spawn code, which Device, Router, Ix and AsRoot each repeated, into two
NetnsManagermethods. The second adds the signal there.Breaking changes
SIGKILLwhen its lab drops or its device or router is removed. Code that keeps aChildafter that sees it killed.Limits
sh -c "server &".Tests
tests/process_lifetime.rsruns its own binary as a patchbay process that spawns three commands, one of them as root. The commands ignoreSIGINTandSIGTERM. The tests then end that process withSIGKILL, with Ctrl-C (SIGINTto its process group), or with a normal exit. Without this change, theSIGKILLand Ctrl-C tests fail with "3 commands outlived their process".spawned_command_ends_with_its_namespacechecks a device removal and a lab drop.#45 (containers) builds on this.
🤖 Generated with Claude Code