Redis-py Bug Caused False Max Capacity Errors in Async Cluster Connections
A bug in redis-py, the Python client for Redis, caused spurious MaxConnectionsError exceptions in asynchronous cluster setups despite connection capacity being available. The issue arose when a closed connection marked for reconnect was deferred to a background task, leaving a brief window where the pool appeared full to concurrent requests. During this single event-loop gap, any new acquire attempt would incorrectly find the free queue empty and the connection count at its limit. The fix, proposed in PR #4256 addressing issue #4247, ensures that already-closed connections skip the background disconnect task and immediately return their slot to the free pool. A deterministic regression test using asyncio.Event objects was also added to reproduce the exact race condition and verify the corrected behavior.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in