From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-general@postgresql.org
Subject: Re: backends stuck in "startup"
Date: Wed, 22 Nov 2017 19:43:50 -0500
Message-ID: <14525.1511397830@sss.pgh.pa.us> (raw)
In-Reply-To: <20171122223117.GB5668@telsasoft.com>
References: <20171121230926.GA17194@telsasoft.com>
<20171121234027.b4n4jlsfda42qb6r@alap3.anarazel.de>
<20171122064702.GQ5668@telsasoft.com>
<27867.1511375232@sss.pgh.pa.us>
<20171122223117.GB5668@telsasoft.com>
Justin Pryzby <pryzby@telsasoft.com> writes:
> For starters, I found that PID 27427 has:
> (gdb) p proc->lwWaiting
> $1 = 0 '\000'
> (gdb) p proc->lwWaitMode
> $2 = 1 '\001'
To confirm, this is LWLockAcquire's "proc", equal to MyProc?
If so, and if LWLockAcquire is blocked at PGSemaphoreLock,
that sure seems like a smoking gun.
> Note: I've compiled locally PG 10.1 with PREFERRED_SEMAPHORES=SYSV to keep the
> service up (and to the degree that serves to verify that avoids the issue,
> great).
Good idea, I was going to suggest that. It will be very interesting
to see if that makes the problem go away.
> Would you suggest how I can maximize the likelyhood/speed of triggering that ?
> Five years ago, with a report of similar symptoms, you said "You need to hack
> pgbench to suppress the single initialization connection it normally likes to
> make, else the test degenerates to the one-incoming-connection case"
> https://www.postgresql.org/message-id/8896.1337998337%40sss.pgh.pa.us
I don't think that case was related at all.
My theory suggests that any contended use of an LWLock is at risk,
in which case just running pgbench with about as many sessions as
you have in the live server ought to be able to trigger it. However,
that doesn't really account for your having observed the problem
only during session startup, so there may be some other factor
involved. I wonder if it only happens during the first wait for
an LWLock ... and if so, how could that be?
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, pryzby@telsasoft.com, andres@anarazel.de
Subject: Re: backends stuck in "startup"
In-Reply-To: <14525.1511397830@sss.pgh.pa.us>
References: <20171121230926.GA17194@telsasoft.com> <20171121234027.b4n4jlsfda42qb6r@alap3.anarazel.de> <20171122064702.GQ5668@telsasoft.com> <27867.1511375232@sss.pgh.pa.us> <20171122223117.GB5668@telsasoft.com> <14525.1511397830@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