Skip to content

fix(runtime): don't cancel podman start/run mid netns setup (RIG-5334) - #2305

Merged
mattwilkinsonn merged 2 commits into
mainfrom
compass-runner/rig-5334-podman-no-cancel-kill
Oct 15, 2026
Merged

mattwilkinsonn merged 2 commits into
mainfrom
compass-runner/rig-5334-podman-no-cancel-kill

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes RIG-5334: e2e podman probe fails with rootless netns: mount resolv.conf to "/etc/resolv.conf": no such file or directory, and every later podman run fails the same way.

Root cause

Local repro on podman 5.8.6, signalling podman unshare --rootless-netns once the pid file appears:

Signal Broken netns
SIGKILL 15/30
SIGTERM 30/30
SIGKILL to podman start of a bridge container 1/1

Change

  • PodmanCLI.Start, the pasta-canary podman run, and the stack adapters' podmanExec.run now run under WithoutCancel(ctx) plus their own command timeout.
  • After the command exits, a cancelled caller still gets ctx.Err(), so existing cleanup paths are unchanged.
  • All other verbs keep today's cancellation behaviour.

Tests

  • TestPodmanStartSurvivesCallerCancellation / TestPodmanRunSurvivesCallerCancellation: the stub podman blocks after start. The test cancels the ctx, then releases the stub, and asserts the stub ran to completion and the call returned context.Canceled. Both were red before the fix: the stub was killed.
  • TestPodmanStartTimeoutKillsHungProcess / TestPodmanRunTimeoutKillsHungProcess: the per-command timeout still kills a hung podman.
  • go test -race -count=1 ./internal/runtime/... ./internal/stack/...: ok. golangci-lint: 0 issues.

A signal to the podman client after pasta writes its pid file but before
podman writes `rootless-netns/resolv.conf` leaves pasta alive with no
`resolv.conf`. podman reuses that netns, so every later run fails with
`mount resolv.conf to "/etc/resolv.conf": no such file or directory`.
Caller ctx cancellation (runner shutdown) SIGKILLed in-flight `podman start`.

`PodmanCLI.Start`, the pasta canary `podman run`, and the stack adapters'
`podman run` now ignore caller cancellation. They stay bounded by their own
command timeout and return the ctx error after exit.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@trunk-io

trunk-io Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

RIG-5334

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-runner-rig-5334-podm.compass-eng-docs.pages.dev

Deployed from compass-runner/rig-5334-podman-no-cancel-kill at 9bf061b.

…on (RIG-5334)

Review fix: a run that succeeded after caller cancellation was reported
as cancelled, so the stack dropped a live container from its teardown
record. Return the command's own result; the caller's next ctx check
still unwinds. Cancellation tests now prove the stub is alive while
gated, so a regressed CommandContext kill fails deterministically.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Review for head 9bf061b2: high 0 / medium 0 / low 0 (round 2, cumulative diff 309cd3fa..9bf061b2).

  • Round 1 at 289d4e54, 1 high and 2 medium:
    • H1 (a success after cancel was reported as cancelled, so a started container was dropped from teardown): fixed in 9bf061b2.
    • M2 (racy cancellation tests): fixed; the tests now assert the gated stub is alive after cancel. They are red with the fix reverted.
    • M1 (shutdown waits up to the 120 s command timeout): accepted as the fix's trade-off; recorded in the PR body. Round 2 found no deadlock or lock-held caller.
  • CI is green on 9bf061b2, including e2e: TestStackIntegration passed and no podman test skipped.

@rigel-mintaka
rigel-mintaka marked this pull request as ready for review October 15, 2026 08:16
@mattwilkinsonn
mattwilkinsonn merged commit 1371ecf into main Oct 15, 2026
19 checks passed
@mattwilkinsonn
mattwilkinsonn deleted the compass-runner/rig-5334-podman-no-cancel-kill branch October 15, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants