IssueRaiser

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

reliability (Housing)

Bug: Connection terminated unexpectedly (postgres)

rmsxnNov 7, 2019, 12:26 AM

**[EDIT] Please also check #3636 which has valuable discussions on the same issue** # Environment Knex version: 0.20.1 Database + version: postgres:11.5 OS: Alpine Linux Additional information: - Database: I've confirmed the bug to happen in *postgres* versions at least up from `9.5`. The database is running on a container, currently [`postgres:11.5`](https://hub.docker.com/_/postgres). - Knex environment: Knex is currently running on node v12, though I've confirmed the bug to happen on v8 and v10 too. It's running on a container, currently [`node:12.13.0-alpine`](https://hub.docker.com/_/node). The current `pg` version is 7.12.1; though I've seen this happen with previous versions, I haven't documented this bit. - Knex configuration object: ``` ({ client: 'pg', connection: 'postgres://user:password@server:5432/db', pool: { min: 2, max: 10 } }) ``` # Bug I am getting a `Connection terminated unexpectedly` error in production, after long periods of inactivity (think +1h) during which no queries are made, causing the first query after that period to fail. Any query made after that first failing query will succeed. This was first reported on issue #3258. In that issue, it was reported happening on knex 0.16.5, so this has been going on at least since then. It was also stated that a downgrade to 0.13.0 fixes the issue, which met the suggestion that maybe newer knex versions logged the error while previous ones didn't. I've confirmed this **not** to be the case. Downgr

Comments (0)

No comments yet. Start the discussion.

Comment on this issue