Skip to content

Fix of pool leaking by TCP-keepalive #918

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

Merged
merged 6 commits into from
Jun 21, 2016

Conversation

NumminorihSF
Copy link
Contributor

There is some bug with connection pool.
To reproduce it - you need connect to postgresql, start request and kill db process by kill -9. Client will not be free on any time.

To fix this, we can add heartbeat to client connection (#913) or add TCP-keepalive.

I have tested it. On TCP-socket close it return error to client#query callback function. I think, that it is the best resolve of this problem.

P.S. Please, if you will merge one of my PR - close another one.

@brianc
Copy link
Owner

brianc commented Jun 21, 2016

@NumminorihSF sorry for missing this! This definitely looks like a solid approach. I'll go ahead & merge this & close the other pull request! In order to make this backwards compatible I'm going to add this as a config option to the client:

var client = new Client({
  keepAlive: true
})

It will default to false and only alter current behavior if set to true.

@brianc brianc merged commit ad65c7b into brianc:master Jun 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants