fix(pool): reject queued requests on end#4291
Open
gilboom wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4291 +/- ##
=======================================
Coverage 91.00% 91.00%
=======================================
Files 90 90
Lines 14521 14525 +4
Branches 1868 1871 +3
=======================================
+ Hits 13215 13219 +4
Misses 1306 1306
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
What changed
Reject connection requests that are already queued in
BasePool._connectionQueuewhenpool.end()closes the pool.Why
When a promise pool is saturated and additional
pool.query()calls are waiting for a connection, callingpool.end()marks the pool as closed and closes the active connections, but the queued callbacks are never invoked. The promise wrappers for those queued queries can stay pending forever.This makes queued requests behave consistently with new
getConnection()calls after pool closure, which already receivePool is closed..Validation
pool.end(), and asserts the queued queries reject withPool is closed.instead of timing out.timed out waiting for queued queries to settle; queue length=2.CI=1 MYSQL_PASSWORD=root MYSQL_DATABASE=mysql node --import tsx test/integration/test-pool-end.test.mtsnpm run lint