Forward to a peer when the local upstream connect fails on a TLS-terminating failover route
メンテナーはふだん 1 日以内に返信
@kriszyp がすでに取り組んでいます。
2026年11月5日 から。
評価
この issue はまだ評価されていません。
説明
On a TLS-terminating route with peer failover, the first connections after the local upstream stops are still dropped. Forward a connection to a peer when its local upstream connect fails (#79), fixed by #81, covers only passthrough routes. That was meant to be every Fabric route, but it isn't.
Observed (symphony 1.6.0, two-node Fabric stage cluster, Harper 5.3.5)
On Harper versions with per-thread Unix sockets, host-manager configures every failover route (443, 9925, 9926, 8883) as terminateTls: true with a uds upstream. Passthrough is used only for TCP upstreams (older Harper versions).
The local Harper container was stopped, and 2 s later a TLS connection went to 9926. It was dropped after 6 ms, counted as upstream_connect, with no forward to the peer. The connections after it were forwarded, because that failure had marked the slot refusing.
symphony 1.7.1 behaves the same on these routes: #81's forward runs only in the passthrough branch of handle (src/proxy_conn.rs).
Cause
A TLS-terminating route completes the client handshake (tls_accept) before proxy_via_tls connects upstream. Once the handshake has consumed the ClientHello, the connection can no longer be replayed raw to a peer's failoverIngress. failover::decide() runs before the handshake but forwards only a route already marked down.
Proposed change
On a TLS-terminating failover route, on a client listener, not suspended: connect upstream before the TLS handshake. If the connect fails, forward the untouched hello with forward_to_peers (ForwardMode::Down) exactly as #81 does for passthrough. If it succeeds, hand the connected upstream to proxy_via_tls after the handshake. A Unix-socket connect costs well under 1 ms, so the extra latency is negligible.
The open design question is h1 vs h2. proxy_via_tls picks destination or destination_h2 from the ALPN the handshake negotiates, which isn't known before the handshake. Options:
- Predict the negotiated protocol from the ClientHello's ALPN offer and the route's
ServerConfigALPN list (rustls picks by server preference), then connect to that destination. If the handshake negotiates something else, connect the other destination afterward, as today. - Probe both destinations with a connect-and-close before the handshake, then connect for real afterward. Simpler, but adds an extra accept and close on Harper for every connection.
- Connect the h1 destination first and keep it only when h1 is negotiated.
Prefer option 1 unless the investigation shows a problem with it.
Constraints:
- Keep the per-connection future within its 4 KiB budget (
the_per_connection_future_stays_within_budget). AnUpstreamStreamheld across the handshake may need boxing. - Reuse #81's budget handling: a local connect capped at half of
hs_timeout, and peers get the remainder. upstream_connectaccounting stays the same as #81.
Tests
- TLS-terminating route with a peer, local UDS refusing and not yet marked down: the first connection is served by the peer. This test fails on 1.7.1.
- Same with a stale socket file (no listener) and with a missing socket file.
- An h2-offering client on a route with
destination_h2: the correct destination is used. - All peers refuse: the client is closed, and
upstream_connectis counted. - Ingress listener and suspended routes: unchanged.
Found during Fabric stage failover testing. — Claude Opus 5.5, drafted with Kris
- 主要言語
- Rust
- スター
- 1
- フォーク
- 0
- 平均マージ
- 19時間 12分
- マージ済み PR(30日)
- 13
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
HarperFast/symphony のほかの issue
-
Don't route to a restarted upstream until it serves, not just accepts対応中かも @kriszyp が 5 日前に担当しました。 オープン
HarperFast/symphony#84 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
HarperFast/symphony#80 ·
メンテナーはふだん 1 日以内に返信
-
Forward a connection to a peer when its local upstream connect fails対応中かも @kriszyp が 5 日前に担当しました。 オープン
HarperFast/symphony#79 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
HarperFast/symphony#77 ·
メンテナーはふだん 1 日以内に返信
-
Spill a share of new connections to a less-loaded peer when local Harper threads are busy対応中かも @kriszyp が 12 日前に担当しました。 オープン
HarperFast/symphony#73 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
HarperFast/symphony の issue をすべて見る
似ている issue
-
area: cli kind:docs priority: P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
swc-project/swc-ai-issues#164 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
pop-os/cosmic-player#367 ·
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
servo/rust-smallvec#873 ·