fix(agent): make stats and metadata RPC errors non-fatal#22869
Open
fix(agent): make stats and metadata RPC errors non-fatal#22869
Conversation
Transient RPC failures in reportMetadata and reportLoop now log a warning and continue instead of returning an error that tears down the entire apiConnRoutineManager errgroup, which kills coordination, DERP maps, and other critical routines. Refs #22864
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.
Problem
The
apiConnRoutineManageruses a singleerrgroup.Group. WhenreportMetadataorstatsReporter.reportLoopencounters a transientRPC error (e.g. from network disruption), the error propagates through
the errgroup, canceling its context and tearing down ALL routines,
including critical ones like coordination and DERP map subscription.
During network disruption, these periodic, non-critical RPCs fail first,
forcing a full API reconnection cycle that compounds the disruption.
Solution
Both routines now log the error as a warning and continue the loop
instead of returning the error to the errgroup:
reportMetadata:BatchUpdateMetadataerrors are logged, andreportInFlightis reset so the next tick can retry. Metadata will bere-collected and sent on the next tick.
statsReporter.reportLoop:UpdateStatserrors in the main loopare logged and the loop continues. Stats will be re-sent on the next
callback. The initial
UpdateStatscall (to get the report interval)remains fatal since the interval is needed to configure the callback.
Testing
TestStatsReporter_NonFatalRPCError: injects a transient error onUpdateStats, verifies the loop does NOT exit, then verifies the nextstats report is sent successfully.
TestStatsReporterandTestAgent_Metadatatests pass.Refs #22864