wozhenbang2004 opened a new pull request, #16568: URL: https://github.com/apache/dubbo/pull/16568
## What is the purpose of the change? Fixes #16567. ExpiringMap.get() and background processExpires() delete expired mappings by key alone. A concurrent put can replace the observed entry before deletion, so the old expiration check removes the fresh value and causes an unnecessary cache miss. Use computeIfPresent to remove the mapping only when its current wrapper is still the observed wrapper. Strict identity avoids invoking stored payload equality through ExpiryObject.equals. Existing expiration and access-time rules remain unchanged; this change does not claim to resolve every idle-time refresh race. The deterministic regressions cover lookup and background cleanup, same-value replacement, payloads whose equals must not be invoked, and unchanged expired entries. Synchronization uses latches, without production test hooks or sleep-based race timing. ## Validation - Regression tests against unmodified production source: six failures, two passes. Patched source: all eight pass. - Maven 3.9.11 verify of dubbo-filter-cache and its reactor dependencies, selecting ExpiringMapTest and ExpiringCacheFactoryTest: 13 tests pass, no skips. Java 17 was used, with its bundled compiler module exposed as the forked javac launcher in this environment. - Spotless check passes as part of verify. Both Checkstyle audits pass with zero violations under the checkstyle profile. - The two remote file blobs exactly match the tested source and test. The complete repository test suite was not run. ## Checklist - [x] Linked the corresponding GitHub issue. - [x] Described the trigger, behavior change and implementation. - [x] Added deterministic regression tests and verified the existing expiring-cache tests. - [ ] GitHub Actions results will be checked on this PR. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
