Bug(podman): a sandbox create is rolled back while its container is still starting

Offen
#5,926 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
30/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust

Rechercherichtung

Start with the start-timeout constant in crates/openshell-driver-podman/src/client.rs and the cleanup path in driver.rs, where the start error triggers cleanup_all without reading container state. Run the stubbed test repro_start_timeout_rolls_back_without_reading_container_state to see the current rollback. Done means a start error re-checks container state before cleanup, and the server keeps the sandbox record while the start is still in progress.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

state:triage-needed
User Story

I use OpenShell on a rootless Podman gateway (RHEL 9.8, Podman 5.8.5, overlay storage) to run NemoClaw sandboxes for an internal agent. I directly encountered this while onboarding a sandbox from the openclaw-sandbox image. The sandbox's state volume takes about 98 seconds to populate on first start, and I need creates to succeed on this host.

Problem Statement

On the Podman driver, when the container start request takes longer than the driver's API timeout, the create is treated as failed while Podman keeps starting the container.

The sequence we captured on a live create, from the gateway journal (UTC):

  • CreateSandbox accepted and the container is created.
  • The start request times out: Failed to start container; cleaning up error=timeout after 30s. On v0.0.116 the timeout is 30 seconds (crates/openshell-driver-podman/src/client.rs:24). On current main and v0.1.9 it is 60 seconds.
  • The driver removes the container, removes the volume and the secrets (cleanup_all), and returns an error.
  • The server treats the driver error as a failed create and deletes the sandbox record.
  • Podman is still performing the start. Its state-volume copy-up (About to copy up into volume ...) runs after the driver has given up. The start then completes (HTTP 204).
  • The container runs without its sandbox record. Its supervisor logs sandbox not found on every log push, and the container exits with status 1.

Measured without OpenShell involved, the first start of ghcr.io/nvidia/nemoclaw/openclaw-sandbox into an empty named volume at /sandbox/.openclaw takes about 98 seconds on this host (two runs: 98.25 s and 98.50 s). The same image with a bind mount starts in 2.1 s.

On main and v0.1.9, the 60-second API timeout is still shorter than this start, so the same sequence applies to a 98-second start.

Impact / Why This Matters

When this happens, the create reports failure. Users must delete the half-created sandbox, and the next create with the same name is blocked until the orphaned records are cleared. On this host the orphan records cannot be cleared with nemoclaw <name> destroy, because that command requires a Docker daemon (a separate NemoClaw report, NVIDIA/NemoClaw#14814).

This results in:

  • A sandbox that onboarding reports as failed, while the container is actually running and healthy after the start completes.
  • Retained recovery records and containers left behind for each failed attempt.
  • A create that succeeds in the container but is never usable through OpenShell, since its supervisor cannot find its record.

This matters because any image whose first start populates a large state volume will hit it. Slow storage, a large image, or a loaded host are enough to push the start past the timeout.

Workaround we used on our host: a local patch that re-checks the container state after a start error and keeps the create when the container reports running. It has not been submitted.

Acceptance Criteria
  • A Podman start request that exceeds the API timeout, followed by a container that reaches running, returns success for the create. The sandbox record and state volume are kept.
  • A start error where the container reaches exited, stopped, or removing, or is not found, still cleans up the container, volume, secrets, and sandbox record.
  • A start error where the container stays created is cleaned up after a bounded deadline, not left running indefinitely.
  • A create whose first start populates a 300 MB state volume (about 100 seconds) on a rootless Podman gateway succeeds, and the supervisor's first log push finds its record.
  • The server does not delete the sandbox record while the driver still reports the start as in progress.
Reproduction Steps

Environment for the live result: OpenShell 0.0.116 (tag d1155aa), Podman 5.8.5 rootless, RHEL 9.8.

Steps (live, on one host):

  1. Use an image whose first start takes more than 30 seconds to populate its state volume. The reporting host used the openclaw-sandbox image, with about 35,000 entries at /sandbox/.openclaw.
  2. Run openshell sandbox create --name <name> --from <image>.
  3. Watch the gateway journal and podman events. The start times out at 30 seconds, the create reports failure, and the container starts about 100 seconds later.
  4. Run openshell logs <name>. Expect log push RPC failed: ... sandbox not found.

Driver-level reproduction on main (unit test, stubbed Podman), at 152c59d31:

Test: repro_start_timeout_rolls_back_without_reading_container_state, added to crates/openshell-driver-podman/src/driver.rs in a clone of main. It reuses the existing start-failure test's stub sequence and changes only the failing supervisor start to timeout after 60s.

Result on unpatched main:

REPRO create_result_is_ok=false deletes=9 container_reads_after_last_start=0 requests=45
  • The create fails after a start timeout.
  • The driver reads no container state after the start error (container_reads_after_last_start=0). It goes straight to cleanup.
  • Nine DELETE calls follow: the setup and supervisor containers, the volumes, and the secrets.

Limits of the unit result:

  • A stubbed Podman, not a live gateway. It shows the driver's decision on main given a start timeout. It does not show the real 98-second copy or the real 60-second timeout.
  • The stub does not model the container reaching running. The test shows that main never checks, not what Podman would have reported.
  • The cleanup also removes identity-reader, a setup-phase container. That is part of the same cleanup and does not change the finding.

Timing data from the same host:

Step Time
podman create + start of a fresh sandbox container with named state volume 98.25 s, 98.50 s
Same image, bind mount 2.08 s
Raw tar -x of the same 35,584 entries onto /home and /tmp about 5 s each
podman pull --policy missing, image cached 0.24 s
Suggested UX (if applicable)

No user-facing change is proposed. The fix is in the driver and server: a start error is confirmed against the container's state before any cleanup. A user-visible change, such as a configurable start timeout, is for the maintainers to decide.

Environment
  • OpenShell: 0.0.116 (openshell 0.0.116, gateway 0.0.116). Checked against main at 152c59d31 and v0.1.9.
  • OS: RHEL 9.8 (kernel 5.14.0-687.60.1.el9_8), x86_64
  • OpenShell deployment mode and runtime: rootless Podman 5.8.5, cgroups v2, overlay storage, subuid 165536:65536, gateway run as a user systemd service
Logs
Not attached. The raw journal lines include internal identifiers, so the key lines are quoted in Problem Statement instead.
Vorherrschende Sprache
Rust
Sterne
21.5k
Forks
2.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus NVIDIA/OpenShell

Alle Issues in NVIDIA/OpenShell

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.