Repository navigation
fix(agent): the xDS ACK tracker keeps what a proxy holds per stream, a listener wait is for the published version, and nothing known is not a listener absent (#1624) - #1632
Merged
Conversation
…a listener wait is for the published version, and nothing known is not a listener absent (#1624) The tracker kept one state per listener name, shared by every xDS stream. With two proxy generations connected, or a reconnect, answers from different streams interleaved, and what the last one to arrive said stood. It now keeps, per stream, what the proxy on it holds: what the proxy stated in its first Listener request, with every response it acknowledged since, applied in the order it acknowledged them. A stream is one proxy process, so that is the proxy's own history and needs no ordering between streams. Everything goes with the stream when it closes. What the node holds is read off the open streams when a wait asks. - WaitListenerPresent is for the version the agent publishes, read from the snapshot cache. One connected proxy holding it, with nothing unanswered about the name, answers the wait; any connected proxy rejecting that version fails it. A proxy that states the published version when it reconnects answers it (#1511). - WaitListenerAbsent is for every connected proxy to be known not to hold the listener. A proxy is not known before its first Listener request is answered, and nothing is known with no proxy connected (#1572). A rejected add is not read as absent: the pinned proxy applies a rejected Listener response in part (measured, //agent/test/mtlspool). - A stream's state is dropped with it, so a new Envoy process starts unknown (#1585), and an acknowledged removal forgets the name (#1573). - An ACK answers a response of its own stream and its own type (#1574). A pod DEL that arrives with no proxy connected, or while a new proxy generation has not asked for its listeners yet, now takes the full wait (2 s) where it used to return at once. Closes #1624 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…est, a removal carried by a rejected response is done, and a wait with no proxy to ask is counted apart (#1624) Review of the per-stream tracker: - An ADS stream that has not asked for its listeners no longer holds a pod DEL: a new generation loading its clusters holds no listener, and counting it cost the full wait on every DEL of every hot restart. - The proxy does every removal of a Listener response before any add and rejects the response at the end (measured, //agent/test/mtlspool). A NACK is now a rejection of the adds only; what the response removed is gone and forgotten, so no rejection fails a removal wait and there is no absent/nack series. - A wait that ends with no proxy to ask is counted under reason no_proxy, not timeout. - Pinned as limits, with the comments corrected: a proxy that has stopped its listeners acknowledges a listener it does not add, so an answered ADD wait is not proof of a serving listener in a hot-restart overlap; and a response computed but not written is invisible to the tracker. - Tests: each of RemovePod's two waits is pinned alone, and a proxy that arrives while a wait looks is seen. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…ome from the name builders Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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 #1624
What is now true
The ACK tracker (
agent/internal/xds/ack) keeps what a proxy holds per xDS stream. A stream is one connection of one proxy process: a hot restart has two for a while, and a proxy that reconnects opens a new one.initial_resource_versions), with every response it answered since, applied in the order it answered them. That is the proxy's own history, so nothing orders answers between streams: the send-order clock, the sent-order rules, the writing-stream field,unconfirmedand the close-time rules of fix(agent): a listener ACK wait is for the version the agent publishes, and a proxy that states that version resolves it from the opening exchange (#1511) #1559 have no counterpart here.The two waits the CNI server makes:
WaitListenerPresent(pod ADD)WaitListenerAbsent(pod DEL)The published version is read from the snapshot cache (
ack.SnapshotVersions, wired inagent/internal/cmd/root.go).Choices this makes, and why
TestRemovalCarriedByARejectedResponseIsDone), and what it added is not read as absent (TestRejectedListenerResponseIsAppliedInPart).What it costs (the decision #1572 named)
A managed pod DEL (and ADD) that arrives while no proxy has asked for its listeners takes the full wait (
envoyAckTimeout, 2 s) and then proceeds: after an agent restart until the proxy has reconnected, and whenever the proxy is down. The DEL used to return at once.Those are counted apart:
aether_agent_xds_ack_wait_failures_total{reason="no_proxy"}.reason="timeout"now means there was a proxy to ask and it did not answer in time. The counter's series set changes from four to five:present×nack/timeout/no_proxy,absent×timeout/no_proxy.absent/nackis gone, because no rejection fails a removal wait any more. The reason set is not intest/harnesscontract/external-harness.yaml(that file'sreasonsets are the pin metrics'), so the contract is unchanged.docs/runbook.mdhas the reading.Settled, and the test that shows it
Every test below failed against the unchanged tracker first (with a shim for the two new names), unless marked guard.
TestWaitListenerPresent_IsForThePublishedVersion,TestWaitListenerPresent_ARejectionIsOfAVersion,TestServer_ReturnToAnAcknowledgedVersion,TestAckTrackerReadsThePublishedListenerVersionFromTheCache(the real cache)TestWaitListenerPresent_AnsweredByWhatTheProxyStates,TestServer_StatedAtThePublishedVersionAnswersTheWait(real go-control-plane),TestReconnectingProxyStatesTheListenersItHolds(real proxy)TestWaitListenerAbsent_UnknownIsNotAbsent,TestWaitListenerAbsent_KnownFromTheFirstResponse,TestServer_StatedButNotPublishedIsRemoved,TestRemovePod_WaitsUntilAProxySaysWhatItHolds(the CNI server; each of its two waits pinned alone)TestStreamClose_ForgetsWhatItsProxyHeld,TestServer_StreamResetTestTrackerForgetsARemovedListener(against the unchanged tracker it fails already at its fixture, which also counts what is kept for clusters; the mutation that keeps a removed name is killed by it),TestNack_TheRemovalsOfARejectedResponseAreDoneTestAck_ANonceEchoedUnderAnotherTypeAnswersNothingTestTwoGenerations_NoAnswerOfOneErasesTheOthers(three of five cases failed before; the other two are guards),TestTwoGenerations_WhichMustHoldTheListener,TestServer_TwoGenerationsRemoveAListenerMutation check: 34 mutations of
tracker.go(each condition of the two decisions, the type check, the close, the straggler mark, every wake-up, the NACK reading, the expiry reason), each killed by at least one test; and the two waits ofRemovePodinpod.go, each dropped in turn, each killed by its own sub-case.Not settled (each pinned by a test that asserts what happens)
TestADrainingProxyAcknowledgesAListenerItDoesNotAdd, measured with the admin endpoint that makes the same call). Nothing on the stream tells a draining proxy from a serving one. The CNI plugin's in-netns probe stays the proof.TestListenerOfARejectedResponseIsNotStatedAtReconnect). After an agent restart the agent has no word of it: a DEL is not waited for, and if its pod is gone nothing ever removes it from the proxy.TestServer_AbsentReturnsWhileAnAddIsOwedToTheProxy, not timed: the stream's goroutine is held). A DEL that lands between the cache computing a response that adds the listener and the stream writing it returns before that response is seen. Same window as before this change; closing it needs the cache's order.From #1559
Carried, adapted to the model: the real go-control-plane harness and its tests, the cache tests, the real-proxy LDS test, the version, rejection, unanswered-response, two-generation and concurrency cases. Not carried, because they describe that design and not wanted behaviour: a statement that answers nothing until the opening response is acknowledged, a rejected opening response that "resolves nothing", reading the opening exchange only for a plain wildcard subscription, the send-order cases, and the unwired tracker failing on any rejection.
Changed tests on
main:TestWaitListenerAbsent's first case ("never-known listener is absent immediately", with no proxy) now asserts the opposite, which is #1572;TestMetrics_WaitFailures' timeout case andTestMetrics_WaitFailuresSeededfollow the new reason set; the test helperackDeltaanswers under the type of the response it answers; three white-box assertions follow the new fields. No case was removed.Outside the tracker
agent/internal/cni/server/pod.gois not touched: the call sites keep their signatures.pod_test.gogives the unit-test server a tracker that has seen one proxy holding nothing, so its DELs still return at once.agent/internal/xds/cache/listener.goandpodnames.goare not touched.Verification
bazel test --config=raceon//agent/internal/xds/ack:ack_test,//agent/internal/xds/cache:cache_test,//agent/internal/xds/server:server_test,//agent/internal/cni/server:server_test,//agent/internal/cmd:cmd_test,//agent/test/mtlspool:mtlspool_test: pass, after mergingmain.bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: clean.make format-check: clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr