fix(appproxy): make circuit locks self-cleaning to prevent unbounded growth#12873
Draft
seedspirit wants to merge 1 commit into
Draft
fix(appproxy): make circuit locks self-cleaning to prevent unbounded growth#12873seedspirit wants to merge 1 commit into
seedspirit wants to merge 1 commit into
Conversation
…growth Replace CircuitManager._circuit_locks with a WeakValueDictionary so a lock entry lives exactly as long as some coroutine holds or waits on it. The previous dict grew without bound in Traefik mode: the 30s reconcile loop created an entry for every live circuit, but entries were only removed by unload_circuits() in the same process, so HA setups and missed-unload circuits leaked entries forever. The explicit pop also orphaned locks that still had waiters, breaking per-circuit mutual exclusion when a new caller created a second lock for the same circuit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
CircuitManager._circuit_locks(plain dict) with aweakref.WeakValueDictionaryso a per-circuit lock entry lives exactly as long as some coroutine holds or waits on it, then vanishes with its last userunload_circuits()in the same process — HA setups (reconcile consumed by instance A, unload run by instance B) and missed-unload circuits leaked entries foreverTest plan
pants test tests/unit/appproxy/coordinator::— all pass🤖 Generated with Claude Code