Liking cljdoc? Tell your friends :D

2026-11-30 — A fleet that sleeps, as a host ran it

A host put the gateway in front of development servers and drove it with Claude Code, on the commit of the entry before this on both sides. This is its report, set down here. None of it was observed from this checkout: where it says what Remontoire did, that is what was seen from outside, by the agent that built the deployment and then used it. What is said here of the source was read in it afterwards.

No defect was found. The trials before this were between JVMs on one machine, or two machines on one local network with sleep and partition simulated. This one had a real suspend, an overlay network, and a client that connected to a server already a gateway.

The rig

  • The gateway in a JVM of its own on a small machine that is always on: a -main that calls init! with :gateway? true and waits, with Clojure and this library alone on its classpath, under a 192 MB heap.
  • A follower in a large application's JVM, on a machine that is hibernated after half an hour unused and woken on demand. It passes :follow and no :name, so it attaches under its hostname, which is what people already called the machine.
  • The network a WireGuard overlay whose policy lets a follower call the gateway's port and nothing the other way. An earlier form ran inside a private network by a private name. Both worked.
  • The client Claude Code, with the gateway as its one configured server.

Never more than one follower was attached.

Seen

Wall-clock from the client, single runs. "Earlier form" is the private network.

The application startedattached by itself under its hostname
A session opened with node, and evals with printed outputanswered as they are directly
An eval of 16 s (earlier form)followed as an MCP task to its end, through the gateway
25 bytes uploaded to the address the session gave, which was the gateway's (earlier form)read back on the node
The follower's machine hibernated with a session open, and a (__r.gw/change seen) waiting in a gateway sessionsettled with the node no longer attached, within 18 s of the sleep being asked for, in both forms
A call to the node's session while it sleptrefused, with the reason and how to wait
The machine wokenattached by itself, 2 s after the wake command returned
A (__r.gw/node "…") made before the wakesettled 49 s after it was made, 58 s in the earlier form: the time the machine took to resume
The session after the resumethe same id answered, with a value defined in it before the suspend
The gateway's process restarted with a node's session openthe session answered through the new gateway 5 s later, 6.5 s in the earlier form
A session of the gateway's own after that restart (earlier form)refused, and the refusal said why
The gateway's process with one follower attached (earlier form)about 100 MB, 96 and 113 by two measures

The client did not reconnect at any point: not across the suspend and resume, and not across the gateway's restart.

The 18 s is an upper bound, counted from the command and not from when the JVM froze. It sits in the ten to twenty seconds §15 expects of noticing. Whether a failed write or the silence ended the attachment was not looked at, nor whether the name was free by the time the machine came back for it or had to be taken from a holder that did not answer.

Right after the gateway's restart the client's first call was refused at the socket, and the next was answered. Whether an answer of "not known here yet" came in between was not recorded.

As the client

create-session advertised node, and the connect-time intro said the server was a gateway, that create-session takes a node, and that (__r.gw/nodes) lists those attached. The agent used the gateway on that and read nothing else first. It had built the deployment and knew the node's name, and the host's :describe gave the naming rule, so this is not a client arriving cold.

The refusal for a sleeping node was acted on as written: a session on the gateway, (__r.gw/node "name"), and the task settled when the machine was back. The agent's own word for the two waits was that they replaced polling.

What the host built around it

  • Its idle check was not disturbed. The host decides when a machine sleeps by asking its application when a session last evaluated. A machine attached and left alone read as idle at the next check, and an eval made through the gateway counted as one made directly. In the source, what a follower reports reads the handles and refreshes no session.
  • One-way reach was enough, since every connection between the two is the follower's.
  • The gateway did not go into a process the host already ran there, because a session without node evaluates in the gateway's JVM for whoever reaches the port, and that process held credentials. It runs sandboxed in a process of its own: a user made for it, and no network but the overlay. The host's suggestion is a gateway that offers the fleet and its waits and evaluates nothing. §15 has it under Open, with how it could be done.
  • Followers reach each other through it. The machines could not reach one another before; each reaches the gateway now, and so a session on any other that is awake. The host accepted that for development machines.
  • Its scripts took the session id out of the answer's sentence with a pattern. create-session answers with it as data from this entry on.

Asked of us

The host's followers are builds of different ages, weeks apart, dialling one gateway that changes rarely, and it had run one case: both at one commit. It asked what a follower on another revision of the wire sees and does, and whether the wire holds across releases.

Read in the source: the gateway answers such an attach 409, naming both revisions, before taking anything from it. The follower prints that once, since it prints when the news changes and not at every attempt, and asks again every second for as long as it runs. Its own endpoint is untouched.

Decided with this entry, and written into §15, the README and the changelog: the revision changes only when what the two say to each other changes so that one would misread the other, the changelog names the release that changes it, and releases with no such change between them attach to each other in either order. A gateway speaks one revision, so a fleet crosses a change together. A gateway speaking several was not built. Between commits that are not releases the number promises nothing, which is why the host holds both sides to one commit for now.

The host also relied on a release from before gateways taking no notice of :follow, having run 0.8.2, and assumed it of 0.10.0. That holds, by reading the tag: its init! merges the options over the defaults, nothing reads the key, and no key is refused. The same reading says a host cannot tell from such an init! that it asked for something it did not get.

Not ours to change, and noted for whoever upgrades across it: 0.10.0 moved the session from a header to an argument, each side refuses the other's way, and a host with scripts of its own had to ship them and the library in one deploy. The changelog of 0.10.0 says what changed.

A gateway built from a commit reports the version of the last release, as its followers do, so the roster does not tell two unreleased builds apart.

Not tried

More than one follower at once. A suspend of hours or days. The gateway's machine replaced by another under the same name. A network that loses packets. Two revisions of the wire meeting. A second machine claiming a sleeping node's name. A client that did not already know the node's name. The upload, the long eval as a task, the idle check and the refusal after a restart were seen in the earlier form only.

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