Repository navigation
fix(proxy): a hot-restart successor waits for CDS+LDS instead of going LIVE empty and draining the parent (#1085) - #1091
Merged
Conversation
…g LIVE empty and draining the parent (#1085) A successor Envoy forked while the node agent (the xDS server) was down timed out its initial CDS fetch at +15 s and its initial LDS fetch at +30 s, logged "all dependencies initialized. starting workers" with ZERO listeners, and the parent logged "closing and draining listeners" 2 ms later: 127.0.0.1:18081 refused connections until ADS reconnect backoff delivered the listeners. The parent was healthy the whole time. Envoy facts (pinned 726d7acb73934085cbbccc83ea47fdd78b583d7e; the carried patches do not touch these sites -- aether1050 only adds allow_failure to the drain RPC): - The parent drain and the --parent-shutdown-time-s timer both start at INIT COMPLETE, not at the fork: source/server/server.cc:962-979 (startWorkers completion calls restarter_.drainParentListeners() then drain_manager_->startParentShutdownSequence()), reached only via RunHelper's post-init callback (server.cc:1086-1091, cm.setInitializedCb -> init_manager.initialize at server.cc:1063-1079). The timer itself is armed in drain_manager_impl.cc:217-232. The parent's --drain-time-s starts when it processes the DrainListeners RPC (hot_restarting_parent.cc:124-125 -> 261-265 -> server.cc:158-159 "closing and draining listeners"), which the child sends from hot_restarting_child.cc:168-180. - A timed-out initial fetch completes init as if it had succeeded: grpc_subscription_impl.cc:127-131 (FetchTimedout -> callbacks) -> cds_api_impl.cc:120-126 and listener_manager/lds_api.cc:152-158 ("allow server startup to continue"). - initial_fetch_timeout 0 means no timer: grpc_subscription_impl.cc:33-38 only creates it for count() > 0; the default is 15 s (common/config/utility.cc:208; config_source.proto:260-267 "0 means no timeout"). A stream failure never completes init: ConnectionFailure only bumps update_failure (grpc_subscription_impl.cc:121-124; the delta mux reports establishment failures as ConnectionFailure, delta_subscription_state.cc:286-289), and CDS/LDS assert they never see it. So `initial_fetch_timeout: 0s` on the bootstrap cds_config/lds_config is the whole Envoy-side fix: the successor stays INITIALIZING until CDS then LDS arrive, the parent keeps serving, and the drain + parent-shutdown timers start only once the successor really has listeners. EDS/RDS/SDS keep their timeouts on purpose: they are agent-generated per-resource sources, where a fetch that never ends would pin a cluster/listener in warming at runtime (#817, #1008), and they only matter once the agent is answering. A first start (epoch 0) with the agent late now waits instead of going LIVE with zero listeners at +30 s; the pod was not usefully Ready before either, and epoch 0 is outside the handoff watchdog. The agent's g-c-p snapshot cache answers a wildcard subscription's first request even when empty (pkg/cache/v3/simple.go:605), so init cannot hang against a live agent. Supervisor: the handoff watchdog (2 m) counted from the fork alone, so an agent outage longer than that would now have SIGTERMed an in-pod parent that is serving the node. It now runs from the later of the fork and the successor's last admin answer at ITS OWN epoch: a successor waiting on xDS answers PRE_INITIALIZING/INITIALIZING on every tick and is never declared wedged; the 2026-06-10 wedge (main thread blocked in a hot-restart RPC, admin never accepting) still fires HandoffDeadline after the last answer. A successor held past the deadline is logged once per epoch. Tests: //charts/aether:aether_proxy_bootstrap_cds_lds_wait_test pins both fields (red against main's configmap); handoffinit_test.go covers the init-aware watchdog on a fake clock and through the real Run loop (all four red against main's coordination.go). Closes #1085 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This was referenced Sep 30, 2026
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.
Closes #1085
What broke
On w05 during the 2026-09-30 re-soak, a hot-restart successor was forked while the node agent (the xDS server, over
/run/aether/xds.sock) was down. The successor's initial CDS fetch timed out at +15 s and its initial LDS fetch at +30 s. It then loggedall dependencies initialized. starting workerswith zero listeners, and the parent loggedclosing and draining listeners2 ms later.127.0.0.1:18081refused connections until ADS reconnect backoff finally delivered the listeners. The parent was healthy the whole time.Envoy facts (pinned
726d7acb73934085cbbccc83ea47fdd78b583d7e)The carried patches do not change any of these sites.
aether1050only addsallow_failureto the drain RPC.startWorkerscompletion callsrestarter_.drainParentListeners()and thendrain_manager_->startParentShutdownSequence().startWorkersis reached only through RunHelper's post-init callback (cm.setInitializedCb→init_manager.initialize).source/server/server.cc:962-979,:1063-1079,:1086-1091--parent-shutdown-time-sstart?source/server/drain_manager_impl.cc:217-232--drain-time-sstart?DrainListenersRPC, which logsclosing and draining listeners.hot_restarting_child.cc:168-180→hot_restarting_parent.cc:124-125, 261-265→server.cc:158-159FetchTimedout→callbacks_.onConfigUpdateFailed→ CDSrunInitializeCallbackIfAny()/ LDSinit_target_.ready(). The code comment says "allow server startup to continue".extensions/config_subscription/grpc/grpc_subscription_impl.cc:127-131,common/upstream/cds_api_impl.cc:120-126,common/listener_manager/lds_api.cc:152-158initial_fetch_timeout: 0do?if (init_fetch_timeout_.count() > 0)), so init blocks until the resource arrives. The default is 15 s. The proto says "0 means no timeout".grpc_subscription_impl.cc:33-38,common/config/utility.cc:208,api/envoy/config/core/v3/config_source.proto:260-267ConnectionFailureonly bumpsupdate_failure. Delta-mux establishment failures are reported asConnectionFailure, and CDS and LDS bothASSERTthey never see it.grpc_subscription_impl.cc:121-124,delta_subscription_state.cc:286-289Setting
initial_fetch_timeout: 0son the bootstrapcds_configandlds_configis therefore enough on the Envoy side. The successor staysPRE_INITIALIZING/INITIALIZINGuntil CDS and then LDS arrive, and the parent drain and parent-shutdown timers are not armed until it really has listeners.Changes
charts/aether/templates/agent-proxy-configmap.yaml: addsinitial_fetch_timeout: 0soncds_configandlds_configonly. EDS, RDS and SDS keep their timeouts on purpose. Those are per-resource config sources the agent generates, and a fetch that never ends there would pin a cluster or listener in warming at runtime (proxy roll: a new Envoy epoch served 404 NR (route_not_found) on the egress listener for 2.8 s before it was Ready — first non-zero liveness since 08-02 #817, QUIC: a twin cluster added after its base is subscribed never receives EDS (delta WatchMap dedup on the shared EDS name) — 15 s of 503/NC for every new ServiceAccount on a node #1008). Their timeouts also only matter after CDS/LDS have arrived, which means the agent is already answering. g-c-p answers a wildcard subscription's first request even when it is empty (pkg/cache/v3/simple.go:605), so init cannot hang while the agent is up.agent/internal/proxy/hotrestart).adminServerInfoalready attributes every answer to the epoch that gave it.HandoffDeadlineafter the last answer. That wedge is a main thread blocked in a hot-restart RPC, with the admin never accepting.hot-restart successor still initializing past the handoff deadline. The--handoff-deadlinehelp text is updated to match.1.0.16→1.0.17.First start (epoch 0)
If the agent comes up late, epoch 0 now waits in init instead of going LIVE with zero listeners at +30 s. The pod was not usefully Ready before this change either, and epoch 0 is outside the handoff watchdog. This was observed on kind after a workstation reboot with the agent still removed. Epoch 0 sat in
PRE_INITIALIZINGfor more than 5 minutes with no fetch timeouts, then went LIVE about 8 s after the agent DaemonSet was restored.Evidence
Unit tests: red, then green
//charts/aether:aether_proxy_bootstrap_cds_lds_wait_testpins both fields. Against main's configmap it fails withdoes not contain the pattern: lds_config:\n\s+ads: \{\}\n\s+initial_fetch_timeout: 0s\n.agent/internal/proxy/hotrestart/handoffinit_test.gohas four tests: holds a successor that keeps answering for 10 min, still fires once it goes silent, parent answers do not count, and a realRunloop with a 1 s deadline. All four fail against main'scoordination.go. For example:Run returned while the successor was answering INITIALIZING at its epoch: hot-restart handoff watchdog: epoch 1 not LIVE within 1s of launch.Real Envoy hot restart (the deployed proxy binary,
@pinned_envoy_linux_amd64)Setup: epoch 0 serves a static
127.0.0.1:18081. Epoch 1 is forked with the chart's ADS-onlydynamic_resources, and the xDS socket is absent.initial fetch timed out …Cluster.initial fetch timed out …Listenerand, in the same millisecond,starting workers. The parent logsclosing and draining listeners2 ms later.18081is refused (curl rc=7) from +30.4 s onward.PRE_INITIALIZINGfor 90 s and 86/86 requests are served by epoch 0. In a second run the xDS server came back at +60 s. Epoch 1 got its listener, went LIVE at about +65 s, and took over hitlessly: 95/95 requests served (62 by epoch 0, 33 by epoch 1).kind (
e2e/eastwest-quic.sh up+ a scratch leg)The leg removes the agent pod (DaemonSet nodeSelector), SIGHUPs the supervisor 3 s later to trigger an in-pod hot restart (the same Envoy protocol as a cross-pod roll), and probes
127.0.0.1:18081from client-a's pod netns every 0.5 s.closing and draining listeners6 ms afterstarting workers. The first refusal is at +35 s and the last at +75 s, which is 13 s after the agent was restored.PRE_INITIALIZING. At +2 m the supervisor logged its one-timestill initializing past the handoff deadlinewarning and killed nothing. The successor went LIVE and drained the parent only after the agent was back.Suites
bazel testpasses on the touched packages: hotrestart, supervisorcmd,charts/aether:all, proxy-supervisor, envoy_validate,agent/internal/cmd(44/44).bazel test --config=racepasses on hotrestart and supervisorcmd.bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...is clean.make gazelleandmake formatwere run.Trade-off and open risks
edge-configmap.yaml) is unchanged. It is not hot-restarted, and its readiness already rides an LDS-delivered listener.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr