Skip to content

optimize: limit allowlist cache growth#8120

Open
LegendPei wants to merge 5 commits into
apache:2.xfrom
LegendPei:refactor/json-allowlist-cache-bound
Open

optimize: limit allowlist cache growth#8120
LegendPei wants to merge 5 commits into
apache:2.xfrom
LegendPei:refactor/json-allowlist-cache-bound

Conversation

@LegendPei
Copy link
Copy Markdown
Contributor

@LegendPei LegendPei commented May 31, 2026

Ⅰ. Describe what this PR did

Limit the growth of the JSON deserialization allowlist cache.

This PR updates JsonAllowlistManager to:

  • reject overlong class names before allowlist checking
  • cache only allowed class names
  • avoid caching rejected class names
  • cap the allowlist cache size to prevent unbounded memory growth

It also adds unit tests covering rejected class names, overlong class names, cache hits, and cache size limits.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Added unit tests in JsonAllowlistManagerTest.

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov
Copy link
Copy Markdown

codecov Bot commented May 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.01%. Comparing base (9c235df) to head (8e8df76).

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #8120      +/-   ##
============================================
+ Coverage     72.80%   73.01%   +0.21%     
  Complexity      883      883              
============================================
  Files          1327     1327              
  Lines         50719    50734      +15     
  Branches       6049     6052       +3     
============================================
+ Hits          36924    37043     +119     
+ Misses        10802    10691     -111     
- Partials       2993     3000       +7     
Files with missing lines Coverage Δ
...apache/seata/common/json/JsonAllowlistManager.java 95.23% <100.00%> (+0.46%) ⬆️

... and 15 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@funky-eyes funky-eyes changed the title Optimize : limit allowlist cache growth optimize: limit allowlist cache growth Jun 1, 2026
@funky-eyes funky-eyes requested a review from Copilot June 1, 2026 01:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@funky-eyes funky-eyes added this to the 2.7.0 milestone Jun 1, 2026
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.

3 participants