| From: | Robert Haas <rhaas(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Switch memory contexts in ReinitializeParallelDSM. |
| Date: | 2025-12-16 17:31:47 |
| Message-ID: | E1vVYtm-0016DR-0L@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Switch memory contexts in ReinitializeParallelDSM.
We already do this in CreateParallelContext, InitializeParallelDSM, and
LaunchParallelWorkers. I suspect the reason why the matching logic was
omitted from ReinitializeParallelDSM is that I failed to realize that
any memory allocation was happening here -- but shm_mq_attach does
allocate, which could result in a shm_mq_handle being allocated in a
shorter-lived context than the ParallelContext which points to it.
That could result in a crash if the shorter-lived context is freed
before the parallel context is destroyed. As far as I am currently
aware, there is no way to reach a crash using only code that is
present in core PostgreSQL, but extensions could potentially trip
over this. Fixing this in the back-branches appears low-risk, so
back-patch to all supported versions.
Author: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Co-authored-by: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Backpatch-through: 14
Discussion: http://postgr.es/m/CAKZiRmwfVripa3FGo06=5D1EddpsLu9JY2iJOTgbsxUQ339ogQ@mail.gmail.com
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/bd2726d3e15fdf8245f63bdbaddf4e3700f86577
Modified Files
--------------
src/backend/access/transam/parallel.c | 7 +++++++
1 file changed, 7 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christoph Berg | 2025-12-16 17:54:46 | Re: failed NUMA pages inquiry status: Operation not permitted |
| Previous Message | Tom Lane | 2025-12-16 17:01:54 | pgsql: Test PRI* macros even when we can't test NLS translation. |