Re: BUG #16016: deadlock with startup process, AccessExclusiveLock on pg_statistic's toast table

From: Sergei Kornilov <sk(at)zsrv(dot)org>
To: "alexey(dot)ermakov(at)dataegret(dot)com" <alexey(dot)ermakov(at)dataegret(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16016: deadlock with startup process, AccessExclusiveLock on pg_statistic's toast table
Date: 2019-09-20 15:00:00
Message-ID: 158201568991600@myt5-2a1eccb4c218.qloud-c.yandex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

Seems I have testcase for this report:

primary + streaming replica with such settings:
log_lock_waits = 'on'
max_standby_streaming_delay = '-1'
fsync = off
synchronous_commit = off
(seems this is rare race condition and I can't catch on slow fsync)

Create some table for queries:
create table tablename as select generate_series(1,100) as i;

Run on primary:
pgbench -f primary.sql -c 1 -t 100000 --port 5555 postgres
primary.sql is:
vacuum full pg_statistic;
vacuum full tablename;
(some activity with AccessExclusiveLock)

On replica:
pgbench -f ro.sql --time=300 -n -c 20 --port 5556 postgres
Script content:
\set i random(1,100)
select * from tablename where i = :i;

Usually replica kills queries with ERROR: deadlock detected and pgbench stops. But sometimes (usually less than 5-10 times on my host) both startup and backend with running query will start waiting something. Also new connections may become in "startup waiting" status indefinitely.

With another max_standby_streaming_delay queries are killed, but only after this timeout (as reported in this bug report). I think this should be detected as deadlock but not happens for some reason.

regards, Sergei

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-09-22 13:54:22 BUG #16017: Postgres does not respond non-local connections
Previous Message Ashutosh Sharma 2019-09-20 14:57:37 Re: BUG #16015: information_schema.triggers lack of truncate trigger