Reconnecting to a live project runtime¶
A project runtime keeps running while the node that supervises it restarts or loses its connection. A reconnect follows a fixed sequence that ends with the return lane resuming where it left off.
This page covers the sequence, the ownership the node has to prove first, and what a refusal means.
Ownership is proved before anything is planned¶
A reconnect plan is produced only for a session the node still owns. Four conditions are checked against the recorded session:
| Refusal | Condition |
|---|---|
runtime_session_not_found |
The node holds no session for that runtime instance |
runtime_session_non_owner |
The session names a different owner node |
runtime_session_stale_lease |
The lease identifier differs from the session's |
runtime_session_stale_fence |
The fence epoch differs from the session's |
A session requires a complete grant to exist at all: an owner node identifier, a lease identifier and a fence epoch of at least one. A partial answer from the control plane produces no session to reconnect with.
The sequence¶
flowchart TB
subgraph NODE["DATA PLANE NODE"]
direction TB
SES[("Session table<br/>owner, lease, fence epoch")]
PLAN{{"Reconnect plan"}}
CUR[("Return cursor<br/>last acknowledged sequence")]
end
subgraph K8S["KUBERNETES"]
direction TB
SVC["Service and EndpointSlice"]
end
subgraph RT["PROJECT RUNTIME"]
direction LR
KA["Kernel endpoint, not ready"]
KB["Kernel endpoint, ready"]
end
SES -->|"ownership proved"| PLAN
PLAN -->|"1. re-resolve endpoints"| SVC
SVC -.->|"skipped"| KA
SVC -->|"2 and 3. ready endpoint selected<br/>under bounded backoff"| KB
PLAN -->|"4. handshake with the same<br/>identity and fence epoch"| KB
CUR -->|"5. resume the return lane"| KB
The plan is built only from Session table, so a node that cannot prove
ownership never reaches Service and EndpointSlice. Steps 1 to 3 replace the
address that stopped answering with a ready endpoint. Step 4 presents the
session the node already held, and step 5 resumes the lane from Return cursor.
The plan carries the route and the previous endpoint alongside the sequence, so the endpoint that failed is recorded with the reconnect that replaced it:
{
"contract_version": "kernel.grpc_client.reconnect_plan.v1",
"runtime_instance_id": "ri-41f0...",
"owner_dp_node_id": "dp-9c2a...",
"lease_id": "lse-77b1...",
"fence_epoch": 4, "reason": "transport_disconnect",
"sequence": [
"re_resolve_service_endpoints",
"bounded_backoff_retry",
"rehash_select_ready_endpoint",
"rehandshake_with_same_identity_and_fence",
"resume_return_lane_from_last_ack"
],
"from_seq": 4190
}
reason defaults to transport_disconnect. from_seq is the position the lane
resumes from.
After a process restart the node starts a new session¶
A restart takes a different path from a reconnect. The session table belongs to the process, so a new process has nothing to plan against and no ownership to prove. It receives its runtimes again through deployment reconciliation, with ownership and route from the control plane, records each as a session, and handshakes as a first connection.
| Situation | Path |
|---|---|
| A dropped stream inside one process | The reconnect plan, resuming from the last acknowledged sequence |
| A node process restart | Deployment reconciliation, then a first handshake per runtime |
| Ownership moved to another node | The new owner reconciles and handshakes at the raised fence epoch |
See Runtime handle lifecycle across restarts.
A refusal ends the attempt¶
A stale_fence or non-owner answer is the same on every attempt, and after a
handover the runtime belongs to another node. A refusal therefore stops the reconnect as well as the request. Transport
failures retry under bounded backoff; refusals do not.
Related¶
- Re-handshake for what the handshake establishes.
- Readiness handshake and endpoint re-resolution for the handshake itself.
- Recovering the DP to kernel link for the link's recovery as a whole.