juicewcode opened a new pull request, #6900: URL: https://github.com/apache/shenyu/pull/6900
Fixes #6891 - Fix the memory leak in `LeastActiveLoadBalance.countMap`. Previously entries were only added and never removed, so an upstream's entry lingered forever after it was taken out of the list, causing unbounded memory growth proportional to historical upstream churn and O(n) scan overhead on every selection. Now stale entries whose domains are absent from the current upstream list are evicted via `countMap.keySet().retainAll(domainMap.keySet())` before selection. - Added `testRemoveStaleCountMapEntries` to `LeastActiveLoadBalanceTest`. It registers two upstreams, removes one, and asserts the removed upstream's `countMap` entry is cleaned up while the remaining one is kept. <!-- Describe your PR here; e.g. Fixes #issueNo --> <!-- Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request. --> Make sure that: - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
