Skip to content

fix: prevent sandbox virtio-fs fd exhaustion#32

Open
danny-avila wants to merge 1 commit into
mainfrom
danny-avila/fix-virtiofs-fd-leak
Open

fix: prevent sandbox virtio-fs fd exhaustion#32
danny-avila wants to merge 1 commit into
mainfrom
danny-avila/fix-virtiofs-fd-leak

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

I prevent the long-lived libkrun runner from exposing the language package tree through virtio-fs in default KVM deployments, avoiding host file-descriptor exhaustion under sustained package-heavy workloads.

  • Route default KVM Compose builds through baked ext4 block-root targets while preserving automatic KVM_ENABLED=false legacy targets.
  • Build the scalable worker-sandbox package tree into the read-only guest root disk and keep /host-packages disabled at the launcher boundary in KVM mode.
  • Add Helm image and pvc package sources, default KVM installs to image delivery, preserve existing sandbox image overrides, and document the 0.3 migration.
  • Retain the FD-aware liveness fallback and allow fdLivenessLimit: 0 to disable it as documented.
  • Add deployment regression coverage for Compose target selection, Docker stage wiring, Helm rendering, custom image overrides, and invalid configurations.

Fixes #15

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

  • Ran tests/block_root_package_delivery.sh.
  • Ran git diff --check and bash -n tests/block_root_package_delivery.sh.
  • Rendered all Compose variants with KVM enabled and disabled, plus the macOS override.
  • Rendered and linted Helm image, PVC, local, and custom-image configurations.
  • Ran Docker BuildKit --check for api/Dockerfile and docker/Dockerfile.worker-sandbox.

A full baked image build and sustained KVM soak were not run locally because the host lacks KVM and the image build compiles the complete language runtime catalog.

Test Configuration:

  • Host: macOS
  • Docker: OrbStack BuildKit
  • Helm: v4.1.0
  • Bun: 1.3.13

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: d32d0a7e83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila marked this pull request as ready for review July 25, 2026 01:49
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.

sandbox-runner leaks host file descriptors (virtio-fs /host-packages) → EMFILE "Too many open files" after sustained use

1 participant