Skip to main content
axe.v1 is the gRPC API axed serves on every --listen endpoint. The source of truth is proto/axe/v1/axe.proto.

Connecting

  • Endpoints. Every listener serves axe.v1: TCP, Unix socket, vsock or an inherited descriptor. See --listen.
  • Auth. With a token configured, send it as authorization: Bearer <token> or x-sandboxd-token: <token> metadata on every call. A missing or wrong token fails with UNAUTHENTICATED (missing or invalid bearer token). Listeners with ?auth=none skip the check.
  • Reflection. axed serves grpc.reflection.v1. It lists only the services enabled on the daemon: axe.v1 and whichever adapters are on. grpcurl and similar tools need no proto files. Reflection needs the token like every other service, except on ?auth=none listeners.
  • Keepalive. The server pings every 20 seconds and drops a connection that does not answer within 10 seconds. A new connection must send the HTTP/2 preface and first frame within 10 seconds.
  • Errors. Engine errors map to gRPC codes as listed in Errors. The errors a client branches on also carry a google.rpc.ErrorInfo with a machine-readable reason, such as NAME_IN_USE. See Reasons.
  • Health. axed serves grpc.health.v1 on every gRPC listener, without the token. The overall status (service "") is SERVING until shutdown starts, then NOT_SERVING. Kubernetes gRPC probes can use it.

Concepts

Process ids are opaque 32-hex-digit strings. They are never reused and belong to one daemon instance. After a cold boot the instance id changes and old ids are unknown. Output from stdout and stderr goes into one log per process, addressed by byte offset. Offsets start at 0 and never reset, so replay keeps stdout and stderr interleaved. The log keeps the most recent retain_bytes. Process.output_start is the oldest retained offset and output_end is one past the newest. Readers are lossless by default. When a reader has not read output and keeping it would exceed retention, axed holds the process back until the reader reads. A lossy reader never slows the process and gets Gap events for evicted bytes. Lifetime. axed keeps processes from Start, Run, Exec with a request_id, and the Agent Substrate API after exit for reattach, until they are removed, until --max-finished newer ones have finished, or until the output budget needs the space. axed forgets processes from Exec without a request_id when they exit. Retries. Start, Run and Exec take a request_id. Repeating a request with the same id and the same request returns the first one’s process (or, for Exec, its result) instead of running the command again. The same id with a different request fails with ALREADY_EXISTS (REQUEST_ID_CONFLICT). Once axed has evicted the process, a repeat fails with FAILED_PRECONDITION (REQUEST_EXPIRED), for as long as axed remembers the id: it remembers the last 4096 evicted ids. A process removed with Remove frees its id for a new request. Paths in Files are relative to the daemon’s root. Absolute paths under the root are accepted; absolute paths outside it fail with PERMISSION_DENIED, as does any path that climbs above the root with ... Resolution never leaves the root, even through symlinks. See File confinement.

Processes

Common messages

ProcessRef

Names a process. Exactly one of: And optionally: An unknown id or name fails with NOT_FOUND. A ProcessRef with neither field fails with INVALID_ARGUMENT.

Spec

What to run. A program that does not exist fails with NOT_FOUND; one that cannot be executed fails with PERMISSION_DENIED.

Limits

Every set value must be positive; 0 fails with INVALID_ARGUMENT. A limit the request leaves unset takes the daemon’s default (--default-timeout, --default-memory, --default-max-tasks) or else its ceiling (--max-timeout, --max-memory). A timeout or memory_bytes above its ceiling fails with INVALID_ARGUMENT (LIMIT_EXCEEDED), naming the flag. All of them are off by default. Info reports them.

Process

Exit

ExitReason is one of these. When axed killed the tree, the first cause it acted on wins, whatever status that left. A process that axed asked to stop but that exited first keeps EXITED or SIGNALED.

Usage

axed reads usage only when a process is described, by Get, List, Wait and the events that carry a Process. It never samples in the background. Without the memory controller, the memory figures of a tree read 0.

ProcessEvent

A streamed event. Exactly one of:

Start

Launches a detached process and returns once it is running. The process keeps running whether or not anyone reads it. Fails with RESOURCE_EXHAUSTED (BUDGET_EXHAUSTED) when running processes hold the whole output budget or the process table is full, with FAILED_PRECONDITION (FROZEN) while processes are frozen, and with FAILED_PRECONDITION while the daemon shuts down.

Run

Starts a process and streams its events in one call: started, then output, then exited. The reader is lossless, so a new process never produces gap. axed keeps the process after exit like one from Start. A slow client holds the process back once retention is full. Repeating a request_id returns the existing process and replays its output from offset 0. If output before the oldest retained byte was already evicted, that stream starts with a gap. Without detach, the repeated stream also controls the process’s lifetime. axed kills the tree if that stream ends before the process exits.

Exec

Runs a command to completion and returns its output. Without a request_id, axed kills the process tree if the call is cancelled, and forgets the process when it exits. A retry after a snapshot, when the first call’s connection dropped, is the case request_id is for: the first run keeps going and the repeat collects its result. All concurrent unary executions share a buffer budget, --capture-budget. When it is exhausted, further output is dropped and marked truncated instead of waiting.

Attach

Replays retained output from an offset and then follows the process. The first event is started. The last, unless no_follow stops early or the stream fails, is exited. A process allows at most 64 lossless readers at once, counting Run streams and lossless Attach streams. A lossless Attach beyond that fails with RESOURCE_EXHAUSTED; lossy readers are not limited. To resume after a disconnect, pass the offset one past the last byte you received: offset + len(data) of the last output event. Attaching to a finished process replays what is retained and ends with exited.

Wait

Returns the process (WaitRequest.process, a ProcessRef) once it has exited and its output is complete. Returns immediately for a finished process.

Get

Returns the current state of the process GetRequest.process names, with its usage now if it is running.

List

Returns every tracked process, running and finished, in start order. ListResponse.processes holds the matches.

WriteInput

Writes to stdin. The response’s offset is the total stdin bytes accepted so far. Fails with FAILED_PRECONDITION when the process has no stdin (started without stdin), or its stdin was already closed. Writing to a process that has exited fails with FAILED_PRECONDITION (PROCESS_EXITED). So does a write that is still blocked when the process exits, because the process stopped reading its input. An offset that overflows when the length of data is added fails with INVALID_ARGUMENT. Bytes the process accepted count toward the offset even when the write then fails or is cancelled.

StreamInput

Writes an ordered stream of stdin chunks. For clients that cannot stream, use WriteInput. An empty stream fails with INVALID_ARGUMENT. The response’s offset is the stdin offset after the last chunk.

Signal

Delivers any signal number to the process group, or to the leader alone. Signaling a process whose leader has exited succeeds and does nothing, even while axed is still collecting its output. A kernel refusal fails with PERMISSION_DENIED.

Resize

Sets the terminal size to cols by rows. axed clamps values above 65535. Fails with FAILED_PRECONDITION when the process has no terminal, and with FAILED_PRECONDITION (PROCESS_EXITED) when it has exited.

Remove

Forgets a finished process and frees its retained output. A process that is already gone fails with NOT_FOUND, as Get does. A retried Remove that gets NOT_FOUND has therefore succeeded.

Files

FileInfo

Stat

Metadata for path, following symlinks. A missing path fails with NOT_FOUND.

List

Streams the entries of a directory in lexical order, each directory before its contents. Symlinks are reported with their target’s metadata and never descended into. Broken symlinks and symlinks that point outside the root are left out. A listing of any depth, direct children included, fails with INVALID_ARGUMENT once it passes 100,000 entries, or once the names it returns, each a path from the listed directory, add up to more than 32 MiB. A path that is a file, not a directory, fails with ALREADY_EXISTS. The whole listing is read before the first entry is sent.

MakeDir

Creates a directory and returns its metadata. An existing directory succeeds unchanged. An existing non-directory fails with ALREADY_EXISTS.

Move and Copy

Move or copy a file, symlink or directory tree. Symlinks are transferred as links. An existing destination without overwrite, or a directory destination with it, fails with ALREADY_EXISTS. A source and destination that are the same path, or a directory moved or copied into itself, fail with INVALID_ARGUMENT. A copy keeps permission bits but drops setuid and setgid.

Remove

Removes a file, a symlink (never its target) or a directory. Removing the root itself with recursive empties it. Without recursive it fails with ALREADY_EXISTS.

Read

Streams a file. The first message carries its info (a FileInfo); the rest carry data in chunks of up to 256 KiB. A directory fails with FAILED_PRECONDITION. FIFOs, sockets and devices fail with INVALID_ARGUMENT.

Write

Writes a file from a stream of WriteChunk messages: one header, any number of data chunks, then one commit. Returns the written file’s metadata. In REPLACE and CREATE_ONLY mode the data goes to a temporary file that appears at path only on commit: an unnamed O_TMPFILE, or a .axe-tmp-* file on filesystems without it. A stream that ends without a commit, for any reason (cancelled, disconnected, failed), leaves nothing behind and fails with ABORTED. APPEND writes in place as data arrives and is not atomic. Bytes written before a failure stay, and a stream that ends without a commit still fails with ABORTED. Errors:

Watch

Streams changes under a directory. WatchEvent is one of: axed gathers events in 50 ms batches and delivers them in order. It does not report temporary files from in-progress uploads, and a committed upload shows up as a CREATE of its path. The stream ends when the client cancels or the daemon shuts down. At most 64 watches run at once across all APIs. Beyond that, Watch fails with RESOURCE_EXHAUSTED. axed checks the limit before the path, so with every slot taken even a watch on a missing path gets RESOURCE_EXHAUSTED. A failure of the underlying watch ends the stream with INTERNAL.

System

Health

Info

Configure

Applies host-provided state when a sandbox is bound or after a resume. Call it after every snapshot restore on platforms that freeze guest clocks. See Snapshots. The whole request is checked before anything changes.

Freeze

Freezes or thaws every running process tree through its cgroup, as a quiesce point before a snapshot. Without cgroups it fails with FAILED_PRECONDITION. From a freeze until the thaw, axed refuses to start processes: Start, Run, Exec and the adapters’ starts fail with FAILED_PRECONDITION (FROZEN). A process that started then would run while the rest are stopped, and a snapshot would catch it mid-start. Repeating a request_id whose process already exists still succeeds. Starts already under way when the freeze arrives finish first and are frozen with the rest.