Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 53
FIX: Release GIL during blocking ODBC connect/disconnect calls#497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Saurabh Singh (saurabh500)
merged 10 commits into
main
from
dev/saurabh/gilduringconnectApr 15, 2026
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3fa8931
Release GIL during blocking ODBC connect/disconnect calls
saurabh500 47c61cf
Format code with black --line-length=100
saurabh500 83995e4
Add test for pool release overflow path (coverage lines 107-110)
saurabh500 60642be
Address review comments: error handling, pool accounting, test fix
saurabh500 def8f2c
Fix disconnect perf test: verify correctness not speedup ratio
saurabh500 b753411
Merge branch 'main' into dev/saurabh/gilduringconnect
saurabh500 d09dfd6
Remove unsafe LOG() call in destructor/shutdown disconnect path
saurabh500 b0eddec
Merge branch 'main' into dev/saurabh/gilduringconnect
saurabh500 9a9eb30
Merge branch 'main' into dev/saurabh/gilduringconnect
saurabh500 2a14a74
Merge branch 'main' into dev/saurabh/gilduringconnect
saurabh500 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -278,6 +278,42 @@ def try_overflow(): | ||
| c.close() | ||
| def test_pool_release_overflow_disconnects_outside_mutex(conn_str): | ||
| """Test that releasing a connection when pool is full disconnects it correctly. | ||
| When a connection is returned to a pool that is already at max_size, | ||
| the connection must be disconnected. This exercises the overflow path in | ||
| ConnectionPool::release() (connection_pool.cpp) where should_disconnect | ||
| is set and disconnect happens outside the mutex. | ||
| With the current pool semantics, max_size limits total concurrent | ||
| connections, so we acquire two connections with max_size=2, then shrink | ||
| the pool to max_size=1 before returning them. The second close hits | ||
| the overflow path. | ||
| """ | ||
| pooling(max_size=2, idle_timeout=30) | ||
| conn1 = connect(conn_str) | ||
| conn2 = connect(conn_str) | ||
| # Shrink idle capacity so first close fills the pool and second overflows | ||
| pooling(max_size=1, idle_timeout=30) | ||
| # Close conn1 — returned to the pool (pool now has 1 idle entry) | ||
| conn1.close() | ||
| # Close conn2 — pool is full (1 idle already), so this connection | ||
| # must be disconnected rather than pooled (overflow path). | ||
| conn2.close() | ||
| # Verify the pool is still functional | ||
saurabh500 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| conn3 = connect(conn_str) | ||
| cursor = conn3.cursor() | ||
| cursor.execute("SELECT 1") | ||
| assert cursor.fetchone()[0] == 1 | ||
| conn3.close() | ||
| @pytest.mark.skip("Flaky test - idle timeout behavior needs investigation") | ||
| def test_pool_idle_timeout_removes_connections(conn_str): | ||
| """Test that idle_timeout removes connections from the pool after the timeout.""" | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.