-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
client.end() no longer releases connection back into pool in v5.2.1 #1414
Comments
Hmmm I see - removing that behavior was an accidental backwards compatibility break between 5.1.0 and 5.2.0 that happened a long time ago. Looking at FWIW if you want to remove a client from the pool in newer versions the recommended way to do so is by passing a truthy value to the https://node-postgres.com/api/pool#release-err-error- The thinking is that you shouldn't call |
Calling If you’re unable to fix this and the potential vulnerability patched in 5.2.1 doesn’t affect you, stay on 5.1.0. |
@charmander I agree it breaks encapsulation in a way if you call My main concern going forward is I think right now if you do that in the most recent version of |
@brianc If brianc/node-pg-pool#50 is implemented with some sort of |
The standard way of handling this in Java/JDBC is to override the The proxy approach also has the advantage of providing a place to catch use-after-close situations. The proxy can maintain an internal state object and if marked as "CLOSED" then any invocations of The only downside is a bit more object creation (one more per checked out connection) and an extra function call for the indirection (i.e. app calls proxy, proxy calls real function on raw connection). Compared to the time it takes to execute a roundtrip a query to a DB I think it'd be insignificant. So with this approach the "close" method would be called |
Moving this to a new issue to keep things neat, as the original is addressed:
It never did that, and it just breaks differently between 5.1.0 and 5.2.0. |
The previous latest 5.x version was 5.1.0 which used an internal pool object (here's a diff). In 5.2.1, which was released a few days ago, this was replaced with pg-pool.
Here's a test which you can run on 5.1.0 and it passes, but it fails if on 5.2.1 where it will never end because the
pg.connect
callback isn't called after 10 connections have been opened:If I instead of
client.end()
calldone()
, then it works as expected. But callingclient.end()
used to work before the v5.2.1 release.The text was updated successfully, but these errors were encountered: