Merged
Conversation
- Remove blanket pool invalidation from SqlDriver.execute_query() error handler - Pool connections are managed by psycopg_pool which handles broken connections internally - Blindly invalidating the pool on every error races with concurrent in-flight queries - Update test to reflect corrected behavior: query errors no longer invalidate pool
… closed' errors When multiple MCP tool calls arrive simultaneously, concurrent coroutines could all see the pool as invalid and enter pool_connect(), each closing the pool the previous caller just created. This cascaded into repeated 'the pool pool-N is closed' and 'NoneType has no attribute connection' errors. Add asyncio.Lock with double-checked locking to both DbConnPool.pool_connect() and DatabaseService.get_sql_driver() so only one coroutine creates the pool while others wait and reuse it. Also reset db_connection to None on failed connection attempts to allow proper retry.
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.
No description provided.