fix(rpc): release concurrent count when downstream throws LIMIT_EXCEEDED - #16461
Open
Lubaoshuai wants to merge 2 commits into
Open
Lubaoshuai wants to merge 2 commits into
Lubaoshuai wants to merge 2 commits into
Conversation
…DED (apache#16455) ActiveLimitFilter and ExecuteLimitFilter skipped RpcStatus.endCount() whenever onError received a LIMIT_EXCEEDED RpcException. That skip is only correct when the filter itself rejected admission (beginCount never succeeded). When admission succeeded and a downstream invoker or the business implementation threw LIMIT_EXCEEDED, the count taken in invoke() leaked, eventually exhausting the actives/executes slots. Mark the invocation once beginCount succeeds and only skip the release when that marker is absent. Signed-off-by: Lubaoshuai <128781758+Lubaoshuai@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16461 +/- ##
============================================
Coverage 60.91% 60.92%
- Complexity 15 11766 +11751
============================================
Files 1953 1953
Lines 89271 89273 +2
Branches 13473 13473
============================================
+ Hits 54383 54389 +6
- Misses 29309 29313 +4
+ Partials 5579 5571 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Lubaoshuai <128781758+Lubaoshuai@users.noreply.github.com>
Lubaoshuai
force-pushed
the
fix/limit-filter-count-leak
branch
from
September 13, 2026 16:42
e836c66 to
16a8b39
Compare
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.
Fixes #16455
What
ActiveLimitFilterandExecuteLimitFilterskippedRpcStatus.endCount()wheneveronErrorreceived aLIMIT_EXCEEDEDRpcException. That skip is only correct when the filter itself rejected admission (in that casebeginCountnever succeeded, so there is nothing to release).When admission succeeded and a downstream invoker (client side,
ActiveLimitFilter) or the business implementation (provider side,ExecuteLimitFilter) threwLIMIT_EXCEEDED— or a response future completed exceptionally with it — the count taken ininvoke()leaked. Repeated occurrences exhaust theactives/executesslots and every subsequent invocation times out until restart.Fix
Mark the invocation (
invocation.put(...COUNTED, true)) as soon asbeginCountsucceeds.onErrornow only skips the release when aLIMIT_EXCEEDEDarrives without that marker (i.e. the filter's own rejection path); every other error — and downstream limit exceptions — release the count as before.Tests
Two regression cases per filter in
dubbo-rpc-api:LIMIT_EXCEEDEDafter successful admission → the slot is released (active == 0); previously it leaked,ActiveLimitFilterTest(9) andExecuteLimitFilterTest(6) all pass.