bug: concurrent VM sandbox launches crash with vCPU "Bad address" (ProcessExited)
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 20/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- rust
- Domaine
- infrastructure, testing
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Rust
- Étoiles
- 21.5k
- Forks
- 2.1k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de NVIDIA/OpenShell
-
state:triage-needed
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
-
state:triage-needed
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
bug: Ready=False/PodTerminating is treated as a terminal sandbox failurePeut-être pris @TaylorMutch l’a pris il y a 9 jours. Ouvertestate:accepted state:pr-opened
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
state:triage-needed
Difficulté 1/5 1-3 heures Accessibilité débutants 78/100
-
state:triage-needed
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Toutes les issues de NVIDIA/OpenShell
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 2 jours
-
autofixer: follow-up
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
tursodatabase/turso#12531 ·
Les mainteneurs répondent en général sous 1 jour
-
bug help wanted ui
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
userFRM/egui-charts#4292 ·
Les mainteneurs répondent en général sous 1 jour
-
CHANGELOG.md out of dateOuverteIssue-Bug Need-Review
Difficulté 1/5 1-3 heures Accessibilité débutants 85/100
PowerShell/DSC#1832 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour