pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sorin Mircioiu <sorin.mircioiu@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: PostgreSQL's processes blocking each other are not detected as deadlock
Date: Tue, 26 Sep 2023 10:02:25 -0400
Message-ID: <404709.1695736945@sss.pgh.pa.us> (raw)
In-Reply-To: <CAO-WFfkqwkqZ+qj0rqcjjg6UqL_34ZPXgC=fqquqjUfkoPt6Sw@mail.gmail.com>
References: <CAO-WFfkqwkqZ+qj0rqcjjg6UqL_34ZPXgC=fqquqjUfkoPt6Sw@mail.gmail.com>

Sorin Mircioiu <sorin.mircioiu@gmail.com> writes:
> I need answers to the following questions:

> 1. 13502 is blocked by 21544 and 21544 is blocked by 13502. Why PostgreSQL
> didn't detect this situation as a deadlock ?

You have not demonstrated that these two processes are waiting for
each other, only that they are waiting for something.  The subset
of data you presented is insufficient to conclude that a deadlock
should have been reported.  It does appear that some progress
has been made since the previous deadlock, since neither process
is waiting for the same thing it was waiting on as of the deadlock
report.

In the past we've seen cases where a deadlock existed but the
server could not detect it because one step in the waits-for
loop was implemented by client-side behavior rather than a
server-visible lock request.  Not saying that's happened here,
but you might want to consider your application's behavior
with that idea in mind.

> why is ShareLock used for the locking system in my situation ?

ShareLock on an XID is a different thing from ShareLock on a table.
IIRC we request ShareLock on an XID as a way of waiting for the
transaction using that XID to terminate, which is a need that only
comes up in some edge cases like CREATE INDEX CONCURRENTLY.  Have you
identified exactly what statements those functions are executing?

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <404709.1695736945@sss.pgh.pa.us>
Permalink:  ../404709.1695736945@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/404709.1695736945@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sorin.mircioiu@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: PostgreSQL's processes blocking each other are not detected as deadlock
  In-Reply-To: <404709.1695736945@sss.pgh.pa.us>

* 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