pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Don't enter parallel mode when holding interrupts.
10+ messages / 3 participants
[nested] [flat]

* pgsql: Don't enter parallel mode when holding interrupts.
@ 2024-09-18 02:58 Noah Misch <noah@leadboat.com>
  2024-09-18 07:27 ` Re: pgsql: Don't enter parallel mode when holding interrupts. Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 10+ messages in thread

From: Noah Misch @ 2024-09-18 02:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't enter parallel mode when holding interrupts.

Doing so caused the leader to hang in wait_event=ParallelFinish, which
required an immediate shutdown to resolve.  Back-patch to v12 (all
supported versions).

Francesco Degrassi

Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ac04aa84a7f06635748278e6ff4bd74751bb3e8e

Modified Files
--------------
src/backend/optimizer/plan/planner.c          |  6 ++++++
src/test/regress/expected/select_parallel.out | 24 +++++++++++++++++++++
src/test/regress/sql/select_parallel.sql      | 31 +++++++++++++++++++++++++++
3 files changed, 61 insertions(+)



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: pgsql: Don't enter parallel mode when holding interrupts.
  2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
@ 2024-09-18 07:27 ` Laurenz Albe <laurenz.albe@cybertec.at>
  2024-09-19 13:25   ` Re: pgsql: Don't enter parallel mode when holding interrupts. Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Laurenz Albe @ 2024-09-18 07:27 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; pgsql-committers@lists.postgresql.org

On Wed, 2024-09-18 at 02:58 +0000, Noah Misch wrote:
> Don't enter parallel mode when holding interrupts.
> 
> Doing so caused the leader to hang in wait_event=ParallelFinish, which
> required an immediate shutdown to resolve.  Back-patch to v12 (all
> supported versions).
> 
> Francesco Degrassi
> 
> Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com

Does that warrant mention on this page?
https://www.postgresql.org/docs/current/when-can-parallel-query-be-used.html

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: pgsql: Don't enter parallel mode when holding interrupts.
  2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
  2024-09-18 07:27 ` Re: pgsql: Don't enter parallel mode when holding interrupts. Laurenz Albe <laurenz.albe@cybertec.at>
@ 2024-09-19 13:25   ` Robert Haas <robertmhaas@gmail.com>
  2024-09-20 18:39     ` Re: pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Robert Haas @ 2024-09-19 13:25 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: Noah Misch <noah@leadboat.com>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Wed, Sep 18, 2024 at 3:27 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> On Wed, 2024-09-18 at 02:58 +0000, Noah Misch wrote:
> > Don't enter parallel mode when holding interrupts.
> >
> > Doing so caused the leader to hang in wait_event=ParallelFinish, which
> > required an immediate shutdown to resolve.  Back-patch to v12 (all
> > supported versions).
> >
> > Francesco Degrassi
> >
> > Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com
>
> Does that warrant mention on this page?
> https://www.postgresql.org/docs/current/when-can-parallel-query-be-used.html

IMHO, no. This seems too low-level and too odd to mention.

TBH, I'm kind of surprised to learn that it's possible to start
executing a query while holding an LWLock. I see Tom is expressing
some doubts on the original thread, too. I wonder if we should instead
be erroring out if an LWLock is held at the start of query execution
-- or even earlier, like when we try to call a plpgsql function while
holding one. Leaving parallel query aside, what would prevent us from
attempting to reacquire the exact same LWLock that we already hold and
self-deadlocking? Or attempting to acquire some other LWLock and
deadlocking that way? I don't really feel like this is a parallel
query problem. I don't think we should be trying to run any
user-defined code while holding an LWLock, unless that code is written
in C (or C++, Rust, etc.). Trying to run procedural code at that point
doesn't seem reasonable.

-- 
Robert Haas
EDB: http://www.enterprisedb.com





^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: pgsql: Don't enter parallel mode when holding interrupts.
  2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
  2024-09-18 07:27 ` Re: pgsql: Don't enter parallel mode when holding interrupts. Laurenz Albe <laurenz.albe@cybertec.at>
  2024-09-19 13:25   ` Re: pgsql: Don't enter parallel mode when holding interrupts. Robert Haas <robertmhaas@gmail.com>
@ 2024-09-20 18:39     ` Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Noah Misch @ 2024-09-20 18:39 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Thu, Sep 19, 2024 at 09:25:05AM -0400, Robert Haas wrote:
> On Wed, Sep 18, 2024 at 3:27 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> > On Wed, 2024-09-18 at 02:58 +0000, Noah Misch wrote:
> > > Don't enter parallel mode when holding interrupts.
> > >
> > > Doing so caused the leader to hang in wait_event=ParallelFinish, which
> > > required an immediate shutdown to resolve.  Back-patch to v12 (all
> > > supported versions).
> > >
> > > Francesco Degrassi
> > >
> > > Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com
> >
> > Does that warrant mention on this page?
> > https://www.postgresql.org/docs/current/when-can-parallel-query-be-used.html
> 
> IMHO, no. This seems too low-level and too odd to mention.

Agreed.  If I were documenting it, I would document it with the material for
writing opclasses.  It's probably too esoteric to document even there.

> TBH, I'm kind of surprised to learn that it's possible to start
> executing a query while holding an LWLock. I see Tom is expressing
> some doubts on the original thread, too. I wonder if we should instead
> be erroring out if an LWLock is held at the start of query execution
> -- or even earlier, like when we try to call a plpgsql function while
> holding one. Leaving parallel query aside, what would prevent us from
> attempting to reacquire the exact same LWLock that we already hold and
> self-deadlocking? Or attempting to acquire some other LWLock and
> deadlocking that way? I don't really feel like this is a parallel
> query problem. I don't think we should be trying to run any
> user-defined code while holding an LWLock, unless that code is written
> in C (or C++, Rust, etc.). Trying to run procedural code at that point
> doesn't seem reasonable.

Nothing prevents those lwlock deadlocks.  If you think it's worth breaking the
things folks use today (see original thread) in order to prevent that, please
do share that on the original thread.  I'm fine either way.  I think given
infinite resources across both postgresql.org and all extension maintainers, I
would do what you're thinking in v18 while in back branches, I would change
"erroring out" to "warn when assertions are enabled".  I also think it's a
low-priority bug, given the only known ways to reach it are C code or a custom
opclass.  Since resources aren't infinite, I'm inclined toward one of (a) stop
here or (b) all branches "warn when assertions are enabled" and maybe block
the plancache route discussed on the original thread.





^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* pgsql: Don't enter parallel mode when holding interrupts.
@ 2024-09-18 02:58 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Noah Misch @ 2024-09-18 02:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't enter parallel mode when holding interrupts.

Doing so caused the leader to hang in wait_event=ParallelFinish, which
required an immediate shutdown to resolve.  Back-patch to v12 (all
supported versions).

Francesco Degrassi

Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2370582ab14f179eb8edd748d629edf991999989

Modified Files
--------------
src/backend/optimizer/plan/planner.c          |  6 ++++++
src/test/regress/expected/select_parallel.out | 24 +++++++++++++++++++++
src/test/regress/sql/select_parallel.sql      | 31 +++++++++++++++++++++++++++
3 files changed, 61 insertions(+)



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* pgsql: Don't enter parallel mode when holding interrupts.
@ 2024-09-18 02:58 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Noah Misch @ 2024-09-18 02:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't enter parallel mode when holding interrupts.

Doing so caused the leader to hang in wait_event=ParallelFinish, which
required an immediate shutdown to resolve.  Back-patch to v12 (all
supported versions).

Francesco Degrassi

Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6f6521de9a961e9365bc84e95a04a7afaafb2f95

Modified Files
--------------
src/backend/optimizer/plan/planner.c          |  6 ++++++
src/test/regress/expected/select_parallel.out | 24 +++++++++++++++++++++
src/test/regress/sql/select_parallel.sql      | 31 +++++++++++++++++++++++++++
3 files changed, 61 insertions(+)



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* pgsql: Don't enter parallel mode when holding interrupts.
@ 2024-09-18 02:58 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Noah Misch @ 2024-09-18 02:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't enter parallel mode when holding interrupts.

Doing so caused the leader to hang in wait_event=ParallelFinish, which
required an immediate shutdown to resolve.  Back-patch to v12 (all
supported versions).

Francesco Degrassi

Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/884860bfc0286ca35f7c097c2511bad90f4ede07

Modified Files
--------------
src/backend/optimizer/plan/planner.c          |  6 ++++++
src/test/regress/expected/select_parallel.out | 24 +++++++++++++++++++++
src/test/regress/sql/select_parallel.sql      | 31 +++++++++++++++++++++++++++
3 files changed, 61 insertions(+)



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* pgsql: Don't enter parallel mode when holding interrupts.
@ 2024-09-18 02:58 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Noah Misch @ 2024-09-18 02:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't enter parallel mode when holding interrupts.

Doing so caused the leader to hang in wait_event=ParallelFinish, which
required an immediate shutdown to resolve.  Back-patch to v12 (all
supported versions).

Francesco Degrassi

Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5c698e8987dbaf1d5079f451f1379abed3725c0c

Modified Files
--------------
src/backend/optimizer/plan/planner.c          |  6 ++++++
src/test/regress/expected/select_parallel.out | 24 +++++++++++++++++++++
src/test/regress/sql/select_parallel.sql      | 31 +++++++++++++++++++++++++++
3 files changed, 61 insertions(+)



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* pgsql: Don't enter parallel mode when holding interrupts.
@ 2024-09-18 02:58 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Noah Misch @ 2024-09-18 02:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't enter parallel mode when holding interrupts.

Doing so caused the leader to hang in wait_event=ParallelFinish, which
required an immediate shutdown to resolve.  Back-patch to v12 (all
supported versions).

Francesco Degrassi

Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/916b8ae475fa852483a7ef05e793a22c922bf999

Modified Files
--------------
src/backend/optimizer/plan/planner.c          |  6 ++++++
src/test/regress/expected/select_parallel.out | 24 +++++++++++++++++++++
src/test/regress/sql/select_parallel.sql      | 31 +++++++++++++++++++++++++++
3 files changed, 61 insertions(+)



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* pgsql: Don't enter parallel mode when holding interrupts.
@ 2024-09-18 02:58 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Noah Misch @ 2024-09-18 02:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't enter parallel mode when holding interrupts.

Doing so caused the leader to hang in wait_event=ParallelFinish, which
required an immediate shutdown to resolve.  Back-patch to v12 (all
supported versions).

Francesco Degrassi

Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/507b72bd9f7de95a224ae5af8797f42bfce1ed9c

Modified Files
--------------
src/backend/optimizer/plan/planner.c          |  6 ++++++
src/test/regress/expected/select_parallel.out | 24 +++++++++++++++++++++
src/test/regress/sql/select_parallel.sql      | 31 +++++++++++++++++++++++++++
3 files changed, 61 insertions(+)



^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2024-09-20 18:39 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
2024-09-18 07:27 ` Laurenz Albe <laurenz.albe@cybertec.at>
2024-09-19 13:25   ` Robert Haas <robertmhaas@gmail.com>
2024-09-20 18:39     ` Noah Misch <noah@leadboat.com>
2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>
2024-09-18 02:58 pgsql: Don't enter parallel mode when holding interrupts. Noah Misch <noah@leadboat.com>

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