-
Notifications
You must be signed in to change notification settings - Fork 1.2k
JedisConnectionFactory failed to get connection after configuration auto update #2553
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
Comments
@Jiabao-Sun - This logic in Spring Data Redis may actually be by design and it could be the
I observed these assertions (and specifically, this assertion) in the Spring Data Redis codebase, which also originates in the In fact, it may not be "safe" to reacquire connections from a "closed" factory (Jedis or Lettuce), which I suppose would highly depend on the Redis (client) driver specifically (using either Jedis or Lettuce), given there could be lingering, stale state. It really depends on the drivers, actually and technically. The real question is, why is this In most case, with most stores (that don't offer some type of (connection) failover, particularly in a distributed, clustered topology arrangement), then the safest approach it to restart the (Spring) application, which will reinitialize the connection pool between a fresh JVM process and the Redis server(s). |
Is this It does not originate in either Spring Data Redis or Spring Boot. I am curious where this class comes from? |
Thinking further on this... You'd be better off "refreshing" (Javadoc) the Spring container ( Of course, refreshing the Spring Furthermore, you have control over declaring and constructing/initializing the That is even a requirement when initializing your Spring Data Redis application in the first place. See ref doc in general, and using the In other words, you must create a Spring managed bean of type In which case, you could extend the If you use this later approach, then you assume full responsibility of the extensions and behavioral override. This does not fall on Spring Data Redis since this is very application use case specific. If you concerned about application refresh/restart times, then you can explore Spring Native Image support. FYI, Spring is eventually doing to support CRaC, which is alternative to GraalVM Native, Images, and may be of interests to your application use case. |
Error Trace:
We receive
EnvironmentChangeEvent
in the configuration hot update scenario.The
ConfigurationPropertiesRebinder
will destroy and reinitializeJedisConnectionFactory
.In destroy method we set the destroyed flag as true.

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

This will cause us to be unable to get a connection from the

JedisConnectionFactory
any more.The text was updated successfully, but these errors were encountered: