fix(executions): Fixing Process Exit Code#7437
Conversation
Greptile SummaryThis PR fixes parallel test runs getting stuck by changing the context-cancellation signal from the default SIGKILL to SIGTERM (with a 10-second SIGKILL fallback via Confidence Score: 5/5Safe to merge — targeted fix with no logic errors or regressions introduced. Both changes are straightforward and correct: the Cancel closure is only invoked after cmd.Start() succeeds (so cmd.Process is never nil), WaitDelay provides a sensible hard-kill fallback, and the getProcessStatus update keeps abort-detection consistent with the new signal. No new failure modes introduced. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Ctx as Context
participant Cmd as exec.Cmd (CreateWithContext)
participant Proc as Child Process
participant Run as execution.Run()
Ctx->>Cmd: ctx.Done() fires
Note over Cmd: Cancel() called (was: os.Kill / SIGKILL)
Cmd->>Proc: SIGTERM (new behaviour)
Proc->>Proc: cleanup / deferred code runs
alt exits within 10s (WaitDelay)
Proc-->>Run: Wait() returns "signal: terminated"
Run->>Run: getProcessStatus → aborted=true
Run->>Run: group.Abort() if not already aborted
else still running after 10s
Cmd->>Proc: SIGKILL (WaitDelay fallback)
Proc-->>Run: Wait() returns "signal: killed"
Run->>Run: getProcessStatus → aborted=true
end
Reviews (2): Last reviewed commit: "cleanup" | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR adjusts how testworkflow-init cancels child process executions so that child processes receive a graceful termination signal (allowing cleanup hooks to run) instead of being hard-killed, addressing stuck “in progress” parallel runs.
Changes:
- Override
exec.Cmd.Cancelto sendSIGTERMon context cancellation. - Configure a
WaitDelayto give processes time to exit cleanly before escalation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8723cc5 to
bf4367c
Compare
Code reviewFound 1 issue:
testkube/cmd/testworkflow-init/orchestration/executions.go Lines 275 to 277 in 8723cc5 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…e-they-are-running-in-the-ui-even
|
@greptile |
|
Thanks @mgazza, do you mind taking a look again? |
Fixing Process Exit Code
The execution code was sending SIGKILL to the child processes, causing the cleanup code to never be executed. The side effects of this caused parallel runs to stay in progress forever.
Checklist (choose whats happened)
Fixes