Open Sytten opened 3 years ago
Possibly a duplicate of #835.
Thanks for linking issues! @Lekensteyn The answer to it is not super great though: move to pgx :/
Hey @Sytten, can you share which pq version you are running? Is the Postgres connection secured with TLS?
For some reason I am using an old version (1.7.0), unsure why goland resolved to that (most likely I already had it downloaded). I will try with a more recent version, thanks a LOT for that.
I still have issue with the latest version, either driver: bad connection
or read: connection reset by peer
.
Setup
I am using a serverless setup on GCP Cloud Run (knative) with a database in VPC accessed via a serverless connector. This is a similar to a setup where a server communicates with a database behind an HAProxy or an NGINX. The only difference is that if the server is not receiving requests, its CPU is heavily throttled.
Problem
I started receiving errors like:
Where
10.1.0.2
is the database, that tells me that most likely the connection to the proxy was maintained but the connection to the host was killed. I would expectpq
to be able to detect that, kill the connection and retry on a new one. But it seems it is not the case and the pool will happily continue using the connection even if it is effectively dead.This is patchable with a
SetConnMaxIdleTime
orSetConnMaxLifetime
, but I feel a network error like that should be able to detected and acted upon directly.