A fifth review, of 0d329cf. Seven findings, staged by the reviewer between JVMs on loopback, with tests for
each. The reviewer's fixes did not reach this checkout: its tests, and its changes to §15 and the changelog,
did. All seven are taken. The fixes here are written against those tests, and two differ from what the
reviewer described. What the reviewer saw between JVMs is the reviewer's report, and was not repeated from
this checkout.
A JVM that takes a name can register before its first beat has said which of its predecessor's sessions ended. If it drew one of their handles then, the gateway granted it: a handle given out under a name was that name's to ask for again. A client still holding the handle would have reached the new session.
The chance is small. A JVM never draws a handle of its own twice, so it takes another JVM under the name, drawing one handle out of some three million, before a report it makes as soon as it is welcomed. But what a run holds to is that a handle names one session, and the gateway is the only one that remembers the predecessor's.
The reviewer kept the exception for the attachment a registration was granted to, and recorded which that was. It is dropped here instead: a registration is for a handle the run has not seen, whoever asks. Nothing asks twice. A node numbers what it says, so the same message arriving again was refused already, and a node whose registration went unanswered draws another handle or takes this one and reports it.
A task's id begins with its session's handle, and a task method is routed by it. Once a node said the
session had ended, the route was gone, and the method was looked up in the gateway's own registry: Task not found, of a task the node still had and would answer for when asked directly. An instance alone
answers for a task after its session has expired, for as long as the entry is kept.
The record kept the name a handle was given out under until its session ended, and nothing after. It keeps the name now, and which handles have ended beside it. A task method goes to the node of that name, attached or not, and that node's registry says what became of the task. A retired handle is refused for its tasks as before. The record is the run's, so after a gateway restart a task of a session that had ended is not found.
A session expires after a day without a call, and a poll of its task is a call. So this takes a task left alone for a day.
The entry before this gave up an answer closed before it had a status. The reviewer failed a handler later: after a status and a length with no byte written, after a write of no bytes, and after an event stream was open. The client got a connection closed short in the first two, and a stream that ended with nothing but its opening comment in the third.
No handler here fails at those points without a fault of its own, and an instance reached directly leaves its client the same way when one does. Three small things make a node's exchange behave as the JDK's does there, and one lets the gateway say what it already knows:
create-session with a node that was not a string opened a session on the gateway and named the gateway
in its answer. Asked of a node directly with another node's name, it opened one on the node asked. The
handler now refuses a node that is not the name of the instance the request reached, on a gateway, a node
or an instance alone, and opens nothing. A gateway still carries the request to the node it names, where
the name is the node's own.
An instance alone ignored the argument before, so this changes what a released version did, and the changelog says so.
The gateway looks for the request a cancellation names by connection and id. A stateless call has no connection, but one that carried the header was recorded under it, and with the id of a legacy call in flight on that connection it made the notice name two requests. Nothing was cancelled. Only a legacy request is recorded by its connection now.
What a client said at its handshake rides to the node with the session's creation. The gateway wrote it with the JSON library's default, which writes a keyword by its name alone, so two keys that differed only in what came before the slash arrived as one. It is written as the transport writes everything else.
A gateway stopped and started again in the same JVM as an instance alone left __r.gw in the scratch
namespaces of sessions that survived, where it listed a gateway that was not there. Furnishing a scratch
outside the role now takes the alias away, unless it has become the caller's own for something else.
The whole suite, 312 tests and 1,246 assertions, against each removal alone. The tests are the reviewer's, with two changed where the registration rule differs and one added, for an instance alone asked for a session on a node.
| removed | failures | test |
|---|---|---|
| refusing a registration under the asker's own name | 5 | a-handle-is-not-given-out-again-under-the-name-it-had, a-registration-is-for-a-handle-nobody-has-had |
| counting an ended handle as held when reported again | 2 | a-handle-is-not-given-out-again-under-the-name-it-had, an-attach-taken-late-ends-no-session |
| carrying a task method to the node of the handle's name | 4 | a-task-returned-through-the-gateway-remains-reachable-after-session-expiry |
| giving up a reply closed short of its length | 2 | a-handler-that-fails-after-setting-a-status-still-answers-its-client |
| sending nothing for a write of no bytes | 1 | the same |
| the gateway's last message on a stream ended owing | 1 | the same |
| refusing a second status | 1 | a-dispatch-error-cannot-replace-an-open-stream-with-another-response |
refusing a node that names another instance | 4 | an-invalid-destination-opens-no-session-on-the-gateway, a-node-asked-directly-for-a-session-elsewhere-refuses |
| recording only legacy requests by connection | 1 | a-stateless-call-cannot-hide-a-legacy-call-from-its-cancellation |
| writing the envelope as the transport writes JSON | 1 | a-legacy-clients-handshake-rides-along-with-its-session |
| taking the alias from a scratch outside the role | 1 | a-surviving-scratch-loses-its-gateway-alias-when-the-role-ends |
The removals were run before the added test, against 311 tests. Removing the refusal of a node fails that
one too.
Not shown: anything between two JVMs from this checkout.
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 |