lettuce-core: NoSuchElementException: Pool exhausted when starting app

Bug Report

Current Behavior

Stack trace
Caused by: java.util.NoSuchElementException: Pool exhausted
  at io.lettuce.core.support.BoundedAsyncPool.acquire()(Unknown Source)

Input Code

Input Code
 client = RedisClient.create();
        client.setOptions(
            ClientOptions.builder()
                .autoReconnect(true)
                .cancelCommandsOnReconnectFailure(true)
                .requestQueueSize(1024 * Runtime.getRuntime().availableProcessors())
                .build());
        final RedisURI redisURI = RedisURI.builder()
            .withHost(redisAddr)
            .withPort(6379) //默认值
            .withPassword(redisPassword)
            .build();

        pool = AsyncConnectionPoolSupport.createBoundedObjectPool(
            () -> client.connectAsync(StringCodec.UTF8, redisURI),
            //默认8个连接
            //refs:https://github.com/lettuce-io/lettuce-core/issues/1363
            BoundedPoolConfig.builder()
                .maxTotal(Runtime.getRuntime().availableProcessors() * 2)
                .minIdle(Runtime.getRuntime().availableProcessors())
                .build());
        final String pong = pool.acquire().get().sync().ping();

Expected behavior/code

Environment

    <lettuce.version>5.3.4.RELEASE</lettuce.version>

Possible Solution

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

I think I let that to @mp911de answer that but I put a random 10 😃