Skip to content

bug(vm): gateway compute-driver.sock path can exceed macOS sun_path limit #5015

Open

Description

@bmahabirbu

User Story

As a developer running the VM compute driver on macOS, I want the gateway's compute-driver socket path to fit within the OS sun_path limit so that the gateway starts no matter where I keep VM driver state.

Problem Statement

The gateway places the VM driver's control socket at {state_dir}/run/compute-driver.sock. On macOS, struct sockaddr_un.sun_path is 104 bytes (103 usable). The fixed /run/compute-driver.sock suffix takes 24 bytes, so any state_dir longer than 79 bytes makes the driver fail to bind, and the gateway does not start.

For example, with a state_dir inside a checkout:

/Users/bmahabir/src/github.com/NVIDIA/OpenShell/.cache/gateway-vm/vm-driver-state/run/compute-driver.sock
└──────────────────────────────────────── 105 bytes ───────────────────────────────────────────────┘

Path length breakdown:

/Users/bmahabir/src/github.com/NVIDIA/OpenShell/.cache/gateway-vm/vm-driver-state   (81)
/run/compute-driver.sock                                                             (24)
                                                                         total = 105 bytes
                                                           macOS usable limit = 103 bytes
                                                                    over by 2 bytes

#3452 hit the same limit for the per-sandbox control.sock and ssh.sock. #3544 fixed those by moving them to a short, randomly named directory under /tmp, but explicitly left run/compute-driver.sock unchanged. This is the remaining socket.

Impact / Why This Matters

The gateway fails at startup with path must be shorter than SUN_LEN, which doesn't name the path or the setting that controls it (see #4178).

The current workaround is to set a short state_dir such as /tmp/os-vm. This is non-obvious and moves persistent VM state (overlays, image cache, logs) into /tmp, which is cleared on reboot. The repo's own dev scripts (tasks/scripts/gateway-vm.sh, e2e/rust/e2e-vm.sh) already put state under /tmp for this reason.

Linux is less affected (108-byte limit) but not immune with deep state directories.

Acceptance Criteria

Reproduction Steps

  1. On macOS, set state_dir under [openshell.drivers.vm] to a path longer than 79 bytes
  2. Start the gateway with compute_driver = "vm"
  3. Observe the driver exits before the gateway becomes ready

Environment

  • OpenShell: development build (current main branch)
  • OS: macOS (Apple Silicon) — sun_path is 104 bytes
  • Runtime: VM compute driver (libkrun)

Logs

Same output as reported in #4178:

Error:   × path must be shorter than SUN_LEN
Error:   × execution error: vm compute driver exited before becoming ready with
  │ status exit status: 1

Activity

  1. added a commit that references this issue on Oct 28, 2026
    7df7c58
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

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions