Skip to content

Deadlock after Redis timeout #1966

@hmagarotto

Description

@hmagarotto

Expected behavior

After a Redis response timeout, Redisson needs to be resilient and back to normal operation after Redis timeout and allow to lock and unlock critical sections again.

Actual behavior

After a Redis response timeout between attempts, Redisson adds the lock to scheduled renew task and never remove them. So, the application enters on a deadlock due to a lock renewed even after unlock.
The task can run on the same thread due to reentrant lock feature, but when the task runs on another thread a deadlock occurs.

Steps to reproduce or test case

  1. Start Redis
  2. Run the test application (https://github.com/hmagarotto/redissonlock) with a simple locked task.
  3. Force a timeout on Redis runnning a client pause command: "CLIENT PAUSE 5000"

Redis version

4.0.10

Redisson version

3.10.3

Redisson configuration

Single server default

Activity

added this to the 3.10.5 milestone on Mar 9, 2019
mrniko

mrniko commented on Mar 11, 2019

@mrniko
Member

Unable to reproduce. In this case lock is expired automatically by this method

void cancelExpirationRenewal(Long threadId) {
after 30 seconds by default. You can decrease this value through Config.lockWatchdogTimeout setting.

removed this from the 3.10.5 milestone on Mar 11, 2019
hmagarotto

hmagarotto commented on Mar 11, 2019

@hmagarotto
Author

Hi, thanks for your support.
In the above scenario Redisson continues to renew the TTL every 10 seconds, so the lock never expires or is removed. I will try to demonstrate better how to reproduce...

hmagarotto

hmagarotto commented on Mar 11, 2019

@hmagarotto
Author
aawu

aawu commented on Mar 12, 2019

@aawu

same problem here #1950

added this to the 3.10.5 milestone on Mar 12, 2019
mrniko

mrniko commented on Mar 13, 2019

@mrniko
Member

Fixed! Please find updated jar below

redisson-3.10.5-SNAPSHOT.jar.zip

aawu

aawu commented on Mar 13, 2019

@aawu

thanks for your support :)

hmagarotto

hmagarotto commented on Mar 13, 2019

@hmagarotto
Author

Thanks!
Now the lock is being removed by the Redis TTL after time expired.

danielshama

danielshama commented on Mar 3, 2024

@danielshama

Hi, I still have the same issue with version 3.17.4. I'm using tryLock with RReadWriteLock. After a timeout, I notice that Redisson continues to renew the TTL for the same lock.

reopened this on Mar 3, 2024
mrniko

mrniko commented on Dec 30, 2024

@mrniko
Member

@danielshama

Please upgrade to 3.38.1 or higher. Let us know if it happens with this version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @mrniko@hmagarotto@aawu@danielshama@seakider

      Issue actions

        Deadlock after Redis timeout · Issue #1966 · redisson/redisson