Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

pool.end() does not return a proper promise #96

Open
simopahk opened this issue Feb 15, 2018 · 0 comments
Open

pool.end() does not return a proper promise #96

simopahk opened this issue Feb 15, 2018 · 0 comments

Comments

@simopahk
Copy link

I encountered an issue in my software wherein connections would be left open, thus reaching the PostgreSQL connection limit for that user after a few runs.

My code basically did this:

  1. open a VPN connection;
  2. connect to a database, fetch data;
  3. terminate the pool (wait for the returned promise);
  4. close the VPN connection.

As it turned out, pg-pool was unable to properly terminate idle connections, because the VPN tunnel was closed before necessary signals could be sent. I could solve the issue by waiting an extra second between points 3) and 4), so I suspect the issue lies on these lines: 91 and 135. Namely, client.end() returns a promise that resolves only once it receives the 'end' signal, but this promise is not forwarded to _pulseQueue(), which reports the pool as properly closed as soon as it simply requests the closing of all idle connections.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant