Skip to content

Fix redis connection leak#5711

Draft
aidbutlr wants to merge 2 commits into
IBM:mainfrom
aidbutlr:fix_redis_connection_leak
Draft

Fix redis connection leak#5711
aidbutlr wants to merge 2 commits into
IBM:mainfrom
aidbutlr:fix_redis_connection_leak

Conversation

@aidbutlr

Copy link
Copy Markdown

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

  • This PR has one clear purpose
  • The linked issue is not labeled triage
  • Unrelated bugs or improvements are tracked in separate issues/PRs
  • Tests are included with the code they validate
  • If AI-assisted, I understand and can explain the generated changes

🏷️ Type of Change

  • Bug fix
  • Feature / Enhancement
  • Documentation
  • Refactor
  • Chore (deps, CI, tooling)
  • Other (describe below)

🧪 Verification

List exact commands, screenshots, videos, logs, reproduction steps, or manual validation. If evidence is not feasible, explain why.

Check Command Status
Lint suite make lint
Unit tests make test
Coverage ≥ 80% make coverage

✅ Checklist

  • Code formatted (make black isort pre-commit)
  • Tests added/updated for changes
  • Documentation updated (if applicable)
  • No secrets or credentials committed

📓 Notes (optional)

Screenshots, design decisions, or additional context.

aidbutlr added 2 commits July 20, 2026 17:46
Signed-off-by: Aidan Butler <aidbutlr@ie.ibm.com>
Signed-off-by: Aidan Butler <aidbutlr@ie.ibm.com>
@aidbutlr
aidbutlr force-pushed the fix_redis_connection_leak branch from 0425545 to bdb9cba Compare July 20, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant