Re: Leader backend hang on IPC/ParallelFinish when LWLock held at parallel query start
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Noah Misch <noah@leadboat.com>
Cc: Francesco Degrassi <francesco.degrassi@optionfactory.net>,
pgsql-bugs@lists.postgresql.org
Date: 2024-09-18T04:23:42Z
Lists: pgsql-bugs
Noah Misch <noah@leadboat.com> writes: > On Mon, Sep 16, 2024 at 09:35:13PM +0200, Francesco Degrassi wrote: >> The problem appears to manifest when a backend is holding an LWLock and >> starting a query, and the planner chooses a parallel plan for the >> latter. > Thanks for the detailed report and for the fix. I do not have much faith in this patch. It assumes that the condition "interrupts can be processed" is the same at plan time and execution time. For plans extracted from the plan cache, there seems little reason to assume that must be true. The proposed test case cannot trigger that (today anyway) because SQL-language functions don't deal in cached plans, but I suspect it could be broken with a test case using a plpgsql function instead. I actually think that the problem is somewhere upstream of here: what in the world are we doing invoking planning and execution of arbitrary queries in a context where interrupts are held off? That seems certain to fail in multiple ways besides parallel workers not working. I think we need to fix whatever code believes that that could be OK. And maybe then insert "Assert(INTERRUPTS_CAN_BE_PROCESSED())" at planner start and executor start. regards, tom lane
Commits
-
Improve fix for not entering parallel mode when holding interrupts.
- b8df69049256 18.0 landed
- bcbdb176e1e2 15.9 landed
- 989ccd26c838 14.14 landed
- 943b65358e88 17.1 landed
- 6e39ca6e7edb 12.21 landed
- 62685876f7b5 13.17 landed
- 06424e9a24f0 16.5 landed
-
Don't enter parallel mode when holding interrupts.
- 916b8ae475fa 13.17 landed
- 884860bfc028 15.9 landed
- 5c698e8987db 14.14 landed
- 507b72bd9f7d 12.21 landed
- 6f6521de9a96 16.5 landed
- 2370582ab14f 17.0 landed
- ac04aa84a7f0 18.0 landed
-
Add has_largeobject_privilege function.
- 4eada203a5a8 18.0 cited