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

Most upvoted comments

Does it mean that this even works with the mentioned ElastiCache Redis regardless of the not on the >RedisStaticMasterReplicaConfiguration:

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).