From: Jack Douglas <jack@douglastechnology.co.uk>
To: 'Andres Freund' <andres@anarazel.de>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13523: Unexplained deadlocks (possible race condition)
Date: Thu, 30 Jul 2015 09:57:11 +0100
Message-ID: <01b001d0caa5$b8ea93e0$2abfbba0$@douglastechnology.co.uk> (raw)
In-Reply-To: <20150730083805.GA3161@alap3.anarazel.de>
References: <20150728162823.25043.27625@wrigleys.postgresql.org>
<17665.1438105627@sss.pgh.pa.us>
<015301d0caa0$f868f2f0$e93ad8d0$@douglastechnology.co.uk>
<20150730083805.GA3161@alap3.anarazel.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
> I don't think that'd help at all? The problem here is the lock upgrade
from RowExclusiveLock to the exclusive lock, and that'll not be fixed by
that proposal?
The problem is that the RowExclusiveLock is being aquired in one session
before the Exclusive lock, even though the LOCK TABLE statement is
physically first in the SQL function.
Because the locks are being acquired out-of-order, deadlocks become possible
as another session tries to escalate the lock and waits, then the first
session tries to escalate it's own lock and deadlocks.
Normally this is prevented by acquiring the most restrictive lock first, but
with a SQL-language function (unlike plpgsql for example) this is not
possible.
This is how I understand Tom's initial reply, is that not right?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: jack@douglastechnology.co.uk, andres@anarazel.de
Subject: Re: BUG #13523: Unexplained deadlocks (possible race condition)
In-Reply-To: <01b001d0caa5$b8ea93e0$2abfbba0$@douglastechnology.co.uk>
References: <20150728162823.25043.27625@wrigleys.postgresql.org> <17665.1438105627@sss.pgh.pa.us> <015301d0caa0$f868f2f0$e93ad8d0$@douglastechnology.co.uk> <20150730083805.GA3161@alap3.anarazel.de> <01b001d0caa5$b8ea93e0$2abfbba0$@douglastechnology.co.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox