PgDog version
v0.1.49, v0.1.51 & main
Description
When running Elixir's Postgrex and using its mode: :savepoint feature, Elixir side times out while PgDog side leaves the connection in a wait_event='ClientRead' transaction.
Here's the simplest repro, you can run it with elixir repro.exs:
Mix.install([{:postgrex, "~> 0.19"}])
{:ok, conn} =
Postgrex.start_link(
hostname: "127.0.0.1",
port: 6432,
username: "postgres",
password: "postgres",
database: "postgres"
)
result =
Postgrex.transaction(
conn,
fn c -> Postgrex.query(c, "SELECT 1/0", [], mode: :savepoint) end,
timeout: 5_000
)
dbg(result)
then verify the hanging transaction:
SELECT pid, state, wait_event, query FROM pg_stat_activity WHERE wait_event = 'ClientRead'
Postgrex is doing
Query("BEGIN")
Query("SAVEPOINT postgrex_query")
Bind
Execute
Query("RELEASE SAVEPOINT postgrex_query")
it doesn't do Sync, which seems to be what trips PgDog here, as ErrorResponse handling re-queues ReadyForQuery regardless if Sync was sent. Best I can tell, what Postgrex does is unique but legal.
Logs
pgdog-trace-full.log
Configuration
The example Docker compose configuration from the repo. Tested in both sharded and unsharded modes just in case.
PgDog version
v0.1.49,v0.1.51&mainDescription
When running Elixir's Postgrex and using its
mode: :savepointfeature, Elixir side times out while PgDog side leaves the connection in await_event='ClientRead'transaction.Here's the simplest repro, you can run it with
elixir repro.exs:then verify the hanging transaction:
Postgrex is doing
it doesn't do
Sync, which seems to be what trips PgDog here, asErrorResponsehandling re-queuesReadyForQueryregardless ifSyncwas sent. Best I can tell, what Postgrex does is unique but legal.Logs
pgdog-trace-full.log
Configuration
The example Docker compose configuration from the repo. Tested in both sharded and unsharded modes just in case.