You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No error emitted on ungraceful db server shutdown #1113
When a database server goes down unnoticed, a single connected client will not emit any errors and continue living up to ~15 minutes until (in a specific case, 'EHOSTUNREACH') socket error is emitted. Setting keepAlive to true in client configuration does not have the desired effect, because the connection object sets _ending to true after sending off the first query (
I know this may not be of immediate help to yourself, but in general, this will help everybody...
Please try to replicate your test with pg-promise. If it doesn't happen, then we will know for sure that the issue is related to post - v.5.1.0 changes, related to the new connection pool, and if it does happen, well, then it is something else entirely.
I did a lot in that library to make sure the server disconnection is handled properly and gracefully, up till version 5.1.0 of the node-postgres driver.
Also see event error there that should get called when a disconnection happens, as per the API (see the example there).
I gave your library a try. When I took the database down during an uncommited transaction, I received the error 'Abnormal client.end() call, due to invalid code or failed server connection.' - thus, ungraceful disconnection handling seems to work well in pg-promise.
Now we know for sure the issue was introduced somehow with the new connection pool, after version 5.1.0
As for this error message: Abnormal client.end() call, due to invalid code or failed server connection., pg-promise throws it when the integrated pool is trying to release a dead connection, via a direct call client.end(), so the library simply reports it that way.
@brianc I have seen this issue more than once myself, when trying to upgrade pg-promise to use version 6.x of node-postgres.
At some point I had a fairly usable reproduction test, which then stopped working and I couldn't come up with reliable reproduction scenario ever since.
This should not stop us from trying. We need steps for reproducing the problem, for it is definitely there. And while it is there, I cannot upgrade pg-promise to 6.x of node-postgres. Restoring the database connection reliably is a very serious issue.
@riimeik - if you can't come up with code to reproduce the issue, will you let me know the exact steps you took to reproduce the issue locally? Maybe I can come up with a way to do the same thing in a test & reproduce what's going on. I'd like to get this fixed.
Activity
vitaly-t commentedon Aug 18, 2016
I know this may not be of immediate help to yourself, but in general, this will help everybody...
Please try to replicate your test with pg-promise. If it doesn't happen, then we will know for sure that the issue is related to post - v.5.1.0 changes, related to the new connection pool, and if it does happen, well, then it is something else entirely.
I did a lot in that library to make sure the server disconnection is handled properly and gracefully, up till version 5.1.0 of the
node-postgresdriver.Also see event error there that should get called when a disconnection happens, as per the API (see the example there).
simopahk commentedon Aug 18, 2016
I gave your library a try. When I took the database down during an uncommited transaction, I received the error 'Abnormal client.end() call, due to invalid code or failed server connection.' - thus, ungraceful disconnection handling seems to work well in pg-promise.
vitaly-t commentedon Aug 18, 2016
@riimeik thank you!
Now we know for sure the issue was introduced somehow with the new connection pool, after version 5.1.0
As for this error message:
Abnormal client.end() call, due to invalid code or failed server connection., pg-promise throws it when the integrated pool is trying to release a dead connection, via a direct callclient.end(), so the library simply reports it that way.vitaly-t commentedon Aug 19, 2016
@brianc I have seen this issue more than once myself, when trying to upgrade
pg-promiseto use version6.xofnode-postgres.At some point I had a fairly usable reproduction test, which then stopped working and I couldn't come up with reliable reproduction scenario ever since.
This should not stop us from trying. We need steps for reproducing the problem, for it is definitely there. And while it is there, I cannot upgrade
pg-promiseto6.xofnode-postgres. Restoring the database connection reliably is a very serious issue.brianc commentedon Aug 19, 2016
If you get it figured out I'd love a pull request with the fix! ❤️
vitaly-t commentedon Aug 19, 2016
@riimeik is there any chance you would take it one step further and create a reliable reproduction test for us? This would be much appreciated!
I myself have tried it twice, without success. I can only see it sometimes, unfortunately, not enough to suggest any fix.
brianc commentedon Aug 26, 2016
@riimeik - if you can't come up with code to reproduce the issue, will you let me know the exact steps you took to reproduce the issue locally? Maybe I can come up with a way to do the same thing in a test & reproduce what's going on. I'd like to get this fixed.
brianc commentedon Jun 12, 2017
@riimeik - I've fixed this issue in the most recent release of node-postgres. Sorry for the delay!