Skip to content

bug: concurrent VM sandbox launches crash with vCPU "Bad address" (ProcessExited) #5902

Open

Description

@matthewgrossman

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 address error.
  • 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 ProcessExited error.
  • The VM E2E lanes have to run conformance serially while Docker, Podman and Kubernetes run four tests at a time (perf(e2e): run conformance in parallel with nextest #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 perf(e2e): run conformance in parallel with nextest #5865 is removed.

Reproduction Steps

Through the conformance suite. This is how the failure was observed, and it reproduces in every run so far.

  1. On Linux x86_64 with /dev/kvm, check out perf(e2e): run conformance in parallel with nextest #5865 (or any branch where e2e/support/conformance.sh runs conformance with nextest).
  2. Run the VM lane with four concurrent tests:
    NEXTEST_TEST_THREADS=4 OPENSHELL_E2E_VM_FEATURES=e2e-conformance-only mise run e2e:vm
  3. 1–3 of the first tests fail with sandbox entered error phase while provisioning: ProcessExited. The VM launcher's output in the job log contains Failure 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:

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-v6 image, 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 before vm driver: sandbox root disk plan resolved in driver.rs.
  • Per-launch host resources set up by openshell-driver-vm or 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… in crates/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

Activity

  1. added
    area:driversCompute and secret drivers, host OS/architecture support, backend isolation, and lifecycle.
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:driversCompute and secret drivers, host OS/architecture support, backend isolation, and lifecycle.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions