Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TryLock CancellationException issue #4662

Closed
yinyansheng opened this issue Nov 9, 2022 · 4 comments
Closed

TryLock CancellationException issue #4662

yinyansheng opened this issue Nov 9, 2022 · 4 comments
Labels
Milestone

Comments

@yinyansheng
Copy link

yinyansheng commented Nov 9, 2022

hello,

i met a problem, i have about 200 instances try get a distribute lock by use redisson client,
and one instances will occur CancellationException after running a period time, and can not recover.

version: 3.17.6
server: aws elasticahe redis cluster

java.util.concurrent.CancellationException
at java.base/java.util.concurrent.CompletableFuture.cancel(CompletableFuture.java:2468)
at org.redisson.RedissonLock.tryLock(RedissonLock.java:235)

code as below:
`

   RLock lock;
    try {
        lock = redissonService.getRedissonClient().getLock(LEASE_COORDINATOR_LOCK_KEY);

        if (!lock.tryLock(3_000, 60_000, TimeUnit.MILLISECONDS)) {
            //log something
            return;
        }

        //do something....

    } catch (InterruptedException e) {
        //log something
    } catch (Exception e) {
        //log something
    } finally {
        //here ignore unlock to ensure execute only once in specific period time
        //lock.unlock();
    }`
@Barrios596
Copy link

Hello,

I'm having the same issue that @yinyansheng reported after upgrading from Redisson client 3.16.1 to version 3.17.6

java.util.concurrent.CancellationException
	at java.base/java.util.concurrent.CompletableFuture.cancel(CompletableFuture.java:2396)
	at org.redisson.RedissonLock.tryLock(RedissonLock.java:235)

The issue is happening with a sample code similar to the one posted by @yinyansheng, when calling the tryLock() method.

Redisson version

3.17.6

Seems to be similar to this issue #4216

@mrniko
Copy link
Member

mrniko commented Nov 28, 2022

Fixed! Thanks for report

@mrniko mrniko closed this as completed Nov 28, 2022
@andreas-ajaib
Copy link

@mrniko which version can I use to fix this problem? Also, is it safe to upgrade from version 3.15.x or 3.17.x?

@mrniko
Copy link
Member

mrniko commented Apr 7, 2023

3.18.1

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

No branches or pull requests

4 participants