neondatabase/neon · error

process exited with {status}

Error message

process exited with {status}

What it means

compute_ctl enforces the disk quota by shelling out to `/usr/bin/sudo /neonvm/bin/set-disk-quota {size_kb} {mountpoint}`. The child process ran but exited non-zero; the anyhow context wrapper adds 'could not run ...' so the chain reads context -> 'process exited with {status}'. The exit status (code/signal) and which prerequisite failed (sudo policy, missing binary, bad mountpoint) must be read from the chain.

Source

Thrown at compute_tools/src/disk_quota.rs:23

/// If size_bytes is 0, it disables the quota. Otherwise, it sets filesystem quota to size_bytes.
/// `fs_mountpoint` should point to the mountpoint of the filesystem where the quota should be set.
#[instrument]
pub fn set_disk_quota(size_bytes: u64, fs_mountpoint: &str) -> anyhow::Result<()> {
    let size_kb = size_bytes / 1024;
    // run `/neonvm/bin/set-disk-quota {size_kb} {mountpoint}`
    let child_result = std::process::Command::new("/usr/bin/sudo")
        .arg(DISK_QUOTA_BIN)
        .arg(size_kb.to_string())
        .arg(fs_mountpoint)
        .spawn();

    child_result
        .context("spawn() failed")
        .and_then(|mut child| child.wait().context("wait() failed"))
        .and_then(|status| match status.success() {
            true => Ok(()),
            false => Err(anyhow::anyhow!("process exited with {status}")),
        })
        // wrap any prior error with the overall context that we couldn't run the command
        .with_context(|| format!("could not run `/usr/bin/sudo {DISK_QUOTA_BIN}`"))
}

View on GitHub (pinned to 8f60b04da4)

Solutions

  1. Reproduce manually: /usr/bin/sudo /neonvm/bin/set-disk-quota <size_kb> <mount> and read the tool's own error
  2. Verify /neonvm/bin/set-disk-quota exists and is executable in the image the compute runs in
  3. Check sudoers grants the runtime user passwordless rights for exactly that command
  4. Confirm the mountpoint passed matches an actual mount (cat /proc/mounts)

Example fix

# before: fails inside container without the NeonVM tool
/usr/bin/sudo /neonvm/bin/set-disk-quota 1048576 /var/lib/postgresql
# after (sudoers)
Cmnd_Alias QUOTA = /neonvm/bin/set-disk-quota
compute_ctl_user ALL=(root) NOPASSWD: QUOTA
Defensive patterns

Strategy: validation

Validate before calling

// Preconditions before spawning sudo
if !std::path::Path::new(DISK_QUOTA_BIN).exists() {
    anyhow::bail!("{DISK_QUOTA_BIN} not present; disk quota cannot be enforced");
}
if !mountpoint_mounted(fs_mountpoint) { anyhow::bail!("{fs_mountpoint} is not a mountpoint"); }

Type guard

fn disk_quota_tooling_ready() -> bool {
    std::path::Path::new("/usr/bin/sudo").exists() && std::path::Path::new(DISK_QUOTA_BIN).exists()
}

Try / catch

// Read the ExitStatus from the chain to distinguish causes
let out = Command::new("/usr/bin/sudo").arg(DISK_QUOTA_BIN).args([size, mount]).output()?;
if !out.status.success() {
    let reason = out.status.code().map(|c| format!("exit {c}")).unwrap_or_else(|| "signal".into());
    return Err(anyhow!("set-disk-quota failed ({reason}): {}", String::from_utf8_lossy(&out.stderr)));
}

Prevention

When it happens

Trigger: set-disk-quota exits non-zero: the binary /neonvm/bin/set-disk-quota is missing or not executable; sudoers does not allow NOPASSWD execution for the compute_ctl user; the mountpoint argument does not match a mounted filesystem; size_kb rejected as invalid.

Common situations: Running compute_ctl outside a NeonVM image (plain VM/container without the quota tool); base image changes that moved the binary; sudoers hardening removing the whitelisted rule; wrong fs_mountpoint after mount-layout changes; smoke/dev environments.

Related errors


AI-assisted analysis of neondatabase/neon@8f60b04da4 (2026-08-16). Data as JSON: /api/errors/35332da96c30aabc. Report an issue: GitHub.