Repository navigation
fix(pg-pool): finish requests waiting for a client when the pool ends - #3854
Open
efeesrefinal wants to merge 1 commit into
Open
efeesrefinal wants to merge 1 commit into
efeesrefinal wants to merge 1 commit into
Conversation
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.
A
pool.query()orpool.connect()waiting in the queue never settles ifpool.end()is called, andend()still resolves. Once the pool is ending a released client is removed and_pulseQueuereturns early, so the queue is never read. This was reported in #3819, which its author closed without a fix.Requests queued before
end()now run, in line with the existing testpool.end() - finish pending queries, and the clients are removed once the queue is empty. New checkouts during the drain are still rejected. #3750, a draft, does this too as part of reusing a pool. This is only the fix for the hang, if that helps.Added a test to
ending.jsthat times out without the change. On PostgreSQL 16 and Node 22 the pg-pool tests give 88 passed and 1 failed. The failure is a test that needs pg-native, which I didn't build, and it fails the same way without the change. I did not run thepgpackage tests.