Skip to content

JedisConnectionFactory failed to get connection after configuration auto update #2553

@Jiabao-Sun

Description

@Jiabao-Sun

Error Trace:

java.lang.IllegalStateException: JedisConnectionFactory was destroyed and cannot be used anymore## at org.springframework.util.Assert.state(Assert.java:76) ~[spring-core-5.3.23.jar!/:5.3.23]## at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.assertInitialized(JedisConnectionFactory.java:971) ~[spring-data-redis-2.7.3.jar!/:2.7.3]## at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:509) ~[spring-data-redis-2.7.3.jar!/:2.7.3]## at org.springframework.data.redis.core.RedisConnectionUtils.fetchConnection(RedisConnectionUtils.java:193) ~[spring-data-redis-2.7.3.jar!/:2.7.3]## at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:144)

We receive EnvironmentChangeEvent in the configuration hot update scenario.
The ConfigurationPropertiesRebinder will destroy and reinitialize JedisConnectionFactory.

image

In destroy method we set the destroyed flag as true.
image

But in initial method (afterPropertiesSet) we don't reset destroyed as false.
image

This will cause us to be unable to get a connection from the JedisConnectionFactory any more.
image

Metadata

Metadata

Assignees

Labels

in: coreIssues in core supportin: jedisJedis driverstatus: declinedA suggestion or change that we don't feel we should currently applystatus: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions