Re: Postgres stucks in deadlock detection

From: Andres Freund <andres(at)anarazel(dot)de>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Postgres stucks in deadlock detection
Date: 2018-04-13 15:41:39
Message-ID: 20180413154139.5jbjblkg5ku656hx@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2018-04-13 16:43:09 +0300, Konstantin Knizhnik wrote:
> Updated patch is attached.
> + /*
> + * Ensure that only one backend is checking for deadlock.
> + * Otherwise under high load cascade of deadlock timeout expirations can cause stuck of Postgres.
> + */
> + if (!pg_atomic_test_set_flag(&ProcGlobal->activeDeadlockCheck))
> + {
> + enable_timeout_after(DEADLOCK_TIMEOUT, DeadlockTimeout);
> + return;
> + }
> + inside_deadlock_check = true;

I can't see that ever being accepted. This means there's absolutely no
bound for deadlock checks happening even under light concurrency, even
if there's no contention for a large fraction of the time.

If you want to improve this, improve the efficiency of the
implementation, check multiple lockers at the same time (set a bit
afterwards that they don't recheck themselves). There's plenty
approaches that don't result in a significantly worse user experience.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julian Markwort 2018-04-13 15:48:41 Re: [PATCH] pg_hba.conf : new auth option : clientcert=verify-full
Previous Message Evgeniy Shishkin 2018-04-13 15:22:45 Re: Postgres stucks in deadlock detection