Visitar URL original
shim: report sandbox exits before successful start by dimko-at-bunny · Pull Request #17634 · google/gvisor · GitHub
Skip to content

shim: report sandbox exits before successful start - #17634

Open
dimko-at-bunny wants to merge 1 commit into
google:masterfrom
dimko-at-bunny:fix/dd/mc-2401-sandbox-created-exit
Open

dimko-at-bunny wants to merge 1 commit into
google:masterfrom
dimko-at-bunny:fix/dd/mc-2401-sandbox-created-exit

Conversation

@dimko-at-bunny

Copy link
Copy Markdown
Contributor

A root sandbox already exists after Create, but the shim only starts waiting for its exit after a successful Start. If the sandbox dies before that transition, Wait never completes and containerd force-delete can hang.

Track that process using a pidfd passed by its creator. After a successful Start or Restore, keep using the existing runsc waiter and guest exit status.

Changes

  • Retain early exits through task registration and OOM setup.
  • Deliver the exit notification before deletion removes the task.
  • Roll back sandbox creation if observer or IO setup fails.

Tested

  • Focused tests with race detection, local lint and static analysis.
  • Real runsc/containerd lifecycle and fault-injection checks, including cancellation, retry, OOM and failed rollback.
  • Workload regression, volume resize and restart with data checks.

The standalone-root classification hunk overlaps #17519; that PR handles the separate startup-delay and stdio bug.

Validation revisions and startup measurements

Component tests: ac451b2. Native and workload checks: 5b4c2ee, combining this change with the separate process-name/Unlock follow-up, on base ddb2d202.

Annotated-root startup measurements used 4d7dc1d, before the final rollback correction:

Comparison Base Candidate Result
Initial series, 72 samples 233.4 ms 238.6 ms +2.23%, p=0.029
Randomized control, 48 blocks 234.6 ms 234.1 ms p=0.268
Byte-identical baseline control 234.6 ms 234.3 ms p=0.224

The initial small difference was not reproduced in the randomized control. These results do not establish zero overhead.

A root sandbox already exists after Create, but the shim only starts its
normal waiter after a successful Start. If Start fails or is never called,
host death can leave Wait and containerd force-delete without completion.

Transfer a creator-owned pidfd to the shim and observe it until Start or
Restore succeeds. Preserve the normal guest waiter, OOM event ordering and
delete completion across retries. Clean up a root when post-create observer
setup fails.

The standalone-root classification prerequisite also appears in google#17519.

Assisted-by: Codex
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.

1 participant