Kill analyzer process groups on deadline#22
Merged
Conversation
Both exec sites used CommandContext's default kill, which signals only the direct child: a timed-out room-semgrep left its semgrep-core scan running (the adapter passes -timeout 0, so nothing else stops it), and a timed-out provider left any scanner it spawned orphaned. Run each child in its own process group and SIGKILL the group on cancel. Non-unix builds keep the previous direct kill. Also wrap the startup config-read error with its cause.
3 tasks
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
CommandContext's default kill, which signals only the direct child. A timed-outroom-semgrepleft itssemgrep-corescan running (the adapter passes-timeout 0, so nothing else stops it), and a timed-out provider inroomdleft any scanner it spawned orphaned.Setpgid) with a customCancelthat SIGKILLs the group;ESRCHis tolerated so a clean early exit never masks the real result. Non-unix builds keep the previous direct kill behind a build-tagged helper (internal/analyzerstays portable;cmd/room-semgrepis already Linux-only).Test plan
sleep 60grandchild are group-killed on deadline — the grandchild's pid reachesESRCHwithin 2s, at both exec sites (TestAdapterKillsSemgrepProcessGroup,TestExternalAnalyzerKillsProviderProcessGroup)go test ./...clean (unix-tagged helper files compile both sides)ROOM_SEMGREP_CORE=… go test -tags=semgrep_integration ./cmd/room-semgrep— realsemgrep-core1.139.0 suite passes through the new exec path