Skip to content

Virtual threads permanently blocking on JedisPool#getResource #3927

Open
@Brian1KB

Description

@Brian1KB

Expected behavior

Expecting for a Jedis object to be returned from the pool

Actual behavior

The getResource function permanently blocks

Steps to reproduce:

Call getResource at a high frequency, in a short period of time from a virtual thread per task executor. It is caused as a result of this issue that has had a PR filed under Apache Commons Pool, but I wanted to track the issue here in addition as it blocks Loom support until it is resolved. (apache/commons-pool#339)

      JedisPool jedisPool = new JedisPool();

      Executor executor = Executors.newVirtualThreadPerTaskExecutor();

      for (int i = 0; i < 1000; i++)
      {
          executor.execute(() ->
          {
              System.out.println("Attempting to getResource");

              try (Jedis instance = jedisPool.getResource())
              {
                  System.out.println("Acquired resource");
                  
                  instance.ping();
              }
          });
      }

Acquired resource will never print.

Redis / Jedis Configuration

Jedis version:

5.2.0-SNAPSHOT (latest build of 5.2.0 branch)

Redis version:

unrelated

Java version:

Eclipse Adoptium jdk-21.0.0.35-hotspot

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull request that updates a dependencytracking-issueAn issue container, effectively an epic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions