Skip to content

Fix ConnectionPool.get() race condition#15

Merged
merlimat merged 1 commit intooxia-db:mainfrom
merlimat:fix/bug-2-connection-pool
Apr 16, 2026
Merged

Fix ConnectionPool.get() race condition#15
merlimat merged 1 commit intooxia-db:mainfrom
merlimat:fix/bug-2-connection-pool

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

get() had no locking — concurrent callers could both miss the cache and create duplicate gRPC channels, leaking all but one. close() didn't clear the pool either.

Fix: wrap get() and close() with a threading.Lock. close() now clears the connections dict.

ConnectionPool.get() had no locking — concurrent callers could both
see a cache miss and create duplicate gRPC channels, leaking all but
one. close() also did not clear the pool, allowing stale stubs to be
returned after close.

Fix: wrap get() and close() with a threading.Lock. close() now clears
the connections dict after closing channels.

Signed-off-by: Matteo Merli <mmerli@apache.org>
@merlimat merlimat merged commit 05f3a4b into oxia-db:main Apr 16, 2026
6 checks passed
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