Repository navigation
Conversation
Signed-off-by: Guilherme Kauã da Silva <[email protected]>
| * @author Guilherme Kauã da Silva | ||
| */ | ||
| @FunctionalInterface | ||
| public interface LockRenewalFailureListener { |
There was a problem hiding this comment.
Add lock per lock object. Use thread name if possible
There was a problem hiding this comment.
To confirm, do you want to register the listener for each lock object with RLock#addListener(LockRenewalFailureListener)?
For onFailure(String threadName, Throwable cause), the lock will store the owner thread name when it acquires the lock. If another thread calls the method, such as an asynchronous API that uses an explicit threadId, the method will use the thread ID instead.
Do you want to remove the Config-level listener, or keep it as a global fallback?
There was a problem hiding this comment.
To confirm, do you want to register the listener for each lock object with RLock#addListener(LockRenewalFailureListener)?
Yes.
Remove the Config-level listener
There was a problem hiding this comment.
@mrniko Pushed the changes.
There is a behavior worth confirming tho: the callback repeats on every watchdog cycle while renewal keeps failing, rather than firing once. Listener exceptions are logged and don't stop scheduling, and notifications are dispatched on the shared executor so a slow listener doesn't delay the next renewal.
Signed-off-by: Guilherme Kauã da Silva <[email protected]>
Signed-off-by: Guilherme Kauã da Silva <[email protected]>
… hand Signed-off-by: Guilherme Kauã da Silva <[email protected]>
Signed-off-by: Guilherme Kauã da Silva <[email protected]>
|
@mrniko Should i resolve the conflicts or you will do it on your own? |
mrniko
left a comment
There was a problem hiding this comment.
Left two comments above. Please review.
|
|
||
| private ChunkExecution<Boolean> buildChunk(Iterator<String> iter, int chunkSize) { | ||
| Map<String, Long> name2lockName = new HashMap<>(); | ||
| Map<String, List<Tuple<Long, String>>> name2owners = new HashMap<>(); |
|
|
||
| private ChunkExecution<List<String>> buildChunk(Iterator<String> iter, int chunkSize) { | ||
| Map<String, Long> name2threadId = new HashMap<>(chunkSize); | ||
| Map<String, List<Tuple<Long, String>>> name2owners = new HashMap<>(chunkSize); |
|
Any updates? |
Problem
When a lock watchdog renewal fails, Redisson only logs the error. Applications have no way to react, for example, by stopping work that may continue after lock ownership is lost.
Fix
Adds
LockRenewalFailureListener, configurable throughConfig#setLockRenewalFailureListener(...).The listener receives the unmapped lock name, owner thread ID, and renewal failure cause. It is notified asynchronously for failed watchdog-renewal batches, including read-lock and fast multi-lock renewal paths, without delaying subsequent renewal scheduling.
Listener and name-mapping failures are isolated and logged so they do not stop renewal scheduling. A notification indicates that a renewal attempt failed; it does not itself mean the lock has expired or ownership has been lost.
Tests
Adds coverage verifying that the listener:
Fixes #4698