Skip to content

fix: retain in-flight parameter counts across rule reloads - #3668

Draft
hutiefang76 wants to merge 2 commits into
alibaba:1.8from
hutiefang76:frank/sentinel-manager-reload-20261022
Draft

hutiefang76 wants to merge 2 commits into
alibaba:1.8from
hutiefang76:frank/sentinel-manager-reload-20261022

Conversation

@hutiefang76

Copy link
Copy Markdown

Describe what this PR does / why we need it

Reloading a parameter thread rule with a tighter limit can lose the counts of requests still running. With two entries in flight, replacing the old rules by a count-2 rule currently admits a third entry.

Does this pull request fix one issue?

Fixes #3667.

Describe how you did it

Use the newly loaded resource/index rules when deciding whether to retain the shared thread counter. Removed rules still lose their own time and token counters; the last-index and whole-resource cleanup paths remain intact. The existing public clearForRule(rule) method keeps its behavior, and the metric does not depend on the manager.

Describe how to verify it

On the #3657 baseline (04e791b1), the eight real-entry regressions have two failures: the extra request is admitted after reload. The other six controls pass. With this follow-up, all eight pass, and the affected parameter-flow reactor and dependencies pass 274 tests on JDK 17, with no failures, errors or skips.

mvn -B -pl sentinel-extension/sentinel-parameter-flow-control -am -Dsurefire.jdk-toolchain-version=17 test

The same eight regressions also pass on Zulu JDK 8 (XML runtime 1.8.0_492), using Maven on JDK 17 and a clean owned reactor:

mvn -B -pl sentinel-extension/sentinel-parameter-flow-control -am clean -Dsurefire.jdk-toolchain-version=1.8 -Dtest=ParamFlowRuleManagerReloadTest -Dsurefire.failIfNoSpecifiedTests=false test

verify -DskipTests passed, including PMD checks with no violations; this verification does not count as another test run.

Special notes for reviews

This is stacked on #3657 and stays in draft until that dependency lands. The three-file prerequisite comes from #3657; this follow-up changes ParamFlowRuleManager, adds the package-private metric overload, and adds the real-entry reload regression class. The initialized-rule-sharing fix in #3657 is not new work in this PR.

Implementation and review were AI-assisted. Local verification is separate from upstream CI and maintainer acceptance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Parameter rule reload loses in-flight counts after a limit change

1 participant