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

Driver tabs and Aeron’s own tools

Each driver tab stands in for one of the tools that ship with Aeron 1.54.3, reading the same files, so it works wherever those tools do; Messages has no Aeron counterpart (Live messages):

TabSubcommandAeron 1.54.3 toolShows
CounterscountersAeronStatevery counter: value, change per second, change since the mark
StreamsstreamsStreamStat, BacklogStatone row per stream: every position, backlog, the slowest subscriber and the publisher’s headroom
ErrorserrorsErrorStatdistinct errors with their count, first and last time
LosslossLossStatper stream: gaps and bytes lost
DriverdriverDriverTool (pid, CnC metadata)pid, versions, buffer lengths, heartbeat age
Messagesmessagesnone (LogInspector reads the same log file, offline)one stream’s messages, read from its log file with no subscription, decoded with the schemas given; counts per message type
Recordingsrecordingsnone (the archive client’s listRecordings and position queries)an archive’s recordings from its control session, read requests only: positions, start and stop, stream, channel, session; each active recording’s lag
Payloadreplaynone (the archive client’s startReplay)one recording’s messages, replayed through the control session and decoded with the schemas given; live while it records
Archive dirarchive-dirArchiveTool (describe, describe-all, count-entries, capacity, pid, errors, dump, verify without marking)an archive directory read as files, never written: catalogue, mark file, segment files, disk use and time until full

Two commands are not tabs: the log inspector, and the one action that writes, both from tables in the code:

CommandAeron 1.54.3 toolAccessNeeds --confirmWhat it does
logLogInspectorReadnoone stream’s log file as it lies (metadata, term tails, every frame header and its payload), read with no client; also a log file given by path
driver terminateDriverTool terminateWritethe driver PID@START_MSasks the driver to stop, through its CnC file; the driver’s termination validator decides, and Aeron’s default denies

All of them read cnc.dat in the driver’s directory (and loss-report.dat for Loss), mapped read-only; Messages and log also read the stream’s log file. No client is started (in embedded mode only the tool’s own driver gets one, Attached or embedded), and nothing is written to a driver unless the tool is given --write and driver terminate is confirmed (below).

Aeron’s C reader trusts the lengths a file carries, and a wrong one crashes it, so ergo-aeron checks them first. A counter label that does not fit its record, a counter value that does not fit the values buffer, or a to-driver buffer Aeron cannot read a heartbeat from, refuses the read (exit status 2, cannot read the Aeron driver at ...: ...); that is not “driver gone”. A driver that closed cleanly leaves its directory with the heartbeat cleared, which is ALARM (driver gone). A damaged error log or loss report is left out and named in the read’s notes, which turn the health line to WARN. A label that is not UTF-8 is shown with the bad bytes replaced by U+FFFD, and warns the same way.

Counters

One row per allocated counter: id, type id, value, change per second since the previous read, change since the mark, and label. Counters are running totals, so the rate and the mark are what show a test’s effect. Enter on a row explains the counter and links it to its owner, stream, recording and siblings (What each counter means).

Streams

One row per stream, keyed as BacklogStat keys it: session and stream id, on IPC or on the network. The publisher’s channel is shown; subscribers may have written the same channel differently (aeron:ipc against aeron:ipc?term-length=65536) and still count on the same row.

ColumnFrom
pub pos, pub limitthe publisher’s position and limit: it cannot publish past the limit
snd pos, snd limita network publication’s sender position and flow-control limit
rcv hwm, rcv posa network image’s receiver high-water mark and position
subscribers (id@pos)every subscriber on this driver: registration id and position
slowest, behindthe subscriber furthest behind what it follows (the publisher for IPC and spies, the receiver’s high-water mark for an image), and by how many bytes
headroom %how far the publisher is from back pressure, as a share of its window: (limit - position) / (limit - base); 0 once it has reached the limit

The base is what moves the limit on. On IPC it is the lowest subscriber; on a network publication it is the lowest of the sender and any spy on this driver. So an IPC row with headroom near 0 and one subscriber far behind names the subscriber holding the publisher back.

slowest is the subscriber with the most bytes behind (never below 0: a subscriber read ahead of its head is 0 behind). When several tie, as when all have caught up, it is the one at the lowest position, then the lowest registration id, so the same read always names the same subscriber.

Errors and Loss

