iamhucong opened a new issue, #38981:
URL: https://github.com/apache/shardingsphere/issues/38981

   ## Bug Report
   
   `OrderedSPILoader` keeps a singleton-registry cache for multi-object 
lookups. The cache key is the input `Collection<?>` itself.
   
   When callers repeatedly pass newly created object collections, such as 
transient `RuleConfiguration` or `YamlRuleConfiguration` collections, 
semantically equivalent inputs may become different cache keys. Since the cache 
is held by the singleton SPI registry, these keys can retain the whole 
configuration object graph for the lifetime of the process.
   
   This can cause continuous heap growth under workloads that repeatedly 
rebuild and convert rule configuration collections.
   
   ## Expected behavior
   
   `OrderedSPILoader` should not retain transient object collections as 
long-lived cache keys.
   
   For multi-object lookups, it should reuse stable class-based lookup results 
where possible and build the current object-keyed result without storing the 
transient input collection globally.
   
   ## Actual behavior
   
   For singleton ordered SPI services, multi-object `getServices(...)` lookups 
are cached by the original input collection.
   
   If the input contains newly allocated rule configuration objects, each call 
may add another long-lived cache entry, even if the logical rule types are the 
same.
   
   ## Impact
   
   This may lead to unnecessary heap retention, frequent GC, and eventually OOM 
in metadata or management workloads that repeatedly load and convert database 
rule configurations.
   
   ## Related pull request
   
   A proposed fix is available in:
   
   - https://github.com/apache/shardingsphere/pull/38980
   


-- 
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]

Reply via email to