Fix redis connection leak#5711
Draft
aidbutlr wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Aidan Butler <aidbutlr@ie.ibm.com>
Signed-off-by: Aidan Butler <aidbutlr@ie.ibm.com>
aidbutlr
force-pushed
the
fix_redis_connection_leak
branch
from
July 20, 2026 16:47
0425545 to
bdb9cba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The redis.pubsub is not closing the connection to redis. This can consume all of the connections in the redis connection pool over time. Adding the async with client.pubsub() as pubsub will cause aclose to be called on exit.
Pull Request
🔗 Related Issue
Closes #
📝 Summary
The _plugin_invalidation_listener() function runs a long-lived loop that subscribes to a Redis pub/sub channel. Each iteration calls client.pubsub(), which acquires a dedicated connection from the shared pool (max_connections=50). When the iteration fails for any reason — network error, timeout, or Redis blip — the exception handler immediately slept and restarted the loop without ever calling pubsub.aclose().
📏 Reviewability
triage🏷️ Type of Change
🧪 Verification
List exact commands, screenshots, videos, logs, reproduction steps, or manual validation. If evidence is not feasible, explain why.
make lintmake testmake coverage✅ Checklist
make black isort pre-commit)📓 Notes (optional)
Screenshots, design decisions, or additional context.