Liking cljdoc? Tell your friends :D

2026-11-27 — A handle given out twice, and waits told late

A review of the gateway with the wait for a change on it, the entry before this. Five findings, and for each a test the reviewer wrote to fail. Against the source as it was they failed nine assertions in each of three runs. A run before those failed a tenth, in a test from the entry before this, of a wait ending with its gateway. It had passed in every run until the reviewer's tests stood beside it, and why it failed that once was not found; the telling it ran against is replaced below.

A handle given out twice

A route ended with its session. When a node reported without a handle, nothing the gateway consulted for the next claim held it any more, and the next instance to draw it was granted it. A client that still had the handle saved then named a session on another machine, with every JVM up throughout.

A run now keeps every handle it has seen given out, with the name it was given out under: its own, those registered, and those first heard of in a report. A handle its node reports without is nobody's from then on. A registration for it is refused, the gateway's own minter redraws, and a report of it from another node is answered with a retirement.

Two things were weighed on the way.

  • An id for the JVM beneath the name. A follower would say which JVM it is with each attach, and a handle would be that JVM's. It tells a machine back from sleep from another started under its name, which a name cannot. §15 decided there is nothing beneath the name, and the record by name leaves one case open that the id would close: another JVM under a name whose routes still stand, reporting a handle of its predecessor's that it drew while detached, is taken for the predecessor. The id was not built.
  • What a forgotten node keeps. A node away for longer than a session survives silence loses its routes. It may have been used through its own endpoint all the while and come back with its sessions live. So its handles stay under its name: back with one, it is routed to again. Were they nobody's, it would be told to drop a session somebody is using; were they forgotten, anyone could draw them.

Waits told from a later reading

The watch on a run's state started a thread, and the thread read the state again and took whichever waits there were by then. The reviewer held one such thread after its reading, attached a second node, made two waits, and both were given the fleet from before the second node. Held the other way, a wait made before a node attached and left again was still waiting when both tellings had finished.

Which waits a change tells is now decided in the step that makes it. The state is only ever changed holding the run's lock, and the watch runs there: it takes the waits that saw another fleet than the one just made and hands them, with that fleet's roster, to a thread that settles them. A wait compares and is left waiting under the same lock.

The manual said that nothing between a look and a wait is missed. A roster shows a change that still stands. A node that came and went in between, with no session opened on it, leaves the fleet as it was seen, and the manual now says so.

A node forgotten only when another attached

Nodes past their time were looked for when a node attached, and at no other time. With the expiry shortened, the reviewer saw a departed node stay listed on an idle gateway, and a wait for the fleet to change stay waiting, until an attach that was itself refused removed the row.

A run now looks once a beat, on a thread of its own that ends with the run. The look at an attach is gone.

Two attachments in one reading of the clock

A wait told a name that had been attached again from the attachment before it by when each attached, to the millisecond. With the clock held, two attachments under one name had the same time, and a wait given the first roster waited for a change that had happened.

Attachments are numbered as they arrive, across the JVM's runs, and a roster row carries the number as :attachment. The wait compares that. :since stays, for reading.

A test that could fail on time alone

A test from the entry before this compared two whole rosters, with the seconds since each node was heard from. The reviewer delayed the second reading by a little over a second and it failed on that field. It compares who is listed and whether each is attached.

Shown

The gateway's suite, 54 tests and 223 assertions, against each removal alone.

RemovedFailing assertions
A registration asking who a handle was given to (it asks the routes)7
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)2
A handle reported without becoming nobody's2
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 out4
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 number (by when they attached)1
Nothing being told of a run that has ended1
The sweep of waits that are over1

Two failed nothing at first.

  • The eighth, as first removed, took the lock on its thread, which is what the reviewer's test looks for before it holds a telling back. Removed as the earlier source had it, the reading made on the thread, it fails the test of a node that attaches and leaves.
  • The ninth failed nothing because nothing asked what became of the wait that was compared while the fleet changed. Without the lock it is left waiting on a fleet that has already changed. The reviewer's test of an earlier reading now asks, and the removal fails it.

The suite was then run three times unchanged, without a failure.

The suite

284 tests and 1,125 assertions, without a failure.

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 gateway.

A session opened on the node, the node's JVM stopped, another started under its name. A mint there made to draw the first session's handle firstanother handle, at the second draw
The same draw forced in the gateway's own JVManother handle, at the second draw
The first session's handle named in a call through the gateway, before and after thoserefused as not live
A listing kept, the node's JVM replaced under its name, a wait given the listingtold at once, the node listed with attachment 3 where the listing had 2
A wait given the fleet just listedstill waiting after 3 s
Expiry set to 30 s in the trial gateway. A node with one session stopped, a wait given the fleet that lists it away, last heard 17 s before, and nothing attachingtold after 12.3 s, the gateway alone listed

Not observed

The forced draws were not made between JVMs against the source as it was: that the handle was granted there is the reviewer's observation and the removals above. Expiry at its real length, a day, was not waited out. A node that came and went under a pending wait, and two attachments within a millisecond, were staged in the suite only. A node forgotten and then back with its sessions was not staged between JVMs. Nothing was run across a network. The dev gateway was not used: a run has a table more than it had, so it takes a restart.

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