Conversation
Fixes: #11180 The previous solution, based on the shared pool of `ReentrantLock` from the `DefaultLockRegistry`, is proven to be inconvenient with keys collision: different keys might stumble on the same shared `ReentrantLock` making the application being blocked for nothing. * Remove `DefaultLockRegistry` logic from the `RedisLockRegistry` * Remove local `RedisLock.holdCount` as we rely on the `localLock` again * Revert back default `cacheCapacity` to `100_000` as we don't use a shared pool of locks anymore * Do not evict from the cache still in-held locks * In the `obtain()`, try to remove unused lock when `cacheCapacity` is reached. If it cannot clean up the room, throw a `CannotAcquireLockException`. This is to prevent an out-of-memory error * Also, throw a `CannotAcquireLockException` on lock calls for an orphaned lock. This is to prevent a race condition when two distinct local locks are locked in different threads against the same key * Add human-readable `toString()` into the `RedisLockRegistry` **Auto-cherry-pick to `7.0.x`**
cppwfs
approved these changes
Jul 14, 2026
cppwfs
left a comment
Contributor
There was a problem hiding this comment.
Looks great.
I found no issues.
Thanks for doing this!
cppwfs
pushed a commit
that referenced
this pull request
Jul 15, 2026
Fixes: #11180 The previous solution, based on the shared pool of `ReentrantLock` from the `DefaultLockRegistry`, is proven to be inconvenient with keys collision: different keys might stumble on the same shared `ReentrantLock` making the application being blocked for nothing. * Remove `DefaultLockRegistry` logic from the `RedisLockRegistry` * Remove local `RedisLock.holdCount` as we rely on the `localLock` again * Revert back default `cacheCapacity` to `100_000` as we don't use a shared pool of locks anymore * Do not evict from the cache still in-held locks * In the `obtain()`, try to remove unused lock when `cacheCapacity` is reached. If it cannot clean up the room, throw a `CannotAcquireLockException`. This is to prevent an out-of-memory error * Also, throw a `CannotAcquireLockException` on lock calls for an orphaned lock. This is to prevent a race condition when two distinct local locks are locked in different threads against the same key * Add human-readable `toString()` into the `RedisLockRegistry` **Auto-cherry-pick to `7.0.x`**
|
Could you let me know which Spring Boot version this Pull Request will first be released in? It doesn't appear to be included in 4.0.7 or 4.1.0. Is it scheduled for 4.0.8 and 4.1.1? |
Contributor
|
Next Release is 4.0.5 and 4.1.1. It should be in these releases as well as the 4.2.0-M1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #11180
The previous solution, based on the shared pool of
ReentrantLockfrom theDefaultLockRegistry, is proven to be inconvenient with keys collision: different keys might stumble on the same sharedReentrantLockmaking the application being blocked for nothing.DefaultLockRegistrylogic from theRedisLockRegistryRedisLock.holdCountas we rely on thelocalLockagaincacheCapacityto100_000as we don't use a shared pool of locks anymoreobtain(), try to remove unused lock whencacheCapacityis reached. If it cannot clean up the room, throw aCannotAcquireLockException. This is to prevent an out-of-memory errorCannotAcquireLockExceptionon lock calls for an orphaned lock. This is to prevent a race condition when two distinct local locks are locked in different threads against the same keytoString()into theRedisLockRegistryAuto-cherry-pick to
7.0.x