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
The unlock() method of JdbcLock should verify the execution result of releasing the lock ownership.
If the ownership can not be removed due to data expiration, a ConcurrentModificationException should be thrown.
The RedisLock implementation should also throw a ConcurrentModificationException in similar scenarios.
Current Behavior
The unlock() method does not verify the execution result of releasing the lock ownership.
The RedisLock throws an IllegalStateException when attempting to release the lock after the ownership has expired.
Context
If the unlock() method does not verify the execution result of releasing the lock ownership, users might face concurrency issues without being notified. For example:
Process A and process B are operating in the same region. Process A acquires the distributed lock with lock_key: 'key'.
Due to prolonged work, the ownership of the lock held by process A expires.
Before process A releases the lock, process B also acquires the distributed lock with same lock_key.
When process A attempts to release the distributed lock, the current implementation does not inform the user that the integrity of data protected by this lock may have been compromised.
To address this, it is proposed that the unlock() method be enhanced to verify if the ownership of lock has been removed successfully. If the ownership cannot be removed due to data expiration, a ConcurrentModificationException will be thrown. This approach maintains the integrity of the distributed lock mechanism.
The text was updated successfully, but these errors were encountered:
…y successful unlocking
Fixes: spring-projects#9291
* Modify `unlock()` method of `JdbcLock`: if the lock ownership can not be removed due to data expiration, a `ConcurrentModificationException` should be thrown.
* Modify `unlock()` method of `RedisLock`: if the lock ownership can not be removed due to data expiration, a `ConcurrentModificationException` should be thrown.
* Maintain test cases
…y successful unlocking
Fixes: spring-projects#9291
* Modify `unlock()` method of `JdbcLock`: if the lock ownership can not be removed due to data expiration, a `ConcurrentModificationException` should be thrown.
* Modify `unlock()` method of `RedisLock`: if the lock ownership can not be removed due to data expiration, a `ConcurrentModificationException` should be thrown.
* Maintain test cases
Expected Behavior
unlock()
method ofJdbcLock
should verify the execution result of releasing the lock ownership.ConcurrentModificationException
should be thrown.The RedisLock
implementation should also throw aConcurrentModificationException
in similar scenarios.Current Behavior
unlock()
method does not verify the execution result of releasing the lock ownership.RedisLock
throws anIllegalStateException
when attempting to release the lock after the ownership has expired.Context
If the
unlock()
method does not verify the execution result of releasing the lock ownership, users might face concurrency issues without being notified. For example:To address this, it is proposed that the
unlock()
method be enhanced to verify if the ownership of lock has been removed successfully. If the ownership cannot be removed due to data expiration, aConcurrentModificationException
will be thrown. This approach maintains the integrity of the distributed lock mechanism.The text was updated successfully, but these errors were encountered: