Liking cljdoc? Tell your friends :D

2026-11-27 — A route an attach took away, and a run asked things after its end

A third review, of the tree the entry before this left. Four findings, none with a test this time: the reviewer staged each between JVMs and described it. The tests here are written from those descriptions.

This entry revises the one before it in one place, said where it comes up: what an attach does to the routes it does not report.

A session that looked ended after a late attach

The entry before this stopped an attach from ending a handle, and left it dropping the routes it did not report, on the reasoning that the next report puts them back. The reviewer held an attach that reported nothing at the gateway until the follower gave it up. A later attachment registered a session, confirmed it in a beat, and went away. While the old attach was still held, a call naming the session was told to wait for the node. Once it was let go, the gateway took it, found nobody at the other end, and the route was gone with no report to follow: the call was told to open a new session, of one that was live and was routed again when the node came back.

An attach now only adds. What it reports is routed and recorded, what it leaves out keeps its route and stays the name's, and a beat is what drops a route and ends a handle. A follower reports as soon as it is welcomed, so on a node that is there the two are a moment apart. In that moment a call naming a session the node's JVM does not hold is carried to the node, which refuses it as any instance refuses a session it has not got.

One test of an earlier entry's changed with it: where another JVM takes a name, the report it makes on being welcomed is now what takes its predecessor's session off the roster.

A run asked things after its end

The entry before this ended a gateway's run before closing its port. Between the two the run has every node attached and answers at its port, and three things were still done on it.

  • A registration was granted, and a beat acted on. The reviewer paused the stop there: a follower's registration was answered 204 and its route installed, and the beat after it changed whose the handle was. Both now ask, under the lock that checks the attachment, whether the run has ended, and are answered 503 with nothing changed. A follower takes that as it takes a gateway that does not say: a session asked for through the gateway fails, one opened directly is made and reported to the gateway that answers next, and a beat refused sends it round to attach again. An answer already under way still finishes.
  • A wait for a node was given the node. A wait for a change failed as stopped, and one for a node, made in the same interval, was settled with the node's line. It is looked for and left waiting under the run's lock now, as a wait for a change is, and fails on a run that has ended.
  • A welcome settled a wait. Held across the end of its run, a welcome told a wait made before it. It tells nobody now, and the stop tells the wait the gateway stopped.

A start undone with the port closed first

A start that fails once its port is open closed the port and then gave the role up. With a node attached and a wait pending by then, the wait was told of the gateway alone. The undoing ends the run first, by the step the stop uses.

The README

It said the gateway keeps no state of its own. It persists nothing; it does keep in memory, for as long as it runs, which ids it has given out and which it has retired, and the README says so.

Shown

The gateway's and the follower's suites, 115 tests and 435 assertions, against each removal alone. The first seven are this round's. The rest are the two entries before's, run again against the source as it is now.

RemovedFailing assertions
An attach dropping no route (it drops those it leaves out)5
A beat settling nothing of a run that has ended3
A registration granted nothing by a run that has ended3
A wait for a node failing on a run that has ended (it is given the node)3
A welcome telling no wait of a run that has ended2
A start undone ending its run before the port closes (the port first)1
A wait for a node looked for and left waiting under the lock1
An attach's sessions read under the follower's lock1
An attach ending no handle (it ends them as a beat does)3
The sessions a JVM holds already given out in the run that starts1
A node and its routes arriving in one step (the routes, then the node)1
A name passing from a silent holder in one step (let go, then admitted)1
A gateway's run ended before its port closes, at a stop1
An attachment listed by an id of its own (by a number counted in the JVM)1
A wait told at once sweeping the waits that are over1
A registration asking who a handle was given to (it asks the routes)8
The gateway's own mint asking what was given out (it asks the routes)1
A report judged by who a handle was given to (by the routes)3
A handle reported without, in a beat, becoming nobody's3
A forgotten node's handles staying its own (they are forgotten with it)3
The gateway's own handle recorded as given out1
A registered handle recorded as given out5
The waits chosen in the step that changes the fleet (on a thread, from a later reading)1
A wait compared and left waiting under the lock1
The run's own clock1
Attachments told apart by their own id (by when they attached)1
Nothing being told of a run that has ended3
The sweep of waits that are over, at a telling and at a wait2

The seventh had no test at first. A wait for a node was not under the lock before this round: it looked, left itself waiting, and looked again. The test written for it holds a wait after its look, lets a node attach and be welcomed, and asks that the wait is settled.

The suite

298 tests and 1,188 assertions, without a failure, in each of three runs.

Between JVMs

A gateway and a follower on loopback, started for this and stopped after it, neither the dev gateway. A client on the stateless wire, with a session on the node opened through the gateway and one on the gateway.

The node's session used, a beat let pass, and the node's JVM suspended. A call naming the session once the gateway had found the node quiettold the node is not attached, last heard 25 s ago, and to try again when it is back
An attach sent by hand under the node's name, reporting no sessions, and hung up after three seconds. The roster while it was heldthe node attached, with one session
The roster once the gateway had found that attach gone, eight seconds onthe node away, with one session
The same call thentold the node is not attached, last heard 10 s ago, and to try again when it is back
The node's JVM resumedattached after 2 s, with one session, and the call answered
The gateway's run ended in its JVM with the port open, and a session opened at the node's own endpointopened, and the gateway's routes and record as they were nine seconds later
A session on the node asked of the gateway thenrefused: the gateway has stopped, and nothing was run
A wait for the node and one for a change, made on the ended run with the node attachedboth failed as stopped, neither cancelled
The follower, at its next beatlet the gateway go, and its attach was refused with 503

The late attach moved "last heard" from 25 s to 10 s: a node's silence is counted from its last attachment, and that was one. The attach was not held at the gateway behind a later one, as the reviewer held it; it was sent late, which the gateway cannot tell from that.

The follower printed that the gateway does not answer before it printed the refusal. It had closed the stream itself, on the beat that was refused, and the read that ended with that is reported as an attach that could not be made. The line is as old as the watch, and is wrong only in what it says.

Not observed

The stop was not held between ending the run and closing the port between JVMs: the run was ended by hand in the gateway's JVM, which leaves the same state. A welcome held across the end of its run, and a start undone once it answers, were staged in the suite only. A registration granted by an ended run, against the source as it was, is the reviewer's observation and the removals above. Nothing was run across a network. The dev gateway was not used, and takes a restart to run this.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close