Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-961

leftPop("key", 3, TimeUnit.SECONDS) can not close properly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 2.0.14 (Kay SR14)
    • Fix Version/s: None
    • Component/s: Lettuce Driver
    • Labels:
      None
    • Environment:
      windows / linux

      Description

      *when a use this code to listen a redis list value *

      @PostConstruct
          public void init() {
              RateLimiter errorRate = RateLimiter.create(10);
              executorService
                      .submit(() -> {
                          for (; ; ) {
                              try {
                                  String key = stringRedisTemplate.opsForList().leftPop("key", 3, TimeUnit.SECONDS);
                                  if (key != null) {
                                      log.warn(key);
                                      rateLimiter.acquire();
                                  }
                                  log.info("nothing.... ");
                              } catch (Exception e) {
                                  errorRate.acquire();
                                  if (!(e instanceof RedisCommandTimeoutException || e instanceof QueryTimeoutException)) {
                                      log.error(e.getMessage(), e);
                                  } else {
                                      //ignore
                                  }
                              }
                          }
                      });
          }
      

      when i build this project this ` String key = stringRedisTemplate.opsForList().leftPop("key", 3, TimeUnit.SECONDS);` will be throw error and will not stop

      
      [2019-04-02 16:47:07] [insert-contact-th] [ERROR] [c.z.f.service.RedisMessageSubscriber] - Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379
      org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379
      	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:86)
      	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:957)
      	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:932)
      	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:785)
      	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:299)
      	at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:132)
      	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:95)
      	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:82)
      	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:211)
      	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:184)
      	at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:95)
      	at org.springframework.data.redis.core.DefaultListOperations.leftPop(DefaultListOperations.java:80)
      	at com.ziggle.fan.service.RedisMessageSubscriber.lambda$init$1(RedisMessageSubscriber.java:72)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379
      	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56)
      	at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:233)
      	at io.lettuce.core.RedisClient.connectStandalone(RedisClient.java:253)
      	at io.lettuce.core.RedisClient.connect(RedisClient.java:202)
      	at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:56)
      	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.lambda$null$0(LettucePoolingConnectionProvider.java:74)
      	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:225)
      	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:215)
      	at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:58)
      	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:889)
      	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:433)
      	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:362)
      	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:124)
      	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:120)
      	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:80)
      	... 16 common frames omitted
      Caused by: java.lang.IllegalStateException: executor not accepting a task
      	at io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:60)
      	at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:200)
      	at io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:49)
      	at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:188)
      	at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:174)
      	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
      	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)
      	at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)
      	at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:103)
      	at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
      	at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:978)
      	at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:512)
      	at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:423)
      	at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:482)
      	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
      	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
      	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
      	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
      	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      	... 1 common frames omitted
      [2019-04-02 16:47:07] [insert-contact-th] [ERROR] [c.z.f.service.RedisMessageSubscriber] - Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379
      org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379
      	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:86)
      	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:957)
      	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:932)
      	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:785)
      	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:299)
      	at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:132)
      	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:95)
      	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:82)
      	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:211)
      	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:184)
      	at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:95)
      	at org.springframework.data.redis.core.DefaultListOperations.leftPop(DefaultListOperations.java:80)
      	at com.ziggle.fan.service.RedisMessageSubscriber.lambda$init$1(RedisMessageSubscriber.java:72)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379
      	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56)
      	at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:233)
      	at io.lettuce.core.RedisClient.connectStandalone(RedisClient.java:253)
      	at io.lettuce.core.RedisClient.connect(RedisClient.java:202)
      	at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:56)
      	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.lambda$null$0(LettucePoolingConnectionProvider.java:74)
      	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:225)
      	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:215)
      	at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:58)
      	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:889)
      	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:433)
      	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:362)
      	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:124)
      	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:120)
      	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:80)
      	... 16 common frames omitted
      Caused by: java.lang.IllegalStateException: executor not accepting a task
      	at io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:60)
      	at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:200)
      	at io.netty.bootstrap.Bootstrap.doResolveAndConnect(Bootstrap.java:170)
      	at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:145)
      	at io.lettuce.core.AbstractRedisClient.initializeChannelAsync(AbstractRedisClient.java:267)
      	at io.lettuce.core.RedisClient.connectStatefulAsync(RedisClient.java:318)
      	at io.lettuce.core.RedisClient.connectStandaloneAsync(RedisClient.java:276)
      	at io.lettuce.core.RedisClient.connectStandalone(RedisClient.java:252)
      	... 28 common frames omitted
      

        Attachments

          Activity

            People

            • Assignee:
              mp911de Mark Paluch
              Reporter:
              ziggle ziggle
              Last updater:
              ziggle
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: