bug: concurrent VM sandbox launches crash with vCPU "Bad address" (ProcessExited)
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 20/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- rust
调研方向
Reproduce with NEXTEST_TEST_THREADS=4 OPENSHELL_E2E_VM_FEATURES=e2e-conformance-only mise run e2e:vm on a KVM host, then read crates/openshell-driver-vm/src/driver.rs from the image-cache/root-disk planning through the log line "sandbox root disk plan resolved" to the "spawning VM launcher" site, checking whether simultaneous launches share or mutate sandbox-bootstrap-rootfs-ext4-v6 or per-launch host resources. crates/openshell-driver-vm/runtime/pins.env names the libkrun pins to rule in or out. Done means four simultaneous openshell sandbox create calls all reach Ready and the VM lanes pass three runs at four threads with the conformance-only pin from #5865 removed.
由索引模型根据 Issue 内容生成。
描述
User Story
I maintain OpenShell's E2E conformance suite. While running conformance against VM-driver gateways with four concurrent tests (#5865), I directly hit VM sandboxes that crash during provisioning whenever several start at the same moment on a fresh gateway. Other VM gateway users can hit the same thing by creating several sandboxes at once.
Problem Statement
When several VM sandboxes are created at the same time on a VM-driver gateway that has not launched a VM yet, some of their VMs exit immediately after the launcher starts. In the launcher's output, libkrun reports:
ERROR krun_vmm::linux::vstate] Failure during vcpu run: Bad address (os error 14)
Error: × VM exited with status 1
The gateway then marks the sandbox Error with ProcessExited: VM process exited, and openshell sandbox create fails with sandbox entered error phase while provisioning: ProcessExited: VM process exited.
Only the first burst of launches fails. In every failing run:
- The first four creates all pull and prepare the same image (
nvcr.io/nvidia/base/ubuntu:24.04) and share the same bootstrap rootfs (sandbox-bootstrap-rootfs-ext4-v6). They finish disk preparation together, and the driver spawns all four VM launchers within about 1 ms (vm driver: spawning VM launcher,crates/openshell-driver-vm/src/driver.rs). - About 200 ms later, 1–3 of those four VMs fail with the vCPU
Bad addresserror. - All later sandboxes in the same run, still four at a time but no longer starting together, provision and pass. The remaining 45–48 of 49 tests pass.
The same suite passes with one test at a time.
Impact / Why This Matters
- Creating several VM sandboxes at once, for example from a script, an agent fan-out or a freshly started gateway, can fail with an unhelpful
ProcessExitederror. - The VM E2E lanes have to run conformance serially while Docker, Podman and Kubernetes run four tests at a time (#5865). They give up the roughly 3× conformance speedup the other lanes get.
- The workaround is to avoid launching VMs at the same time, for example by serializing creates or warming the gateway with one sandbox first. That only hides the race.
Acceptance Criteria
- Four or more VM sandboxes created at the same time on a fresh VM-driver gateway all reach
Ready. - The VM E2E lanes pass conformance with
NEXTEST_TEST_THREADS: "4"in.github/workflows/e2e-vm-test.yml, three times in a row on all three lanes (managed, external driver, additional CA). - The conformance-only lane pin added in #5865 is removed.
Reproduction Steps
Through the conformance suite. This is how the failure was observed, and it reproduces in every run so far.
- On Linux x86_64 with
/dev/kvm, check out #5865 (or any branch wheree2e/support/conformance.shruns conformance with nextest). - Run the VM lane with four concurrent tests:
NEXTEST_TEST_THREADS=4 OPENSHELL_E2E_VM_FEATURES=e2e-conformance-only mise run e2e:vm - 1–3 of the first tests fail with
sandbox entered error phase while provisioning: ProcessExited. The VM launcher's output in the job log containsFailure during vcpu run: Bad address (os error 14).
A shorter form, which I expect to reproduce but have not run on its own: start a fresh VM-driver gateway (as e2e/rust/e2e-vm.sh does), then create four sandboxes simultaneously:
for i in 1 2 3 4; do openshell sandbox create --name race-$i --no-tty --detach & done; wait
Failing CI runs
All at four workers, ubuntu-24.04 GitHub-hosted runners with KVM:
- Run 45235328880:
- rust-vm-managed: 48/49 passed
- rust-vm-external-driver: 46/49 passed
- rust-vm-additional-ca: 46/49 passed
- Run 44834572213:
- Run 44837901048:
In each job, open the "Run tests" step and search for ProcessExited. The Bad address error was confirmed in all three jobs of run 45235328880; the two earlier runs show the same ProcessExited failures in the first tests.
Where to look
The vCPU Bad address error (EFAULT from KVM_RUN) typically means guest memory backed by a host mapping that is invalid or changing. These are unconfirmed leads:
- Shared bootstrap rootfs or root-disk preparation. Check whether simultaneous first launches map or open the shared
sandbox-bootstrap-rootfs-ext4-v6image, or a root disk derived from it, while another sandbox is still writing, truncating or replacing it. Look at the image-cache and root-disk planning path beforevm driver: sandbox root disk plan resolvedindriver.rs. - Per-launch host resources set up by
openshell-driver-vmor libkrun, such as memory files or sockets, that could collide when launchers start within the same millisecond. - libkrun itself (
LIBKRUN_REF=227b2de6…,LIBKRUNFW_REF=f14ac64c…incrates/openshell-driver-vm/runtime/pins.env), if the driver-side state is independent per sandbox.
The per-sandbox rootfs-console.log (under the sandbox state directory) and the launcher's stderr for a failed sandbox should show how far the guest got. CI does not upload them today.
Environment
- OpenShell:
0.1.10-dev.81+g9c7a67494(gateway andopenshell-driver-vmfrom #5865) - OS: GitHub-hosted
ubuntu-24.04runners (x86_64, KVM) - Runtime: VM compute driver, both built in and as an external driver
- 主要语言
- 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 天内回复