Repository navigation
fix(swift): carry deferred requests on the connection of the client - #5231
Open
krishvishal wants to merge 4 commits into
Open
krishvishal wants to merge 4 commits into
krishvishal wants to merge 4 commits into
Conversation
krishvishal
changed the base branch from
swift-operation-fixes
to
php-sdk-conformance-fixes
December 3, 2026 17:21
krishvishal
force-pushed
the
swift-multiplexed-connection
branch
from
December 3, 2026 17:24
ffef54e to
b1cfeb7
Compare
spetz
reviewed
Dec 4, 2026
krishvishal
force-pushed
the
swift-multiplexed-connection
branch
from
December 4, 2026 14:54
b1cfeb7 to
6ce67d3
Compare
hubcio
reviewed
Dec 5, 2026
krishvishal
force-pushed
the
swift-multiplexed-connection
branch
from
December 6, 2026 00:37
6ce67d3 to
e62a1f3
Compare
krishvishal
force-pushed
the
swift-multiplexed-connection
branch
from
December 6, 2026 01:35
e62a1f3 to
ac449af
Compare
One connection now carries many requests at once and finds each caller by its request number, so a waiting poll needs no connection of its own.
krishvishal
force-pushed
the
swift-multiplexed-connection
branch
from
December 6, 2026 07:50
ac449af to
d7ea81e
Compare
spetz
approved these changes
Dec 6, 2026
hubcio
approved these changes
Dec 6, 2026
numinnex
approved these changes
Dec 6, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR address?
Closes #5173
This pull request is on top of #5177, and #5177 must merge first.
Rationale
A Swift connection ran one request at a time. The server can hold a deferred poll for minutes, so the client opened one more connection for each poll that waited, up to 64. The other SDKs send a deferred poll on the connection of the client, because one of their connections carries many requests at once. The conformance suite of RFC 3 checks this in
faults/lost_poll_connection.yaml, which is a known divergence of the Swift SDK in #5174.What changed?
TCPConnectionnow carries up to 256 requests at once, as a link of the Rust SDK does (core/sdk/src/links/mux.rs). It keeps the callers that wait in a table by request number, so each reply finds its caller in any order. Deferred polls and fetches go over the connection of the client and overlap with its other requests. In a cluster, all requests to one primary share one data connection. The server does not change: each frame already carries its request number, and the server already runs 256 requests of one connection at once.A request that runs out of time or is cancelled now ends alone, and the connection drops its late reply. Before, it closed the connection. On a shared connection that also ends every poll that waits. The client still notices a server that is gone, by its silence. If nothing arrived since the request was written and no other request waits, the first timeout closes the connection. If a poll waits too, the second timeout in the same silence closes it. If a request without a session ends without a reply, the connection always closes, because request numbers repeat until a session is bound.
For the polls that wait, the shared connection has three rules:
next, it goes again after a lost connection. It then has the rest of its wait, as in the Rust SDK..onReadstill ends withfetch_progress_uncertain(14010), because nothing tells whether the server stored its offset.disconnect()andshutdown()end every waiting poll at once.logout()ends those that commit nothing, because the server drops them without an answer.A client of a single node now dials only the address that it was given, as the Rust SDK does. A single node can advertise an address that does not reach it, such as a bind address or a container name. After a lost connection, the client used the advertised address first, and so went past the fault proxy of the conformance suite.
One thing stays as it is. The ordinary requests of the client still go one after another, because a sign-in, a bind and a teardown must run alone on the connection. The deferred requests do not wait for them.
Tests:
MultiplexingTests: 13 tests of one connection, modelled on the tests ofmux.rs. They cover replies in any order, and one request that ends by a timeout or a cancellation. They also cover a silent server, an eviction, and the limit of 256 requests.DeferredRequestTestshas 15 new tests, on a single node and in a cluster. They cover polls that wait while the connection is lost or detached from its session. They also cover a logout, a disconnect and a shutdown.