node-postgres: Breaking changes in 7.5.0
I’m still peeling through all the changes in 7.5.0, trying to understand which of them are breaking.
But as it stands, I haven’t been able to upgrade pg-promise
to version 7.5.0 of the driver, with about 35% of all my automated tests failing to even execute correctly.
I may be the first one reporting this, as I’m trying to keep my library up to date at all times, but I won’t be the last one. Expect the same to be reported from people using sequelize
, knex
, and other frameworks, or anybody else who relies on tests as comprehensive as within pg-promise
.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (7 by maintainers)
Commits related to this issue
- fix: pin pg to 7.4.3 as a temporary workaround for https://github.com/brianc/node-postgres/issues/1745 — committed to knorm/postgres by deleted user 6 years ago
- fix: instantly remove clients from the pool when released trying out the suggestion in https://github.com/brianc/node-postgres/issues/1745#issuecomment-427962815 in an attempt to fix "Client was clos... — committed to knorm/postgres by deleted user 5 years ago
- fix: pass query errors to client.release Ref discussion in https://github.com/brianc/node-postgres/issues/1745. This is an attempt to fix "Client was closed and is not queryable" errors. — committed to knorm/postgres by deleted user 5 years ago
- fix: pass query errors to client.release This is an attempt to fix "Client was closed and is not queryable" errors. Ref: https://github.com/brianc/node-postgres/issues/1745#issuecomment-469703239. — committed to knorm/postgres by deleted user 5 years ago
- fix: pass query errors to client.release This is an attempt to fix "Client was closed and is not queryable" errors. Ref: https://github.com/brianc/node-postgres/issues/1745#issuecomment-469703239. — committed to knorm/postgres by deleted user 5 years ago
- chore(release): 2.0.2 [skip ci] ## [2.0.2](https://github.com/knorm/postgres/compare/v2.0.1...v2.0.2) (2019-03-13) ### Bug Fixes * pass query errors to client.release ([035c5b5](https://github.com/... — committed to knorm/postgres by semantic-release-bot 5 years ago
- docs: fix erroneous changelog entry More: https://github.com/semantic-release/semantic-release/issues/1129 Also pinging https://github.com/brianc/node-postgres/issues/1745 so others might see it was ... — committed to knorm/postgres by deleted user 5 years ago
instead of calling
client.end
try callingclient.release(true)
- passing a truthy value torelease
will cause the pool to call.end
on the client and evict it from the pool. What you’re likely running into is calling.end
on a client and then returning it to the pool…the next time that client is checked out from the pool it’s already ended and wont run queries. I’m not sure how the code was working in the past as calling.end
on a client manually and returning it to the pool will eventually fill your pool with ended clients that likely wont ever send their queries. So the change in7.5
is surfacing an error that was already (I guess somewhat silently) happening.also, FWIW I don’t think closing a postgres connection in general will cancel a query while it’s running…but I might be wrong there. But, I remember running some extremely long queries from
psql
in the past and closingpsql
hoping the query would abort but it didn’t. Foggy memory at this point though.Glad to know things are settling down! Thanks for the updates. @joelmukuthu LMK if/when you find out what the issue turns out to be.
I have just updated pg-promise tests to use the freshly released pg-query-stream v1.1.2, and suddenly all the problems are gone. See #46.
As in turns out, somehow tests related to data streaming were causing total havoc within the test framework, and in such a way, I could not even diagnose it.
I am also relieved to know that there are indeed no breaking changes in
node-postgres
, and if you are running into any issues, it means your code wasn’t valid to begin with.@brianc Thank you for the follow up, and feel free closing the issue.
We saw some issues as well after upgrading to 7.5.0. It’s hard to track down exactly what causes them but it’s related to clients and connections. So far we see one of these errors crop up in one unit test and cause following tests to fail:
Pinning to 7.4.3 makes the errors go away
I can concur, something went sideways with this version. No details on my side either, just encountered a bunch of “Client was closed and is not queryable” in prod. Rolled back now and all is well. Came from 7.4.3. Will update if I get any more helpful details. FWIW worth my (limited) tests were fine, it was when it went to prod the issue came up 😕