From: Noah Misch <noah@leadboat.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Francesco Degrassi <francesco.degrassi@optionfactory.net>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Leader backend hang on IPC/ParallelFinish when LWLock held at parallel query start
Date: Fri, 8 Nov 2024 15:36:49 -0800
Message-ID: <20241108233649.01.nmisch@google.com> (raw)
In-Reply-To: <3793541.1731088615@sss.pgh.pa.us>
References: <CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com>
<20240918030159.2a.nmisch@google.com>
<1737570.1726633422@sss.pgh.pa.us>
<20240918050434.13.nmisch@google.com>
<3441950.1730999841@sss.pgh.pa.us>
<20241107192233.94.nmisch@google.com>
<3459938.1731007759@sss.pgh.pa.us>
<20241107193823.dc.nmisch@google.com>
<3694355.1731084396@sss.pgh.pa.us>
<3793541.1731088615@sss.pgh.pa.us>
On Fri, Nov 08, 2024 at 12:56:55PM -0500, Tom Lane wrote:
> I wrote:
> > Here's a proposed patch along that line. I left the test case from
> > ac04aa84a alone, since it works perfectly well to test this way too.
>
> I'd modeled that on the existing recovery code for DSM segment creation
> failure, just below. But a look at the code coverage report shows
> (unsurprisingly) that that path is never exercised in our regression
> tests, so I wondered if it actually works ... and it doesn't work
> very well. To test, I lobotomized InitializeParallelDSM to always
> force pcxt->nworkers = 0. That results in a bunch of unsurprising
> regression test diffs, plus a couple of
>
> +ERROR: could not find key 4 in shm TOC at 0x229f138
>
> which turns out to be the fault of ExecHashJoinReInitializeDSM:
> it's not accounting for the possibility that we didn't really
> start a parallel hash join.
>
> I'm also not happy about ReinitializeParallelWorkers'
>
> Assert(pcxt->nworkers >= nworkers_to_launch);
>
> The one existing caller manages not to trigger that because it's
> careful to reduce its request based on pcxt->nworkers, but it
> doesn't seem to me that callers should be expected to have to.
>
> So I end with the attached. There might still be some more issues
> that the regression tests don't reach, but I think this is the
> best we can do for today.
Looks good.
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: noah@leadboat.com, tgl@sss.pgh.pa.us, francesco.degrassi@optionfactory.net, pgsql-bugs@lists.postgresql.org
Subject: Re: Leader backend hang on IPC/ParallelFinish when LWLock held at parallel query start
In-Reply-To: <20241108233649.01.nmisch@google.com>
* 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