Repository navigation
fix(db): one connect attempt per pooled connection, one reconnect per dropped slot (#1214) - #1220
Merged
Merged
Conversation
… dropped slot (#1214) Two callers that arrived while a pooled connection was connecting each opened a socket and an SSH tunnel; the later assignment won and the earlier ones leaked, and a failing attempt cleared the session the other attempt had made. connect() now shares the attempt in progress (PostgreSQL and MySQL). The pools share one reconnect for a dropped slot, so the session setting runs once.
Grid scroll benchmark
Informational only (threshold 5%). Shared CI runners are noisy; re-run before trusting a single result. |
3 tasks
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.
Refs #1214
What was wrong
connect()on a pooled PostgreSQL or MySQL connection was not guarded. Two callers arriving during an attempt each opened a socket and an SSH tunnel; the later assignment won and the earlier ones leaked, and a failing attempt cleared the session the other one had made.Changes
connect()shares the attempt in progress: a second caller awaits the same future. The attempt itself is the former body, now_connectOnce. PostgreSQL and MySQL._reconnect, which shares one reconnect and onesetSessionReadOnlybetween concurrent callers.Not in this PR
connect()calls on one connection open one socket and one tunnel. That needs a seam to replace the socket open; the pool tests do not reach it.forceCloseduring an attempt still sets the connection state from the attempt that finishes later. That was already so and is not part of this issue.Not verified locally
Tests were not run locally, per the project rule.