Skip to content

RedisLockRegistry expireAfter doesn't work #3401

Closed
@hero-zhanghao

Description

@hero-zhanghao

In what version(s) of Spring Integration are you seeing this issue?

For example:

5.3.1.RELEASE

Describe the bug

I create a RedisLockRegistry and set expireAfter to 1000L .

After obtain the Lock object, invoke tryLock (3000, TimeUnit.MILLISECONDS) method.

Print 'lock-test' to sleep 2000L milliseconds, then call unlock.

When two threads come in at the same time, the second thread should get the lock one second after the first thread,

However, what observe now is that the two threads are always two seconds apart, seemingly unaffected by the expireAfter field.

thanks

To Reproduce

2020-10-10 15:40:46,063 [boundedElastic-2] INFO c.e.s.raffle.utils.RedisLockUtils.lambda$null$1(RedisLockUtils.java:65) - try obtain lock

2020-10-10 15:40:46,066 [boundedElastic-2] INFO c.e.s.raffle.utils.RedisLockUtils.lambda$null$1(RedisLockUtils.java:68) - Got the distributed lock and executing , key = test , time = 2020-10-10T15:40:46.066

lock-test

2020-10-10 15:40:47,006 [boundedElastic-1] INFO c.e.s.raffle.utils.RedisLockUtils.lambda$null$1(RedisLockUtils.java:65) - try obtain lock

2020-10-10 15:40:48,069 [boundedElastic-1] INFO c.e.s.raffle.utils.RedisLockUtils.lambda$null$1(RedisLockUtils.java:68) - Got the distributed lock and executing , key = test , time = 2020-10-10T15:40:48.069

lock-test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions