ACL client caches stale "not found" for valid workload tokens - #23732
Open
paras-gupta2 wants to merge 11 commits into
Open
ACL client caches stale "not found" for valid workload tokens#23732paras-gupta2 wants to merge 11 commits into
paras-gupta2 wants to merge 11 commits into
Conversation
Go Test Coverage: 71.7%See the workflow run for the full per-package breakdown and downloadable HTML report. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23732 +/- ##
==========================================
+ Coverage 61.48% 65.67% +4.19%
==========================================
Files 828 951 +123
Lines 105994 114946 +8952
==========================================
+ Hits 65166 75489 +10323
+ Misses 34561 32425 -2136
- Partials 6267 7032 +765 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…onfirmed not-found tokens
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.
Description
On some client nodes, Consul can start repeatedly saying “ACL not found” for Connect/xDS requests even when the proxy token is still valid. When that happens, sidecar proxies lose xDS updates, log stream errors, and some workloads on that node lose mesh connectivity until someone intervenes.
Root Cause
Token lookup is first done with a stale read for speed. If that stale read hits a follower that is briefly behind replication, it can wrongly return “ACL not found” for a token that actually exists. That bad result then gets treated like a real missing token in cache-refresh behavior, so the node can stay stuck in that error state.
Resolution
When a stale token lookup returns ACL not found, Consul now performs a second, consistent (leader) read before treating the token as missing. This prevents temporary replication lag from causing valid tokens to be incorrectly marked as missing and poisoning the cache. If the token is genuinely deleted, the leader still returns ACL not found, so the existing behavior remains unchanged.
Testing
Added a unit test to verify that a stale ACL not found followed by a successful leader read correctly resolves and caches the token.
Confirmed the test reproduces the original issue when the fix is disabled.