Four changes were decided today and built: a run owning its tables, order at admission, a follower saying which requests a write answers, and the welcome in the head of the attach's response. Entries 08, 09 and 10 say what each is and why. This one says only what was observed of each, how, and what was not, for whoever reviews them.
Trees. A is the commit "a gateway run owns its tables". B is the commit after it, "a cancellation does not overtake its request on the way to a node". C is B with both wire trials on it, uncommitted when this was written.
The suite. bb test, on JDK 27.
| Tree | Tests | Assertions | Failures | Runs |
|---|---|---|---|---|
| A | 241 | 949 | 0 | 1 |
| B | 243 | 954 | 0 | 3 |
| C | 246 | 966 | 0 | 3 |
bb warn:reflection is clean on B and C. The touched files pass cljstyle check; the check over the whole
repository was not run again.
Removals. One edit to the source, alone, then the gateway, follower, lifecycle and session test
namespaces (bb test --focus … for each), then the source restored. The count is failing assertions. Every
removal below was run again on tree C, one at a time, and those are the counts given; where a count differs
from an earlier entry it is said. Each is written as the text replaced and what replaced it, so it can be
repeated. One test was tightened after that run, the one of an answer without a welcome in section 4; it was
then run by itself three times and with the whole suite once, and no removal was run against it again.
Live. The dev gateway (bb dev) with this checkout loaded, driven through its own MCP endpoint by the
client of the session doing the work. Scripted followers attach to it over HTTP from inside its JVM; for the
trials a second JVM was started beside it with bb dev:follower. A hold or a fault is a function of the
gateway replaced for the length of one probe and put back.
| Replaced | By | Failing | In test | |
|---|---|---|---|---|
| a | (if-not (:ended? fleet) in route! | (if true | 1 | a-request-for-the-gateway-itself-is-not-served-once-it-has-stopped |
| b | (:ended? @state) :ended in admit! | false :ended | 2 | an-attach-a-gateway-accepted-is-none-of-the-next-ones-business |
| c | (first (reset-vals! waiters {})) in stop! | nil | 2 | a-wait-for-a-node-ends-with-its-gateway |
| d | the (when (:ended? @state) (q/fail p (stopped))) in await-node | nil | 2 | a-wait-made-as-its-gateway-stops-ends-too |
| e | (when (identical? entry (get-in @state [:nodes name])) where a welcome settles waits | (when true | 2 | a-welcome-of-an-attachment-gone-meanwhile-settles-no-wait |
| f | (get-in fleet [:nodes node]) for a call's entry in dispatch! | (get-in @(:state run) [:nodes node]) | 2 | a-request-goes-to-the-attachment-its-handle-was-found-on |
| g | the same for an upload's entry | the same | 2 | a-request-goes-to-the-attachment-its-handle-was-found-on |
| h | the three cond clauses that make a place of (:entry t), of the entry fleet shows for (:node t), and of t | one clause, t (or (:node t) (some-> (:entry t) (->> (node-of run))) t) | 2 | a-batch-is-carried-to-one-attachment |
| i | the beat's (cond (not (attached?)) ::gone (fresh? entry seq) (settle! …)) | (when (and (attached?) (fresh? entry seq)) (settle! …)) | 1 | what-is-said-as-an-attachment-gone-meanwhile-is-not-its-successors |
| j | the registration's (not (attached?)) ::gone clause | (attached?) joined to the next clause's test | 1 | the same |
Removal e failed nothing when first run. The test that had caught it before restarts the gateway, and a welcome of the first run has no way to the second run's waits any more. A test was added that gives the name up within a run, under a held welcome.
On a dev gateway restarted on this tree, five probes. In each a scripted node is replaced by another under its name — hung up, seen gone, another attached reporting no sessions — while something of the first is held in a handler.
| Held | Where | Observed |
|---|---|---|
| A beat reporting a handle | its attachment found, the lock not yet taken | answered 410; no route made, nothing retired, the successor's number unchanged, the successor sent nothing |
| A registration of a handle | the same | answered 410; no route made, the successor sent nothing |
| A call for a session on the node | the attachment chosen, the request not yet queued | refused in the gateway's words, "did not answer"; the successor sent nothing |
| An upload for that session | the same | answered 502; the successor sent nothing |
| An attach contesting the name | waiting on its ping to the holder, which hangs up; a third takes the name | the contender answered 409; the third keeps the name and is sent nothing |
A wait for a node, made in a session on the gateway, settled when a node of that name attached. After the probes the gateway had no node and no route of theirs.
| Replaced | By | Failing | In test | |
|---|---|---|---|---|
| a | (let [admitted (admit event)] in the follower's event! | (let [admitted nil] | 3 | a-cancellation-finds-the-request-that-arrived-before-it |
| b | (mcp/with-admission (merge admitted {:peer peer :connection cid}) payload in the transport | the same without (merge admitted …) | 3 | the same |
| c | (locking (:queue entry) around the two steps in the gateway's forward! | (do | 1 | a-cancellation-is-queued-behind-the-request-it-names |
| d | (some-> admitted mcp/dismiss) in the finally of the follower's serve! | nil | 1 | a-cancellation-finds-the-request-that-arrived-before-it |
Entry 09 first gave 1 for a and b. That was counted before two assertions were added to the test for the sake of d, and was corrected there.
| Replaced | By | Failing | In test | |
|---|---|---|---|---|
| a | (when (HttpExchange/.getAttribute exchange tunnelled-attribute) in the transport's announce! | (when false | 5 | a-part-names-the-responses-it-carries, a-result-whose-acknowledgement-was-lost-stays-unread |
| b | (seq ids) (assoc "X-Answers" …) where the follower sends a part | false (assoc "X-Answers" …) | 5 | the same two |
| c | (swap! answered into (answers-in headers)) in the gateway's handle-answer! | nil | 2 | a-stream-that-gave-its-response-is-not-given-a-refusal |
A result flushed to the client, and the gateway's acknowledgement of that part lost on its way to the follower.
In the suite, by halves, since a gateway and a follower are never one process:
Between two JVMs, once. The gateway's function that answers a follower was replaced so that the first part naming a response was answered 500 after it had been written to the client, and the function that composes the gateway's own refusals so that its calls were recorded. One eval was then sent to a session on the node.
| Looked at | Observed |
|---|---|
| The client | the eval's value, once |
| The part answered 500 | named one request, [12] |
| The gateway's refusals | none composed |
| The gateway's requests in flight, 1.5 s later | none |
| The node | attached still |
| The entry, on the node | owed to its session, status done, untouched |
| The entry of the eval before it, acknowledged | touched |
| The next answer from that session | carried the note that the entry had settled |
X-Answers that is not a list, which the gateway is written to ignore.A plain JSON answer names nothing, by design: what a stream has answered is consulted only for a stream.
| Replaced | By | Failing | In test | |
|---|---|---|---|---|
| a | (Headers/.set "X-Welcome" in the gateway's handle-attach! | (Headers/.set "X-Unwelcome" | 31, and 1 error | ten of the gateway's tests |
| b | (when-not (= fleet/wire wire) in the follower's welcome! | (when false | 2 | a-welcome-in-another-wire-is-not-an-attachment |
| c | (when-not (and (string? attachment) (not (str/blank? attachment))) there | (when false | 2 | a-welcome-that-names-no-attachment-is-not-acted-on |
| d | (when-not @stopped ahead of (welcome! node welcome) | (when true | 1 | a-follower-that-stops-as-its-attach-is-answered-takes-no-welcome |
Removal d failed nothing when first run. The test of a welcome arriving late is of an attach cancelled before it is answered, which never reaches the guard. A test was added that stops the follower with the answer in hand and its welcome read.
HttpServer handler set a header, sent the response's head as a
chunked 200, waited 1.5 s and wrote its first bytes of body. A JDK HttpClient asking for the body as a
stream had the response 1653 ms after sending the request. One run, on JDK 27, both ends in one JVM.A follower started beside the dev gateway attached; the roster listed it with its version. On the node, the cadence the follower keeps read 5000 ms, which is the gateway's; the one it is written to keep while not attached is 1000 ms. A session opened on the node through the gateway served evals. With the follower's JVM stopped, the roster listed the node as not attached when looked at six seconds later.
X-Welcome and puts
it at the head of the queue of events it hands a test, as an event of type welcome. Twenty-six places that
take the welcome off that queue are unchanged for it, and none of them reads it off the stream.The trial recorded between two machines was of a build before today's changes, and nothing here was run across a network. All of it is one machine, one JDK, and in the suite one process playing the other side of the wire by hand.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |