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

Issue with threads being blocked. #14

Open
havenwang opened this issue Jan 22, 2018 · 1 comment
Open

Issue with threads being blocked. #14

havenwang opened this issue Jan 22, 2018 · 1 comment

Comments

@havenwang
Copy link

Hello,

I'm running into an issue where the RedisJobStore blocks for long periods of time (>1 minute) during execution of storeJobAndTrigger(...). It seems to be when we are acquiring the JedisLock.

I've created a small test that recreates the issue, and I've included the code below. Hopefully it should be pretty clear.

Test code:

public class TestHanging extends TestEnv {
    private static final Logger LOGGER = Logger.getLogger(TestJedisHanging.class);

    private static JedisPoolConfig config = new JedisPoolConfig();
    private static JedisPool pool = new JedisPool(config, "localhost", 6381, Protocol.DEFAULT_TIMEOUT);
    private static JedisLock lockPool = new JedisLock(pool.getResource(), "TestLock", 10 * 60 * 1000);

    @Test
    public void testSendScheduledMessagesBig() throws InterruptedException {

        TestHelper.threadTesting(5, () -> {
            for (int i = 0; i < 200; i++) {
                doSomething();
            }
        });
    }

    public void doSomething() throws InterruptedException {
        try (Jedis jedis = pool.getResource()) {
            lockPool.acquire();
            LOGGER.fatal("HI");
        } finally {
            LOGGER.fatal("BYE");
            lockPool.release();
        }
    }
}

Some log output:

2018-01-21 22:22:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:22:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:23:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:23:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:24:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:24:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:25:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:25:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:26:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:26:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:26:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:26:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:26:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:26:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:27:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:27:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:27:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:27:43 FATAL TestJedisHanging:35 - BYE
2018-01-21 22:28:43 FATAL TestJedisHanging:33 - HI
2018-01-21 22:28:43 FATAL TestJedisHanging:35 - BYE

In the test, I have 5 threads that run the simple function of acquiring the JedisLock, writing some log output, then releasing it.

I've observed that execution gets blocked for 1 minute intervals, before my lock/unlock function runs for a seemingly random number of times.

Do you have any idea why this might be happening?

@havenwang
Copy link
Author

I'm using jedis version 2.9.0.

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

No branches or pull requests

1 participant