Hi, thanks for maintaining pgx! I was testing some Go code that was reliant on pgxpool with Antithesis, and ran into the following error:
pgxpool: detected infinite loop acquiring connection; likely bug in PrepareConn or BeforeAcquire hook
This was confusing, because I hadn't set a PrepareConn / BeforeAcquire hook, but I went through the code and found this:
|
err := cr.conn.Ping(pingCtx) |
|
if err != nil { |
|
res.Destroy() |
|
continue |
|
} |
It seems that in the event of a network error, if all pings to Postgres fail, pgxpool throws a detected infinite loop error. Could the error message here be improved somehow - and would it be possible to use a sentinel error that can be caught and handled?
Hi, thanks for maintaining pgx! I was testing some Go code that was reliant on pgxpool with Antithesis, and ran into the following error:
This was confusing, because I hadn't set a PrepareConn / BeforeAcquire hook, but I went through the code and found this:
pgx/pgxpool/pool.go
Lines 630 to 634 in 4c1308c
It seems that in the event of a network error, if all pings to Postgres fail, pgxpool throws a
detected infinite looperror. Could the error message here be improved somehow - and would it be possible to use a sentinel error that can be caught and handled?