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

JedisCluster exception conversion produces NullPointerException on cache put operation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8 GA (Ingalls), 2.0 M3 (Kay)
    • Component/s: Jedis Driver
    • Labels:
      None
    • Environment:
      spring-data-redis:1.8.0.RELEASE
      Redis version 3.2.6
      Cluster of 3 nodes

      Description

      We were stress-testing our code and encountered following issue: JedisClusterConnection employs EXCEPTION_TRANSLATION (which is private static final) of PassThroughExceptionTranslationStrategy that returns null for unknown-to-converter messages. This leads to following error:

      java.lang.NullPointerException
          at org.springframework.data.redis.connection.jedis.JedisClusterConnection.set(JedisClusterConnection.java:635)
              3 lines skipped for [sun., java.lang.reflect.Method]
          at org.springframework.data.redis.core.CloseSuppressingInvocationHandler.invoke(CloseSuppressingInvocationHandler.java:57)
              1 line skipped for [com.sun]
          at org.springframework.data.redis.cache.RedisCache$RedisCachePutCallback.doInRedis(RedisCache.java:788)
          at org.springframework.data.redis.cache.RedisCache$RedisCachePutCallback.doInRedis(RedisCache.java:767)
          at org.springframework.data.redis.cache.RedisCache$AbstractRedisCacheCallback.doInRedis(RedisCache.java:565)
          at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:207)
          at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:169)
          at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:157)
          at org.springframework.data.redis.cache.RedisCache.put(RedisCache.java:226)
          at org.springframework.data.redis.cache.RedisCache.put(RedisCache.java:194)
          at org.springframework.cache.interceptor.AbstractCacheInvoker.doPut(AbstractCacheInvoker.java:85)
          at org.springframework.cache.interceptor.CacheAspectSupport$CachePutRequest.apply(CacheAspectSupport.java:784)
          at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:417)
          at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:327)
          at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
          at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
      

      because convertJedisAccessException(ex) returns null in following code (from JedisClusterConnection class):

      	@Override
      	public void set(byte[] key, byte[] value) {
      
      		try {
      			cluster.set(key, value);
      		} catch (Exception ex) {
      			throw convertJedisAccessException(ex); // null is thrown here
      		}
      	}
      

      The result is - we lose exception information from Jedis and cannot even fix the root cause of Jedis exception (which we are yet to find). Since the issue only manifests itself under load debugging is not an option here.

      Could you change EXCEPTION_TRANSLATION to FallbackExceptionTranslationStrategy for JedisClusterConnection or provide means of replacing one via configuration?

        Attachments

          Activity

            People

            Assignee:
            mp911de Mark Paluch
            Reporter:
            lemvic Victor Lemeshev
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: