Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Attached or embedded

ergo-aeron reaches a driver in one of two ways. Attached mode is the default and the only passive one.

Attached (default)Embedded (--embedded)
What it isreads an existing driver’s files; no Aeron client, no subscriptionstarts a media driver of the tool’s own, in a new directory, plus a client on it
Streams it showsevery stream that driver carries, picked from the Streams taba stream you name by channel URI and stream id, joined as a receiver: multi-destination, multicast, or a unicast one sent to this host (its publisher then has this tool as its only receiver, so the tool paces it: read such a stream attached if that matters)
Stats tabsthat driverthe tool’s own driver (own driver on the top line), unless --aeron-dir names another
Effect on publishersnone (why)it is a real receiver; see the guards below
Good forthe host or pod where the driver runsa machine with no driver on the stream’s network

ergo-aeron is the installed binary (Install).

Embedded mode

Embedded mode never starts by itself: with no live driver, attached mode says so and names --embedded. Join a stream with:

ergo-aeron --embedded messages --stream 2002 --follow \
    --channel 'aeron:udp?endpoint=192.0.2.10:40456|control=192.0.2.1:40457' \
    --schema sbe/tests/fixtures/schemas/car.xml

or open the screen on it with ergo-aeron --embedded --channel URI --stream N. Standard error names the driver’s directory and says [LIVE RECEIVER]; the screen keeps [LIVE RECEIVER] on its top line. A receiver has nothing retained, so messages --channel needs --follow. The subscription is polled on a thread of its own into a bounded queue: a slow or stalled pipe loses messages (dropped N messages on standard error), never the subscription’s pace. When the queue is full it is the newest batch that is dropped, not the oldest.

Both at once is allowed: with --aeron-dir DIR --embedded the stats tabs read DIR passively (the top line names it, not own driver) while channels are joined through the tool’s own driver.

The driver’s directory is new for each run: --embedded-dir DIR, which must not exist (its parent must), or by default a fresh one beside Aeron’s default directory. It is created here and nowhere else:

  • a directory that exists is refused, empty or not, and left as it is; one that holds a live driver is refused saying so;
  • the directory and the driver’s settings are set explicitly, so no AERON_DIR or AERON_DIR_DELETE_ON_START in the environment can aim it at another driver;
  • it is removed on exit, on SIGINT, SIGTERM and SIGHUP, on a closed pipe and after a failed start, but never while a live driver is in it. A process killed with SIGKILL leaves it behind, as can one ended because it was still running 5 seconds after a signal, stuck or not.

The driver runs in shared threading mode with the sleep-ns idle strategy (1 ms), so it sleeps when idle and needs no CPU of its own; its own logs use 64 KiB sparse terms. Other AERON_* settings (a network interface, socket buffers) come from the environment as usual, except the ones that decide how the viewer talks to the publisher or how long a stalled stream stays silent: the receiver group tag and group consideration, the reliable, tether and rejoin defaults, the status message, image liveness and untethered timeouts are set by the tool over the environment, and an AERON_CONGESTIONCONTROL_SUPPLIER other than Aeron’s default or static refuses the start (cubic congestion control sends round-trip probes to the publisher).

In Kubernetes the directory lives in the pod, not on the node: give it a writable memory-backed emptyDir (--embedded-dir under it), and make sure the pod can reach the stream over the network (the pod network or hostNetwork, and the UDP port of its own endpoint). The tool’s own driver belongs to the pod that runs it; it reads the pod’s media driver only if told (--aeron-dir, attached).

The guards

Every viewer subscription gets these options, whatever the typed URI says:

OptionWhat it does for the viewer
reliable=falsea gap is filled locally and its bytes are counted as skipped; no NAK asks the publisher to resend
tether=falsestated plainly; it does not make its driver drop a lagging viewer (see below)
untethered-window-limit-timeout=500ms, untethered-resting-timeout=1sthe same: they never act on the viewer (Aeron’s defaults are 5 s and 10 s)
group=falsestated plainly; with reliable=false it changes nothing on the wire
no gtag, no group tag on its driver, rejoin left at its defaultnever a member of a tagged flow-control group, even with AERON_RECEIVER_GROUP_TAG in the environment
no ccno cubic congestion control, which would send round-trip probes to the publisher
no rcv-wndthe receiver window is the driver’s 128 KiB (at most half the term), the one the viewer’s own leave is a share of
session-id, with --session Sone publisher instead of every one on the stream

There is no driver backstop. Aeron’s untether (tether=false and the untethered timeouts) measures a subscriber’s lag against the furthest subscriber of the same image, and the viewer is the only one on its driver, so its driver never drops it. The viewer’s own leave is the only guard, and it leaves the stream when:

  • it is behind what its driver has ready to read by more than half the stream’s receiver window (the driver’s 128 KiB, never more than half the term, so 64 KiB on terms of 256 KiB and up) on three checks in a row, 10 ms apart: a viewer a busy machine kept off the CPU for a moment catches up on its next reads and stays;
  • it is past three quarters of the window, which it leaves on the first check;
  • its driver counts frames dropped beyond its accept limit (the system counter Flow control over runs) since the viewer last joined. A receiver takes a frame only up to its last status message plus half the term; past that it drops every frame, heartbeats too, and the stream stays silent until the image times out (10 s) while the viewer’s lag reads 0, so the counter is the only sign. The status message trails the viewer’s reads, so a burst arriving just after the viewer catches up can be dropped: it then leaves and rejoins 1 s later, even if it was inside its lag bound.

