-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: end stream on Connection.end() #1608
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
Conversation
Great work @Vratislav LGTM |
Looks good @Vratislav 👍 |
:LGTM: We have the same problem too - #1627. |
ah nice! sorry for the delay on this. Will merge & push a new version today. |
Not sure if this is too much to ask, but would it be possible to also provide a version bump for 6.x.x? Unfortunately, we also use sequelize which does not support > [email protected], so we will be using a fork with the fix in the meantime. Many thanks! |
I am getting intermittent SequelizeDatabaseError: read ETIMEDOUT with Azure postgres databases while not getting that error when connected to an RDS database. I'm not sure if this ticket correlates with the issue we are having. We are on [email protected] and I'm curious whats the latest v6 version I can upgrade to see if this fix improves things? I don't see the fix in the version tagged 6.4.2. Full stack trace:
|
We are having issues with both
pg 6.4.2
andpg 7.4.1
when disconnecting from Azure Postgres managed database. The socket never gets closed. I am able to replicate it with this simple script:(excuse my TypeScript)
The socket always stays hanging as can be verified by:
When looking through official postgres documentation, the following passage about the connection termination can be found:
The normal, graceful termination procedure is that the frontend sends a Terminate message and immediately closes the connection. On receipt of this message, the backend closes the connection and terminates.
(taken from https://www.postgresql.org/docs/9.6/static/protocol-flow.html#AEN113373)
It seems that Azure postgres is really waiting for the client to close the connection first, otherwise it won't close the socket.
This PR adds a
this.stream.end()
after the termination message has been sent to the SQL server. This resolves our issue with Azure.If needed I can provide instance of Microsoft Azure Postgres for replication and testing.
Also, since we are running on
v6.4.2
in combination with sequelize, I can also offer this fix for the 6.x.x branch:v6.4.2...Vratislav:end-stream