Skip to content

fix(bootstrap): add no-progress timeout to image build#1109

Open
laitingsheng wants to merge 3 commits intoNVIDIA:mainfrom
laitingsheng:fix/build-no-progress-timeout
Open

fix(bootstrap): add no-progress timeout to image build#1109
laitingsheng wants to merge 3 commits intoNVIDIA:mainfrom
laitingsheng:fix/build-no-progress-timeout

Conversation

@laitingsheng
Copy link
Copy Markdown
Contributor

@laitingsheng laitingsheng commented May 1, 2026

Summary

Wrap bollard's build_image() stream poll in tokio::time::timeout so a deadlocked Docker builder no longer hangs openshell sandbox create --from <Dockerfile> indefinitely. On macOS Colima with the default 2 vCPU / 2 GiB allocation, BuildKit reliably deadlocks partway through a multi-step build and the stream stops emitting events; without a timeout the caller waits forever for output that never arrives. The default threshold is 30 minutes, overridable via OPENSHELL_BUILD_NO_PROGRESS_TIMEOUT_SECS.

Related Issue

Refs NVIDIA/NemoClaw#2514 (sub-issue C: BuildKit deadlock has no timeout, openshell sandbox create waits forever).

Changes

  • crates/openshell-bootstrap/src/build.rs:
    • New DEFAULT_BUILD_NO_PROGRESS_TIMEOUT_SECS = 1800 constant with a docstring covering the rationale (deadlock detection vs. headroom for legitimately quiet RUN steps, override env var for both directions).
    • Replaced the while let Some(result) = stream.next().await loop with a loop { match timeout(...).await { ... } } form. On Err(Elapsed) the function returns a miette error that names the threshold, points at docker info NCPU/MemTotal as the likely root cause, and tells the user how to relax the threshold if a legitimate build step is just quiet.
    • Inlined the env read directly (matches the existing connect_local_for_large_transfers() pattern in docker.rs:36-42 for OPENSHELL_DOCKER_TIMEOUT_SECS).
    • Reject zero-valued overrides (OPENSHELL_BUILD_NO_PROGRESS_TIMEOUT_SECS=0) so they fall back to the default instead of failing every build at 0s.
  • architecture/sandbox-custom-containers.md: documents the new env var alongside the existing Dockerfile build-flow description.

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

bollard's build_image() stream relays Docker build progress, but
stream.next() blocks indefinitely when the underlying builder deadlocks
(commonly seen on macOS Colima with the default 2 vCPU / 2 GiB
allocation). The build hangs with no error, no timeout, and openshell
sandbox create waits forever for output that never arrives.

Wrap each stream.next() in tokio::time::timeout (default 30 min,
override via OPENSHELL_BUILD_NO_PROGRESS_TIMEOUT_SECS). On expiry,
abort with a diagnostic that points at the likely root cause
(under-provisioned runtime) and the docker info NCPU/MemTotal fields
the user should check, plus the env var to relax the threshold for
legitimate quiet builds.

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
@laitingsheng laitingsheng requested a review from a team as a code owner May 1, 2026 13:12
…Dockerfile build flow

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
OPENSHELL_BUILD_NO_PROGRESS_TIMEOUT_SECS=0 previously parsed cleanly
into Duration::from_secs(0), making every build fail immediately with
"produced no output for 0s". Filter zero alongside non-numeric values
so it falls back to the default.

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
@laitingsheng laitingsheng force-pushed the fix/build-no-progress-timeout branch from 35864cf to a19bda8 Compare May 1, 2026 13:48
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