It leaves without reading the backlog, says why (on standard error, and on the Messages tab’s status line), and rejoins at the live position a second later. If its driver is still closing the endpoint it left and says to retry, it tries again 100 ms later, at most 20 times; after that the error, with the driver’s words, ends the stream.

A gap from loss is not lag, so the viewer does not leave for it. Its driver fills the gap with padding, and the viewer adds the bytes its driver’s loss report records to skipped (lost: skipped N bytes ... on standard error, skipped on the Messages tab’s status line). That covers a datagram lost in the network and one the kernel dropped because the viewer’s socket buffer was full, which a stall of its driver’s thread of about ten milliseconds can cause. Known limitation: over UDP the embedded viewer can lose data at a term end.

A fatal error from Aeron’s client (the driver went away, or the process was suspended for longer than the driver timeout) ends the stream the same way, through the next read, so the directory is removed and the terminal restored; Aeron’s own handler would have exited the process. So does a failure of the client’s own conductor (an image that cannot be mapped, say), and a UDP receive channel whose status is errored (checked every 10 ms; Aeron’s C driver never sets it, the Java driver does). A join the driver refuses (an invalid channel, no storage space) is the error of the join itself, before any stream. Other client errors (a full buffer to the driver, say) are counted and do not end it. The count of dropped frames is one counter for the whole driver, so there is one viewer per embedded driver: a second is refused with a clear error.

typed:   aeron:udp?endpoint=192.0.2.10:40456|control=192.0.2.1:40457
joined:  aeron:udp?endpoint=192.0.2.10:40456|control=192.0.2.1:40457|reliable=false|tether=false|group=false|untethered-window-limit-timeout=500ms|untethered-resting-timeout=1s

typed:   aeron:udp?endpoint=192.0.2.10:40456|control=192.0.2.1:40457|reliable=true|tether=true|gtag=7
joined:  aeron:udp?endpoint=192.0.2.10:40456|control=192.0.2.1:40457|reliable=false|tether=false|group=false|untethered-window-limit-timeout=500ms|untethered-resting-timeout=1s

typed:   aeron:udp?endpoint=224.0.1.1:40456|interface=192.0.2.10|fc=min
refused: fc=min: under min flow control any receiver can hold the publisher, so embedded mode refuses to join (attach to the publisher's driver instead)

typed:   aeron:ipc
refused: an IPC stream belongs to its own driver; read it attached (--aeron-dir), which is passive

Under Aeron’s default flow control for multi-destination and multicast streams (max) the sender follows its fastest receiver: the viewer cannot hold a publisher that has a faster receiver, but a viewer that is the only receiver of the stream paces it, and the strategy goes on counting it until its receiver timeout (5 s by default) after it leaves. The viewer cannot see how many receivers a publisher has, so this is not detected; join such a stream attached (passive) when the publisher must not wait. Under tagged flow control only receivers with the group’s tag count, so the viewer cannot hold such a publisher (it sends no tag, even with AERON_RECEIVER_GROUP_TAG in the environment). Do not join a stream whose publisher uses fc=min: then every receiver counts, and one that leaves is still counted until the strategy’s receiver timeout (5 s by default). The viewer cannot see the publisher’s setting, so a typed URI with fc=min is refused and the screen shows LIVE RECEIVER throughout; a fc=min publisher the URI does not mention is not detected.

An IPC stream and a spy belong to the driver they run on, so they are refused here: read them attached, which is passive.

History

ergo-aeron remembers what it was used with, so it is easier to open again:

RememberedUsed for
aeron directories that were read (attached)history
a stream of an attached driver, or a channel and stream joined embedded, with the schema sources loaded with itthe screen’s picker (o or F7), which reopens it with those schemas; messages without --schema offers them on standard error
schema sources: file paths, directories and URLs, never the schema textthe picker loads one (a URL only at start, with --schema); a path no longer there shows as schema (missing) and is skipped when a stream’s schemas are reloaded
archive directories (--archive-dir) and archive control channels with their stream (--control)history; a control channel is kept only when every parameter is one of Aeron’s own, so a value typed where a credential might go is never written
kind              value                                                        stream  schemas                              last used ms
channel           aeron:udp?endpoint=192.0.2.10:40456|control=192.0.2.1:40457    2002  sbe/tests/fixtures/schemas/car.xml  1764400002000
stream            /dev/shm/aeron                                                 1001  sbe/tests/fixtures/schemas/car.xml  1764400001000
schema            sbe/tests/fixtures/schemas/car.xml                                                                       1764400001000
schema (missing)  schemas/old.xml                                                                                          1764400000500
aeron-dir         /dev/shm/aeron                                                                                           1764400000000

The file is $XDG_STATE_HOME/ergo-aeron/history.json, else ~/.local/state/ergo-aeron/history.json (on macOS too), written owner-only (the directory 0700, the file 0600). It keeps the newest 200 entries and 64 schema sources per stream. It holds names only: no message, and no URL with user information, a query or a fragment, where a credential would sit. A channel URI is kept as typed (no Aeron 1.54 channel parameter is a credential); an archive control channel only when every parameter is one of Aeron’s own, so a value typed under any other key is never written.

Each run writes the whole file through a temporary file of its own name, renamed into place, so two runs saving at once never leave a torn file. The last one to save wins: it writes what it read at its start plus what it did, so a long screen session that ends after a shorter command forgets that command’s entries (and history clear run meanwhile).

Read back, the file is untrusted: one that is corrupt, larger than 1 MiB or unreadable is ignored with one notice on standard error, and a directory that cannot be written turns history off with one notice. Neither stops the command. --no-history reads and writes nothing; history lists the entries (table or JSON lines) and history clear forgets them.