You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
proxy SIGBUS (use-after-free) in QuicConnection::OnCanWrite when CDS removes a QUIC twin cluster with a live client connection (proving soak w01, 03:25:59Z) #1074
main-worker-01, #1073 burst 2 (one fetch window after the TRIPLE's agent roll):
03:25:59.398Z agent: pruned persisted east-west QUIC pairs with no on-demand fetch since agent start count=10
03:25:59.586 Envoy: cds: ... 10 removed cluster(s) — the twins were removed while k6/prober traffic was still on them
03:25:59.646 Envoy: Caught Bus error, suspect faulting address 0x6f72702f747365 (the address bytes read "est/pro" in ASCII — a freed object whose memory now holds string data → use-after-free)
Supervisor: envoy epoch 96 exited unexpectedly: signal: bus error; aether-proxy-9rghc proxy container exit 1 at 03:26:00, restarted 03:26:01 (restartCount 1)
Impact: ~10 s node outage on w01 — prober 51 × liveness connection refused (03:26:00–:10) + 99 mesh_dns timeouts + 4 conn_err; AetherProberLivenessErrors fired 03:32:55–03:37:55Z; k6 on w01 stalled (534 iterations dropped). This is the soak's only crash (fleet-wide Caught|exited unexpectedly returns only these lines). #1073 burst 1 (23:37Z, same prune on all nodes) did not crash → intermittent.
Reading: removing an upstream QUIC cluster while one of its client connections has a pending write (a file event already injected/queued) frees the connection or its writer, and the queued onFileEvent then runs OnCanWrite on freed memory. Fixing #1073 (don't prune live twins) removes this trigger, but the crash is an Envoy lifetime bug in its own right — any legitimate removal of a QUIC cluster under load (demand-set shrink, destination leaving the dependency set, the 1 h prune of a truly idle pair that just got a request) can hit it.
Ask: reproduce on kind (CDS-remove a quic: twin cluster while an h3 client connection on it is mid-write under load; ASan build of the proxy if feasible), then fix — likely deferred deletion of the client connection / cancelling its injected write event on cluster teardown. Upstream shape for the owner; a carried patch in the meantime. Full crash log: session scratchpad w01-proxy-prev.log. Related: #1073, #1067 carried patches, #979.
Root cause (envoy session; confirmed by symbolizing the crashed a1bcf05 binary)
Fault site:quic::QuicConnection::OnCanWrite+0x154 is the return address of bl QuicConnection::CanWrite(HasRetransmittableData); the fault is clock_->Now() at the end of CanWrite (quic_connection.cc ~3491), the first clock read on that path. The writer call at the top of OnCanWrite worked because the writer is owned by the connection; the clock is not.
Ownership bug (upstream Envoy since #19862, 2022-03): the clock lives in Quic::PersistentQuicInfoImpl (conn_helper_ with EnvoyQuicClock, alarm factory, quic config, crypto stream factory, writer factory), which is a unique_ptr MEMBER of the worker's thread-local ClusterEntry (cluster_manager_impl.h:719 quic_info_). Http3ConnPoolImpl holds it by reference (conn_pool.h:200) and every upstream QUIC connection holds raw pointers into it (QuicConnection::clock_, each EnvoyQuicAlarm's clock).
Sequence on a CDS removal: worker TLS update → thread_local_clusters_.erase(name) (cluster_manager_impl.cc:899) → ~ClusterEntry (:2135) → drainConnPools() → drainOrCloseConnPools(host, DrainAndDelete): pools with in-flight streams keep their busy clients → ~ClusterEntry then destroys quic_info_ → the pools live on in host_http_conn_pool_map_ with connections pointing into freed memory → the next write-ready event (our stack) or alarm dereferences the clock. Needs streams in flight at removal, hence intermittent; the w01 access log shows 71–74 rps on the removed twins right up to the removal.
Fix: make the info shared — PersistentQuicInfoPtr becomes a shared_ptr; Http3ConnPoolImpl and ConnectivityGrid hold a shared_ptr instead of a reference, so it outlives every pool using it (connections are torn down before their pool, so their raw pointers stay valid). No behaviour change on the healthy path. Test: the http3 conn_pool_test drops the creator's ownership of the info and then creates a client connection — UAF under ASan before, clean after. To be carried as envoy-aether1074 on proxy/1074-quic-client-teardown-uaf pending the owner's go; upstream bug-fix PR on the owner's word.
Mitigation in place:#1073 (PR #1076) stops the agent from removing live twins; this also protects HTTP/3 clusters from the other CDS removal paths only to the extent they don't remove clusters with streams in flight — the carried patch is the real fix.
Closing: fixed by the carried patch envoy-aether1074-quic-persistent-info-lifetime (#1077) and proven on talos — 0 Envoy crashes across the 2026-09-30 re-soak (6 hot restarts per node) and the 2026-10-01 soak (30 handoffs, twin removals included). The upstream fix is envoyproxy/envoy#47893 (open); dropping the carried patch once it merges is tracked in #980.
Activity
bpalermo commentedon Sep 30, 2026
Root cause (envoy session; confirmed by symbolizing the crashed a1bcf05 binary)
Fault site:
quic::QuicConnection::OnCanWrite+0x154is the return address ofbl QuicConnection::CanWrite(HasRetransmittableData); the fault isclock_->Now()at the end ofCanWrite(quic_connection.cc ~3491), the first clock read on that path. The writer call at the top ofOnCanWriteworked because the writer is owned by the connection; the clock is not.Ownership bug (upstream Envoy since #19862, 2022-03): the clock lives in
Quic::PersistentQuicInfoImpl(conn_helper_withEnvoyQuicClock, alarm factory, quic config, crypto stream factory, writer factory), which is aunique_ptrMEMBER of the worker's thread-localClusterEntry(cluster_manager_impl.h:719quic_info_).Http3ConnPoolImplholds it by reference (conn_pool.h:200) and every upstream QUIC connection holds raw pointers into it (QuicConnection::clock_, eachEnvoyQuicAlarm's clock).Sequence on a CDS removal: worker TLS update →
thread_local_clusters_.erase(name)(cluster_manager_impl.cc:899) →~ClusterEntry(:2135) →drainConnPools()→drainOrCloseConnPools(host, DrainAndDelete): pools with in-flight streams keep their busy clients →~ClusterEntrythen destroysquic_info_→ the pools live on inhost_http_conn_pool_map_with connections pointing into freed memory → the next write-ready event (our stack) or alarm dereferences the clock. Needs streams in flight at removal, hence intermittent; the w01 access log shows 71–74 rps on the removed twins right up to the removal.Fix: make the info shared —
PersistentQuicInfoPtrbecomes ashared_ptr;Http3ConnPoolImplandConnectivityGridhold ashared_ptrinstead of a reference, so it outlives every pool using it (connections are torn down before their pool, so their raw pointers stay valid). No behaviour change on the healthy path. Test: the http3conn_pool_testdrops the creator's ownership of the info and then creates a client connection — UAF under ASan before, clean after. To be carried asenvoy-aether1074onproxy/1074-quic-client-teardown-uafpending the owner's go; upstream bug-fix PR on the owner's word.Mitigation in place: #1073 (PR #1076) stops the agent from removing live twins; this also protects HTTP/3 clusters from the other CDS removal paths only to the extent they don't remove clusters with streams in flight — the carried patch is the real fix.
fix(quic): the fetch-window prune never removes a twin a live stream …
proxy: carried patch — HTTP/3 pools keep the persistent QUIC info ali…
docs: record the 2026-09-30 re-soak verdict for the unconditional-QUI…
docs: refresh after the QUIC/hot-restart work — rollback advice, carr…
bpalermo commentedon Oct 1, 2026
Closing: fixed by the carried patch
envoy-aether1074-quic-persistent-info-lifetime(#1077) and proven on talos — 0 Envoy crashes across the 2026-09-30 re-soak (6 hot restarts per node) and the 2026-10-01 soak (30 handoffs, twin removals included). The upstream fix is envoyproxy/envoy#47893 (open); dropping the carried patch once it merges is tracked in #980.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr