{"record":{"id":"11a69d5793fcb7e8","repo":"neondatabase/neon","slug":"process-exited-with-status-11a69d","errorCode":null,"errorMessage":"process exited with {status}","messagePattern":"process exited with (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compute_tools/src/swap.rs","lineNumber":33,"sourceCode":"    //\n    // NOTE: resize-swap is not very clever. If present, --once MUST be the first arg.\n    let child_result = std::process::Command::new(\"/usr/bin/sudo\")\n        .arg(RESIZE_SWAP_BIN)\n        .arg(\"--once\")\n        .arg(size_bytes.to_string())\n        .spawn();\n\n    child_result\n        .context(\"spawn() failed\")\n        .and_then(|mut child| child.wait().context(\"wait() failed\"))\n        .and_then(|status| match status.success() {\n            true => Ok(()),\n            false => {\n                // The command failed. Maybe it was because the resize-swap file doesn't exist?\n                // The --once flag causes it to delete itself on success so we don't disable swap\n                // while postgres is running; maybe this is fine.\n                match Path::new(RESIZE_SWAP_BIN).try_exists() {\n                    Err(_) | Ok(true) => Err(anyhow!(\"process exited with {status}\")),\n                    // The path doesn't exist; we're actually ok \n                    Ok(false) => {\n                        warn!(\"ignoring \\\"not found\\\" error from resize-swap to avoid swapoff while compute is running\");\n                        Ok(())\n                    },\n                }\n            }\n        })\n        // wrap any prior error with the overall context that we couldn't run the command\n        .with_context(|| {\n            format!(\"could not run `/usr/bin/sudo {RESIZE_SWAP_BIN} --once {size_bytes}`\")\n        })\n}\n","sourceCodeStart":15,"sourceCodeEnd":47,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/compute_tools/src/swap.rs#L15-L47","documentation":"compute_tools::swap::resize_swap runs `/usr/bin/sudo /neonvm/bin/resize-swap --once <size_bytes>` to grow the VM swap device before Postgres starts. This error means the child process ran but exited with a failure status AND the resize-swap binary still exists at /neonvm/bin/resize-swap (if the binary is gone, the failure is treated as 'not installed' and only warned about, because --once makes the script delete itself on success). The error is wrapped with the full command line, so the anyhow chain shows both the exit status and the invocation.","triggerScenarios":"Calling compute node startup (compute_ctl) in a NeonVM environment where resize-swap is present but fails: invalid size argument, sudo refusing to execute the script, missing CAP_SYS_ADMIN for swapon/swapoff, or the swap file/device being in a bad state. Only triggered when try_exists() on RESIZE_SWAP_BIN returns Ok(true) or errors; Ok(false) degrades to a warn.","commonSituations":"Custom or older VM images where /neonvm/bin/resize-swap exists but has a bug; sudoers configuration that blocks the command; running the compute container in an environment (plain docker, bare-metal dev box) where the binary path exists as a leftover file but the swap operations fail; size_bytes computed as 0 or overflowing the script's parser.","solutions":["Run `/usr/bin/sudo /neonvm/bin/resize-swap --once <size>` manually with the same size to see the script's real error output (this Rust wrapper discards the child's stdout/stderr).","Verify sudo is installed and allows running the script non-interactively (`sudo -n /neonvm/bin/resize-swap --once 1073741824`).","Check that size_bytes is sane (non-zero, plausible multiple of KiB) at the call site that computes it.","If you don't need swap resizing in your environment, remove or rename /neonvm/bin/resize-swap so the code takes the Ok(false) path and only warns.","If the failure is acceptable operationally, catch/warn at the call site in compute startup instead of propagating it."],"exampleFix":"// before\nresize_swap(size_bytes)?; // aborts compute startup on resize-swap failure\n\n// after\nif let Err(e) = resize_swap(size_bytes) {\n    tracing::warn!(\"resize-swap failed, continuing without resize: {e:#}\");\n}","handlingStrategy":"fallback","validationCode":"// before calling compute startup / resize_swap\nuse std::path::Path;\nlet installed = Path::new(\"/neonvm/bin/resize-swap\").try_exists().unwrap_or(false)\n    && Path::new(\"/usr/bin/sudo\").exists();\nif !installed {\n    // resize-swap not present: skip instead of relying on the internal warn path\n    return Ok(());\n}","typeGuard":"fn swap_resize_available() -> bool {\n    std::path::Path::new(\"/neonvm/bin/resize-swap\").exists()\n        && std::path::Path::new(\"/usr/bin/sudo\").exists()\n}","tryCatchPattern":"if let Err(e) = resize_swap(size_bytes) {\n    // swap sizing is an optimization; do not abort compute startup over it\n    tracing::warn!(\"resize-swap failed, continuing without resize: {e:#}\");\n}","preventionTips":["Pin a known-good VM image containing the resize-swap script you tested.","Smoke-test `/usr/bin/sudo /neonvm/bin/resize-swap --once 1` in image CI so regressions surface at build time.","Validate size_bytes (non-zero, KiB-aligned) before computing the swap target.","In non-NeonVM environments, ensure the binary is absent so the built-in warn-only path applies."],"tags":["rust","neon","compute-tools","swap","subprocess","sudo","neonvm"],"backgroundTag":"subprocess-nonzero-exit","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}