Errors lists each distinct error the driver logged, with its count and its first and last time (UTC); a multi-line error is joined with |. Loss lists, per stream and source, the gaps a receiver filled and the bytes lost.

Driver

The pid, the Aeron version the driver reports, the CnC layout version, the start time, the age of the driver’s heartbeat, the client liveness timeout, and the buffer lengths. The driver stamps its heartbeat about once a second.

Log inspector

ergo-aeron log --stream N reads the stream’s log file (a publication’s, else an image’s) as Aeron’s LogInspector does, and --file PATH reads a log file with no driver, such as a copy. It prints the log’s metadata, each term partition’s tail counter, then every frame header from the start of each term with its payload:

$ ergo-aeron log --file stream-1001.logbuffer --dump 16 --format table
field              value
log                stream-1001.logbuffer
correlation id     3
is connected       1
active transports  0
initial term id    0
term count         0
active index       0
term length        65536
MTU                1408
page size          4096
EOS position       9223372036854775807
default header     frame-length=0 version=0 flags=11000000 type=1 term-offset=0 session-id=77 stream-id=1001 term-id=0 reserved-value=0
tail 0             term id 0 term offset 320 raw tail 320 position 320
tail 1             term id -2 term offset 0 raw tail -8589934592 position -131072
tail 2             term id -1 term offset 0 raw tail -4294967296 position -65536

index      offset  frame length  version  flags      type  term offset      session       stream      term id              reserved  payload
    0           0           140        0  11000000      1            0           77         1001            0                     0  2900010001000100D2040000DD070141
    0         160           140        0  11000000      1          160           77         1001            0                     0  2900010001000100D2040000DD070141
    0         320             0        0  00000000      0            0            0            0            0                     0  end: frame length 0 (not written yet, or cleaned by the driver; --scan-over-zeroes looks past it)
    1           0             0        0  00000000      0            0            0            0            0                     0  end: frame length 0 (not written yet, or cleaned by the driver; --scan-over-zeroes looks past it)
    2           0             0        0  00000000      0            0            0            0            0                     0  end: frame length 0 (not written yet, or cleaned by the driver; --scan-over-zeroes looks past it)

The two unused partitions hold the term ids the driver starts them with, so their positions are negative, as LogInspector shows them. Each term’s walk stops at the first frame that is not whole, with a note: a zero length, a frame still being written (negative length), a length below the 32-byte header, or one that runs past the term. A zero length is either not written yet or already cleaned. An IPC publication’s driver zeroes the term right behind its slowest subscriber, so on a stream whose subscribers keep up the start of the active term is zeros and the frames lie further on. A network publication’s driver cleans only up to one term length behind the sender’s position (or its slowest receiver’s), so the active term’s frames stay readable. --scan-over-zeroes skips empty slots and finds them, and does not print the slots (LogInspector prints each). --dump BYTES caps the payload per frame (default: 65536, an MTU; --dump-all shows every byte, however long a frame a damaged or hostile file claims) and --ascii prints it as text, every control character as ?. Frames print one at a time, the table with fixed column widths, so memory stays flat however large the log. A file that is not a regular file (a FIFO, a device) is refused. The metadata is checked before use (term length and page size powers of two in range, the file length they make, MTU and window in range), and a log that fails is refused with the reason. On the Streams tab, Enter shows the log’s main fields (path, term length, MTU, initial term id, active index, end-of-stream position and each tail) above the row’s own columns.

Terminate

What each write action changes, from the code’s action table:

ActionReversibleCreatesDeletesFreesGrows
driver terminatenononothing on disk; in-flight data of the driver’s clients is lostnothingnothing

ergo-aeron driver terminate asks the driver to stop, as DriverTool terminate does: it writes a terminate command into the driver’s to-driver buffer, so it needs cnc.dat writable. It is refused, with exit status 2 and nothing sent, unless it is given both --write and --confirm PID@START_MS, the driver’s pid and its start time in milliseconds from the CnC file, both as ergo-aeron driver --format json shows them (or --dry-run, below). The start time is there because the pid alone names nothing in a container, where a driver started as the entry point is pid 1 in every pod. A bare pid, or 1, is refused with a message that prints the exact token to use. Without --write it is refused before the driver’s files are read; a wrong token (from a wrong --aeron-dir, say) is refused after a read-only read. The pid and start time are read again just before the request is written, and a driver that restarted in between is not asked. A driver whose heartbeat is already older than its liveness timeout is not running: that is refused too, with nothing sent.

