You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing some data race issues when moving from pgx/v4 to pgx/v5.
For context, I am using a wrapper that will allow me to init a connection pool to a postgres database via pgx with some default values using pgxpool.ConnectConfig (v4) and now pgxpool.NewWithConfig (v5). And the test cases for said wrapper are failing when run with -race, which do not happen in pgx/v4. For most of these test cases, I will create a new pgxpool and close it for each subtest. I can't share it here, but this is an example I rewrote without using the wrapper, and it runs into the same issue. I'm using dockertest with postgres 14 image.
Otherwise, if many constructors are underway while the pool is closed it
is possible destructWG will get to 0 while the Wait in Close is underway
and then Add will be called again which is disallowed.
From the docs:
Note that calls with a positive delta that occur when the counter is
zero must happen before a Wait.
jackc/pgx#1356
Otherwise, if many constructors are underway while the pool is closed it
is possible destructWG will get to 0 while the Wait in Close is underway
and then Add will be called again which is disallowed.
From the docs:
Note that calls with a positive delta that occur when the counter is
zero must happen before a Wait.
jackc/pgx#1356
Uh oh!
There was an error while loading. Please reload this page.
I am facing some data race issues when moving from
pgx/v4
topgx/v5
.For context, I am using a wrapper that will allow me to init a connection pool to a postgres database via pgx with some default values using
pgxpool.ConnectConfig
(v4) and nowpgxpool.NewWithConfig
(v5). And the test cases for said wrapper are failing when run with -race, which do not happen inpgx/v4
. For most of these test cases, I will create a new pgxpool and close it for each subtest. I can't share it here, but this is an example I rewrote without using the wrapper, and it runs into the same issue. I'm using dockertest with postgres 14 image.When running this test with the -race flag, e.g.
go test ./... -race
I sometimes get data race:Version
go version go1.19.2 darwin/arm64
github.com/jackc/pgx/v5 v5.0.4
The text was updated successfully, but these errors were encountered: