Skip to content

Process Manager

Edgar Cano edited this page Sep 25, 2026 · 1 revision

Process Manager

Built into the runtime. No pm2, no separate daemon process.

3va start server.js --name api
3va start server.js --name worker -- --port 4000   # pass args after --
3va start server.js --name one-shot --no-autorestart  # never respawn on crash
3va status                                          # all processes
3va status api                                      # one process
3va logs api --lines 200
3va restart api
3va stop api                                        # SIGTERM, then SIGKILL if still alive after 30s
3va delete api                                      # stop + remove logs

Process metadata and logs live in ~/.3va/processes/.

3va start flags

Flag Description
--name <n> Process name (required for management commands)
-- Everything after this is passed through to the script
--no-autorestart Never respawn on crash
--max-restarts <N> Consecutive crashes before giving up (default: 15)

Automatic restart with exponential backoff

When a managed process dies unexpectedly, the supervisor restarts it automatically with exponential backoff:

500 ms → 1 s → 2 s → 4 s → … → capped at 30 s

It gives up after 15 consecutive crashes (tunable with --max-restarts). The Restarts column in 3va status counts both automatic and manual restarts.

Stop semantics

3va stop sends SIGTERM, then polls every 200ms, then sends SIGKILL if the process is still alive after 30s. It always stops the process for good — it never triggers a respawn, regardless of the backoff state.

Note: an older README figure of "1.5s" predates a change in the implementation — the current behavior is the 30s polled deadline above. See docs/CHANGELOG.md in the repository for the history.

Disabling auto-restart

Start a process with --no-autorestart to disable automatic restarts for it specifically; it will then be reported as error after a crash until you 3va restart it by hand.

Restarted processes keep their permissions

A restarted process keeps the exact same permissions it had at first start — same CLI flags, same package.json "3va" grants. Restarting is not a way to escalate what a process can access.

Logs

3va logs api --lines 200    # default: 50 lines

3va delete <name> stops the process and permanently removes its logs.

See CLI Reference for the full command table.

Clone this wiki locally