From: Tom Lane <tgl@sss.pgh.pa.us>
Cc: andres@anarazel.de
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-general@postgresql.org
Subject: Re: backends stuck in "startup"
Date: Tue, 21 Nov 2017 19:16:00 -0500
Message-ID: <8341.1511309760@sss.pgh.pa.us> (raw)
In-Reply-To: <7806.1511308921@sss.pgh.pa.us>
References: <20171121230926.GA17194@telsasoft.com>
<6177.1511306476@sss.pgh.pa.us>
<20171121234558.p7rtwkasqfjvpft4@alap3.anarazel.de>
<7332.1511308205@sss.pgh.pa.us>
<20171121235239.5ssxkvmfwvhxavsm@alap3.anarazel.de>
<7806.1511308921@sss.pgh.pa.us>
I wrote:
> ... Maybe we need
> to take a closer look at where LWLocks devolve to blocking on the process
> semaphore and see if there's any implicit assumptions about barriers there.
Like, say, here:
for (;;)
{
PGSemaphoreLock(proc->sem);
if (!proc->lwWaiting)
break;
extraWaits++;
}
which is exactly where Justin's backend is stuck. Without a read barrier
after the PGSemaphoreLock, it seems possible that we might not see our
lwWaiting as cleared yet, causing the loop to go around an extra time and
wait for a sema wakeup that will never come. Then, we are holding the
lock but are blocked anyway, and everyone else who wants that same lock
will queue up behind us.
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, pryzby@telsasoft.com
Subject: Re: backends stuck in "startup"
In-Reply-To: <8341.1511309760@sss.pgh.pa.us>
References: <20171121230926.GA17194@telsasoft.com> <6177.1511306476@sss.pgh.pa.us> <20171121234558.p7rtwkasqfjvpft4@alap3.anarazel.de> <7332.1511308205@sss.pgh.pa.us> <20171121235239.5ssxkvmfwvhxavsm@alap3.anarazel.de> <7806.1511308921@sss.pgh.pa.us> <8341.1511309760@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