spring-integration: Connection failures and application hangs with RedisLockRegistry since Spring Boot upgrade
In what version(s) of Spring Integration are you seeing this issue?
5.5.11
Describe the bug
We’ve just recently updated Spring Boot from 2.5.5 to 2.5.13 (so basically upgrade from 5.5.4 to 5.5.11). Immediately we received constant connection failure logs:
ERROR 7 --- [lock-registry-1] o.s.d.r.l.RedisMessageListenerContainer : Connection failure occurred. Restarting subscription task after 5000 ms
The application also randomly hangs for multiple seconds.
We are using RedisLockRegistry with a ElastiCache Redis (6.0.5) in Primary/Replica mode. For RedisLockRegistry we only connect to the primary.
Our configuration is basically this:
@Bean
fun redisConnectionFactory(
builderCustomizers: ObjectProvider<LettuceClientConfigurationBuilderCustomizer>,
clientResources: ClientResources
): LettuceConnectionFactory {
val clientConfig = getLettuceClientConfiguration(builderCustomizers, clientResources, redisProperties.lettuce.pool)
val config = RedisStaticMasterReplicaConfiguration(
redisProperties.host,
redisProperties.port
)
config.username = redisProperties.username
config.password = RedisPassword.of(redisProperties.password)
config.database = redisProperties.database
return LettuceConnectionFactory(config, clientConfig)
}
@Bean
fun lockRegistry(
redisConnectionFactory: RedisConnectionFactory
): ExpirableLockRegistry = RedisLockRegistry(
redisConnectionFactory,
"exampleService",
120_000
)
We had to downgrade back to 2.5.5 to fix the issues for now
To Reproduce
Not sure
Expected behavior
No hangs / error logs
Sample
Not sure how to show
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- GH-3805: Change to select between spinLock method and pub-sub method — committed to Meteorkor/spring-integration by Meteorkor 2 years ago
- GH-3805: fix javadoc, convention, lazy init — committed to Meteorkor/spring-integration by Meteorkor 2 years ago
- GH-3805: fix javadoc, convention — committed to Meteorkor/spring-integration by Meteorkor 2 years ago
- GH-3805: Remove unnecessary annotations — committed to Meteorkor/spring-integration by Meteorkor 2 years ago
- GH-3805: Introduce RedisLockRegistry.RedisLockType mode Fixes https://github.com/spring-projects/spring-integration/issues/3805 The Redis Pub-Sub doesn't work in all the environment, therefore there... — committed to spring-projects/spring-integration by Meteorkor 2 years ago
- GH-3805: Introduce RedisLockRegistry.RedisLockType mode Fixes https://github.com/spring-projects/spring-integration/issues/3805 The Redis Pub-Sub doesn't work in all the environment, therefore there... — committed to spring-projects/spring-integration by Meteorkor 2 years ago
No, I couldn’t test because I couldn’t build an environment that can configure RedisStaticMasterReplicaConfiguration.
Perhaps as hameno said, pub/sub doesn’t seem to work in RedisStaticMasterReplicaConfiguration.
I just wanted to say that there was no problem with pub/sub operation in RedisClusterConfiguration as well as RedisStandaloneConfiguration. (I thought that there were rather few environments where pub/sub could not be used)
As you said, it would be good to make it work with spinLock method.
I think it would be better to support the operation without pub/sub as part of the environment where pub/sub cannot be used(spinLock=true).