Forward to a peer when the local upstream connect fails on a TLS-terminating failover route
Maintainer thường phản hồi trong vòng 1 ngày
@kriszyp đang làm issue này rồi.
Từ ngày 5/11/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- Rust
- Star
- 1
- Fork
- 0
- Merge trung bình
- 19 giờ 12 phút
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của HarperFast/symphony
-
Don't route to a restarted upstream until it serves, not just acceptsCó thể đã có người làm @kriszyp đã nhận 5 ngày trước. Đang mở
HarperFast/symphony#84 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
HarperFast/symphony#80 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Forward a connection to a peer when its local upstream connect failsCó thể đã có người làm @kriszyp đã nhận 5 ngày trước. Đang mở
HarperFast/symphony#79 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
HarperFast/symphony#77 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Spill a share of new connections to a less-loaded peer when local Harper threads are busyCó thể đã có người làm @kriszyp đã nhận 12 ngày trước. Đang mở
HarperFast/symphony#73 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của HarperFast/symphony
Issue tương tự
-
area: cli kind:docs priority: P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
swc-project/swc-ai-issues#164 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
pop-os/cosmic-player#367 ·
-
good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
servo/rust-smallvec#873 ·