-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Cleanup all resources in RedisHealthIndicator #36304
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
To clarify, I don't thing Spring Boot (Actuator, and the |
Thanks, John, but I'm not sure I understand the problem. If an exception is thrown from
If
Have I overlooked something? Can you please clarify if I have. |
Hi Andy- Sorry. On second thought, I think you are correct. I have been bouncing back and forth between the user's problem (TCP connection leak) in the SD Redis ticket I referenced and what Spring Boot Actuator was doing inside the When I saw the connection acquisition outside the This could be the case during a failed TLS handshake, or even simple username/password auth, since the TCP Socket would still be opened and established to do the handshake, or auth. Even in this case, a certain amount of responsibility still falls on users to manage the system resources properly for their context and UC/Reqs (such as, configuring For clarification (and quick sanity check), there is no repeated process (e.g. Thread) inside Boot to run any of the So, outside of some syntactic sugar (and minimizing the scope of the
|
Correct. |
Uh oh!
There was an error while loading. Please reload this page.
This block of code in the Spring Boot Actuator,
RedisHealthIndicator
should be restructured as:Alternatively, this could be structured as:
If any kind of
RuntimeException
is thrown from theRedisConnectionFactory.getConnection()
method (indirectly via the Spring Data RedisRedisConnectionUtils.getConnection(:RedisConnectionFactory)
method, here then here), then there is a possibility that system resources may not get properly cleaned up (for instance, aSocket
is still allocated, even connected, but fails during a TLS handshake, or perhaps during username/password auth).A reference to a connection could be returned on line 49, but won't be released properly if the call throws an exception as it exists outside the
try-finally
block.All
RedisConnection
(s) areAutoCloseable
(Javadoc).This was uncovered during the analysis of Spring Data Redis Issue #2619.
The text was updated successfully, but these errors were encountered: