Conversation
Track successful admission per target and invocation attempt so downstream limit exceptions release acquired slots while local rejections leave other calls untouched. Add filter-chain regression tests for synchronous and asynchronous failures, local rejection, invocation reuse, and target isolation. Fixes apache#16455
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16456 +/- ##
============================================
- Coverage 60.91% 60.91% -0.01%
- Complexity 15 11764 +11749
============================================
Files 1953 1953
Lines 89271 89280 +9
Branches 13473 13475 +2
============================================
+ Hits 54383 54387 +4
- Misses 29309 29315 +6
+ Partials 5579 5578 -1
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:
|
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.
What is the purpose of the change?
Fixes #16455.
ActiveLimitFilterandExecuteLimitFilterskip error accounting for everyLIMIT_EXCEEDED_EXCEPTION. If a downstream invoker throws that exception after admission, or completes its result future exceptionally with it, the acquired concurrency slot is never released. At a limit of 1, later calls can time out or be rejected despite no call remaining in flight.Track whether each filter acquired a slot during the current invocation attempt. Only locally rejected limit exceptions skip accounting; downstream limit exceptions release the slot through the existing error callback. Scope each marker by the target URL identity (also used by RpcStatus), since forking calls can share an Invocation across providers. Reset the marker on entry so sequential reuse does not reuse a previous admission decision. Existing timing, wakeup, successful-response, and non-limit-error handling are preserved.
The regression tests use the production
CopyOfFilterChainNodeandCallbackRegistrationInvokerlifecycle with local mock invokers and controllable futures. For both filters they verify synchronous downstream rejection, asynchronous exceptional completion, local rejection while another call remains active, sequential invocation reuse, and target isolation when two invokers share the same Invocation.Verification
JDK 17.0.17, Maven 3.9.4, Windows; the project's Java 8 artifact target is unchanged.
dab47b7843: 8 new regression cases, 4 assertion failures, 0 errors. Both filters retain an active count of 1 after synchronous/asynchronous downstream limit errors. The local-rejection controls pass.On this Windows checkout, the initial Unix resource-line-ending check reports 59 pre-existing CRLF resource files due to core.autocrlf=true. The separate Unix check was disabled locally for subsequent validation; no unrelated resources were modified. All three changed Java files use LF. The final test run also enabled Java Checkstyle and applied Spotless without further changes.
The regression targets exceptions delivered to
onError, not business exceptions carried inside a normally completedAppResponse. No registry or external RPC service is required. The full repository test suite was not run.AI assistance was used for investigation, code, and tests. The failing behavior was reproduced locally before applying the production fix.
Coverage follow-up
Added two non-limit RPC timeout cases (consumer and provider filters). Each verifies that the original exception propagates, the admitted slot is released, failure accounting increments, and the next invocation succeeds. Production code is unchanged by this follow-up.
The local JaCoCo 0.8.15 report, generated from the same 28 selected tests using CI's
jacoco,jdk15ge-simple,!jdk15ge-add-openprofiles, covers all 11 executable lines added by this PR with zero missed instructions or branches. In particular, theisLimitExceed()false branch is exercised. This is 100% local patch coverage, not whole-project coverage. Java Checkstyle and Spotless checks also pass with the same previously disclosed Windows Unix-resource-check exception. Remote CI and Codecov must rerun on the new commit; their previous success applies to the earlier commit only.Checklist