Skip to content

Fix "TryLock interrupted keeps renewing lock indefinitely" - #3826

Merged
mrniko merged 1 commit into
redisson:masterfrom
Cesarla:2714__fix_try_lock_interrupted_keeps_renewing_lock_indefinitely
Sep 13, 2021
Merged

mrniko merged 1 commit into
redisson:masterfrom
Cesarla:2714__fix_try_lock_interrupted_keeps_renewing_lock_indefinitely

Conversation

@Cesarla

@Cesarla Cesarla commented Sep 9, 2021

Copy link
Copy Markdown
Contributor

Fixes #2714

@Cesarla
Cesarla force-pushed the 2714__fix_try_lock_interrupted_keeps_renewing_lock_indefinitely branch from 567b726 to 6153d05 Compare September 9, 2021 18:23
try {
future.await();
} catch (InterruptedException e) {
future.cancel(true);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensures the future is cancelled and interrupted in case the caller thread gets interrupted.

try {
renewExpiration();
} finally {
if (Thread.currentThread().isInterrupted()) {

@Cesarla Cesarla Sep 9, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the thread has been interrupted (e.g by CommandAsyncService:115) it will cancel the expiration renewal

@mrniko mrniko added this to the 3.16.3 milestone Sep 10, 2021
@mrniko mrniko added the bug label Sep 10, 2021
@mrniko
mrniko merged commit 4e10035 into redisson:master Sep 13, 2021
@mrniko

mrniko commented Sep 13, 2021

Copy link
Copy Markdown
Member

Thanks for contribution!

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

Labels

Development

Successfully merging this pull request may close these issues.

RedissonLock.tryLock() interrupted and keep renew lock

2 participants