Bug(podman): a sandbox create is rolled back while its container is still starting
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 30/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- rust
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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):
CreateSandboxaccepted and the container is created.- The start request times out:
Failed to start container; cleaning up error=timeout after 30s. Onv0.0.116the timeout is 30 seconds (crates/openshell-driver-podman/src/client.rs:24). On currentmainandv0.1.9it 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 foundon 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, orremoving, or is not found, still cleans up the container, volume, secrets, and sandbox record. - A start error where the container stays
createdis 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):
- Use an image whose first start takes more than 30 seconds to populate its state volume. The reporting host used the
openclaw-sandboximage, with about 35,000 entries at/sandbox/.openclaw. - Run
openshell sandbox create --name <name> --from <image>. - 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. - Run
openshell logs <name>. Expectlog 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
DELETEcalls 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
maingiven 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 thatmainnever 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, gateway0.0.116). Checked againstmainat152c59d31andv0.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.
- 主要語言
- Rust
- 星號
- 21.5k
- 分支
- 2.1k
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
NVIDIA/OpenShell 的其他 Issue
-
state:triage-needed
難度 2/5 1-3 小時 新手友好度 86/100
-
state:triage-needed
難度 2/5 1-3 小時 新手友好度 78/100
-
bug: Ready=False/PodTerminating is treated as a terminal sandbox failure可能已有人在做 @TaylorMutch 於 9 天前認領。 未關閉state:accepted state:pr-opened
難度 2/5 1-3 小時 新手友好度 78/100
-
state:triage-needed
難度 1/5 1-3 小時 新手友好度 78/100
-
state:triage-needed
難度 2/5 1-3 小時 新手友好度 62/100
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 2 天內回覆
-
autofixer: follow-up
難度 2/5 1-3 小時 新手友好度 78/100
tursodatabase/turso#12531 ·
維護者通常 1 天內回覆
-
bug help wanted ui
難度 2/5 1-3 小時 新手友好度 82/100
userFRM/egui-charts#4292 ·
維護者通常 1 天內回覆
-
Issue-Bug Need-Review
難度 1/5 1-3 小時 新手友好度 85/100
PowerShell/DSC#1832 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