You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Watchdog doesn't renew lock intermittently which leads to premature release of lock #5697
We have implemented distributed locking on long-running subscription processes that generally take 5 minutes to complete by using RLocks. We have multiple pods/threads periodically trying to acquire the RLock, and our expectation is that only one thread should be able to access the subscription associated with the lock at a time. The method that's used to try acquiring the subscription is tryLock() with wait time of 10 seconds and no lease time. We did not specify lease time in order to rely on Redisson's native watchdog implementation.
But we see there are certain time intervals where the lock is not renewed for awhile which leads to the lock being released prematurely even though our subscription is still alive. This allows other threads to acquire the released lock which leads to two concurrent threads operating on the same resource.
Simplified code snippet :
val channelLock = redissonLock.getLock(channelLock)
if (channelLock.tryLock(10, TimeUnit.SECONDS) {
subscribeToChannel() // takes around 5 minutes to complete
channelLock.unlock()
}
Referencing above pseudocode, it seems like while subscribeToChannel() is happening and other threads try to access the channelLock the watch dog does not renew the expiration in time. This allows other threads to pick up the lock and subscribe to the channel that should only be subscribed by one thread at a time.
Can we please receive some assistance on understanding what is going on here and how we can ensure that watch dog renewals are reliably executed on all the locks that we maintain?
Additional Request :
We notice in the implementation of RedissonBaseLock.renewExpiration() that we are returning early under certain circumstances (here & here) and we suspect that this may be relevant to our current situation of non-renewals.
Is it possible for us to add trace level logs here for us to get further visibility on renew expiration behavior? As of now it's difficult to determine where exactly the renew expiration flow is going wrong.
We notice in the implementation of RedissonBaseLock.renewExpiration() that we are returning early under certain circumstances (here & here) and we suspect that this may be relevant to our current situation of non-renewals.
Is it possible for us to add trace level logs here for us to get further visibility on renew expiration behavior? As of now it's difficult to determine where exactly the renew expiration flow is going wrong.
Activity
dayonekoo commentedon Mar 20, 2024
Added Additional Request section :
We notice in the implementation of RedissonBaseLock.renewExpiration() that we are returning early under certain circumstances (here & here) and we suspect that this may be relevant to our current situation of non-renewals.
Is it possible for us to add trace level logs here for us to get further visibility on renew expiration behavior? As of now it's difficult to determine where exactly the renew expiration flow is going wrong.
dayonekoo commentedon Mar 20, 2024
Created a bug associated with this question here : #5698 (comment).