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

CROSSSLOT error with Spring Oauth2 (version 2.3.0.RELEASE) [DATAREDIS-1154] #1727

Closed
spring-projects-issues opened this issue May 27, 2020 · 4 comments
Assignees
Labels
status: invalid An issue that we don't feel is valid

Comments

@spring-projects-issues
Copy link

Sunny Dhindsa opened DATAREDIS-1154 and commented

The fix for DATAREDIS-1142 didn't work for me as I am not using Spring reactive. After upgrading to the latest version of every library, I am still getting the cross slot error. See below for more information:

Dependencies (build.gradle):

springBootVersion = '2.3.0.RELEASE'

compile 'org.springframework.boot:spring-boot-starter-oauth2-client'
compile 'org.springframework.boot:spring-boot-starter-jdbc'
compile 'org.springframework.session:spring-session-jdbc'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.security:spring-security-ldap'
compile 'org.springframework.boot:spring-boot-starter-data-couchbase'
compile 'org.springframework.data:spring-data-redis'
compile 'org.springframework.session:spring-session-data-redis'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.springframework.data:spring-data-commons'
compile 'com.microsoft.azure:azure-active-directory-spring-boot-starter:2.3.0'

Creating a bean for the CONFIG error workaround:

@Bean
public static ConfigureRedisAction configureRedisAction() {
  // https://github.com/spring-projects/spring-session/issues/124
  return ConfigureRedisAction.NO_OP;
}

application.properties:

spring.session.store-type=redis
spring.redis.host=hostname
spring.redis.password=password
spring.redis.port=6380
spring.redis.ssl=true

I am not using the notation @EnableRedisHttpSession since the spring.session property above takes care of it.

Stacktrace:

org.springframework.dao.InvalidDataAccessApiUsageException: CROSSSLOT Keys in request don't hash to the same slot; nested exception is redis.clients.jedis.exceptions.JedisDataException: CROSSSLOT Keys in request don't hash to the same slot
	at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:69) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:42) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:135) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.connection.jedis.JedisKeyCommands.rename(JedisKeyCommands.java:284) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.connection.DefaultedRedisConnection.rename(DefaultedRedisConnection.java:131) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.core.RedisTemplate.lambda$rename$16(RedisTemplate.java:936) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:228) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.data.redis.core.RedisTemplate.rename(RedisTemplate.java:935) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.data.redis.RedisIndexedSessionRepository$RedisSession.saveChangeSessionId(RedisIndexedSessionRepository.java:831) ~[spring-session-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.data.redis.RedisIndexedSessionRepository$RedisSession.save(RedisIndexedSessionRepository.java:782) ~[spring-session-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.data.redis.RedisIndexedSessionRepository$RedisSession.access$000(RedisIndexedSessionRepository.java:670) ~[spring-session-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.data.redis.RedisIndexedSessionRepository.save(RedisIndexedSessionRepository.java:398) ~[spring-session-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.data.redis.RedisIndexedSessionRepository.save(RedisIndexedSessionRepository.java:249) ~[spring-session-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:225) ~[spring-session-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.access$100(SessionRepositoryFilter.java:192) ~[spring-session-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:144) ~[spring-session-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:82) ~[spring-session-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103) ~[spring-web-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:394) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:348) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:173) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_172]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_172]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.35.jar:9.0.35]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_172]
Caused by: redis.clients.jedis.exceptions.JedisDataException: CROSSSLOT Keys in request don't hash to the same slot
	at redis.clients.jedis.Protocol.processError(Protocol.java:132) ~[jedis-3.3.0.jar:na]
	at redis.clients.jedis.Protocol.process(Protocol.java:166) ~[jedis-3.3.0.jar:na]
	at redis.clients.jedis.Protocol.read(Protocol.java:220) ~[jedis-3.3.0.jar:na]
	at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:278) ~[jedis-3.3.0.jar:na]
	at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:196) ~[jedis-3.3.0.jar:na]
	at redis.clients.jedis.BinaryJedis.rename(BinaryJedis.java:437) ~[jedis-3.3.0.jar:na]
	at org.springframework.data.redis.connection.jedis.JedisKeyCommands.rename(JedisKeyCommands.java:282) ~[spring-data-redis-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	... 39 common frames omitted

No further details from DATAREDIS-1154

@spring-projects-issues
Copy link
Author

Sunny Dhindsa commented

With the debugger on and the above configuration, I noticed the configuration parameter in the below code in RedisConfiguration.java is always null:

static boolean isClusterConfiguration(@Nullable RedisConfiguration configuration) {
	return configuration instanceof ClusterConfiguration;
}

@spring-projects-issues
Copy link
Author

Mark Paluch commented

This is a configuration issue. Please configure spring.redis.cluster.nodes. See https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#data-properties for further reference

@spring-projects-issues
Copy link
Author

Andrea Como commented

Mark is right, you are using single node configuration connecting to a cluster

@spring-projects-issues
Copy link
Author

Mark Paluch commented

Closing this ticket as we cannot do here anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

2 participants