--dry-run prints what would be done, the token that confirms it and the command line that does it, then exits 0. It needs no --write, and with it nothing is ever sent or logged, whatever else is on the command line. --write without --confirm prints the same on standard error and exits 2. It is the tool’s own prediction from its read: the driver decides.

With --embedded, nothing is written to the tool’s own driver: driver terminate is refused, and the terminal UI offers no action, unless --aeron-dir names another driver’s directory.

The action log

Every write that passes the gate is logged: an intent line before anything is sent, a result line after (done, unconfirmed or refused), one JSON object per line with the time, the action, its target token and the directory. The file is ergo-aeron/actions.log under XDG_STATE_HOME, else ~/.local/state/, readable by its owner only; --action-log PATH moves it, and --no-history does not turn it off. If the intent line cannot be written and synced, the action is refused and nothing is sent. So is a path that is not a regular file, is a symbolic link, belongs to another user, gives its group or others any access, or already holds something that is not an action log: the tool never appends to other data. A new log’s directory is synced too. A refusal at the gate (no --write, no or wrong token) is not logged, nor is a dry run. An intent line with no result line means the tool was stopped in between: check the driver. In a container with a read-only home, point --action-log at a writable volume.

In the terminal UI

Start it with --write (the top line says [WRITE]), open the Driver tab and press a (or F2): the menu lists the tab’s write actions. Enter shows the preview and a box; type the whole token and press Enter. Any other text keeps the box open and sends nothing; Esc cancels. The request runs off the screen’s thread, and a line at the foot says waiting, then done, unknown or refused with the log’s path (Esc clears it). The write is the command line’s own: the same gate, checks and log. One confirmation sends at most once, and one write runs at a time. While it waits, Esc and q do not quit; Ctrl-C does. Quitting (or, with --embedded, a signal) before the request is sent sends nothing and logs cancelled before sending; nothing was sent; after it, it stops the wait, logs it as unconfirmed and prints the line. Without --embedded a signal ends the process at once, so a log can be left with an intent line and no result line.

One narrow race stays. After that last check, Aeron’s own request_driver_termination opens cnc.dat again by path to write the command, and the tool cannot hand it the file it already checked (comparing the file’s device and inode before the write would not help: the swap can come after the last look). If the driver exits and another starts in the same directory in those microseconds, the new one receives the request. It still needs an allowing termination validator to act on it. In a script: use the --confirm token of this run (never a fixed one), keep the directory dedicated to one driver (no supervisor restarting a driver there while the request is in flight), and check afterwards, with ergo-aeron driver, that it is the driver you meant that stopped and no other runs.

The driver decides. Aeron’s default termination validator denies every request. The C driver aeronmd started with AERON_DRIVER_TERMINATION_VALIDATOR=allow runs its termination hook, which stops it; a driver embedded in an application stops only if that application’s hook does. ergo-aeron waits up to --wait MS (default 5000) and says which happened: exit 0 only once the driver has stopped (its cnc.dat gone, its heartbeat cleared by a clean close, or another driver started there); exit 1 when it still runs, when it does not answer (its heartbeat is older than its liveness timeout but its files are still there: it may be paused, so do not start another driver in the same directory), or when its CnC file is there but unreadable.

Health

The line under the status, and the health subcommand, give one verdict:

VerdictWhen
ALARMthe heartbeat is older than the client liveness timeout (driver gone); the last read failed (on the screen: the health subcommand exits 2 with the reason and prints no verdict); or a watched counter rose between the last two reads
WARNa watched counter is non-zero since the driver started or since the mark; the driver’s CnC version, Aeron version or number of system counters differs from the Aeron this tool was built with, so labels may not match; or part of a read failed
OKnone of these

Watched counters, which stay at zero on a healthy driver: sender flow-control limits (back-pressure events), unblocked publications and control commands, client liveness timeouts, invalid packets, short sends, retransmit pool overflow, images rejected, error frames received, the three proxy fail counts, the conductor, sender and receiver cycle-time threshold counts, and an archive’s error count and cycle-time threshold count. When one is flagged, the reasons also list the non-zero maximum cycle times (conductor, sender, receiver, archive) and the archive recorder’s maximum write time.