Skip to content

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