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

JedisCluster exception conversion produces NullPointerException on cache put operation [DATAREDIS-603] #1178

Closed
spring-projects-issues opened this issue Feb 15, 2017 · 1 comment

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Feb 15, 2017

Victor Lemeshev opened DATAREDIS-603 and commented

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?


Affects: 1.8 GA (Ingalls), 2.0 M3 (Kay)

Referenced from: pull request #275

Backported to: 1.8.8 (Ingalls SR8)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 6, 2017

Mark Paluch commented

Thanks for reporting the issue. The exception translator isn't meant for configuration/extension and would cause a heavy growth in constructors. We already have a couple of constructors on our connection classes. We'll fix the issue by falling back to RedisSystemException if we can't translate the driver exception

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

Successfully merging a pull request may close this issue.

None yet
2 participants