Repository navigation
fix(kill): ignore a parent PID that a newer process reused - #94
Merged
Merged
Conversation
ProtectedReason walks parent links to protect Driga's and Chat's ancestors and descendants. Windows keeps the PID of an exited parent, and a newer, unrelated process can reuse it, so the walk could mark that process as Driga's parent and refuse to stop it. TestChatCommandsBuiltBinary failed this way on Windows CI: "PID 732: Driga, Chat, or an ancestor/descendant is protected" for the test's own fixture. A parent link now counts only when the parent started no later than the child; a missing or unknown start time keeps the link.
Address review: reuse derive.ProcIndex for parent links, so only Windows ignores a reused parent PID and Unix keeps every live link. Driga's own ancestors come from the index rather than an unchecked os.Getppid, a broker root whose PID a newer process reused no longer protects it, and process selection builds the protected set once per snapshot.
Address review: descendants follow every parent link again, so a broker root that exited still protects its children; an ancestor walk stops only at a Windows parent that provably started after its child; a missing self still protects the parent's ancestry; a broker root is skipped only when a clearly newer process holds its PID; nested roots are walked once; identity checks run before the graph is built. Tests run both platform modes.
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.
Windows keeps the PID of an exited parent, and a newer, unrelated process can reuse it. ProtectedReason followed raw PPIDs upward, so it could treat that process as Driga's parent and refuse to stop it. TestChatCommandsBuiltBinary failed this way on Windows CI: "PID 732: Driga, Chat, or an ancestor/descendant is protected" for the test's own fixture.
Protection is now computed once per snapshot and errs toward protecting:
Tests cover both platform modes on every OS.