pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix crash in parallel autovacuum when no DSM segment can be crea
Date: Mon, 28 Sep 2026 23:28:48 +0000
Message-ID: <E1xBKm8-00000001flg-1lrs@gemulon.postgresql.org> (raw)

Fix crash in parallel autovacuum when no DSM segment can be created.

If no DSM segment can be created, a ParallelContext can still be
created with zero workers, but its seg pointer is NULL. Parallel
autovacuum registered a segment detach callback on that NULL pointer,
crashing the autovacuum worker.

Fix by setting up the shared cost parameters and the detach callback
only when the parallel context has workers, as there are no workers to
propagate the parameters to otherwise.

Oversight in commit 1ff3180ca01.

Found by Bharath using AI assisted review with Claude.

Reported-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Discussion: https://postgr.es/m/CALj2ACVjBN03Fq4XWgKH1zOfkapK6-P3ufNLHUHnZcW1zPm+Mg@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4331d20f4d5cb51663b0912fdb2a3b991bc5a5c8

Modified Files
--------------
src/backend/commands/vacuumparallel.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)



view thread (2+ messages)

Message-ID: <E1xBKm8-00000001flg-1lrs@gemulon.postgresql.org>
Permalink:  ../E1xBKm8-00000001flg-1lrs@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xBKm8-00000001flg-1lrs@gemulon.postgresql.org

 · 

reply

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-committers@postgresql.org
  Cc: msawada@postgresql.org
  Subject: Re: pgsql: Fix crash in parallel autovacuum when no DSM segment can be crea
  In-Reply-To: <E1xBKm8-00000001flg-1lrs@gemulon.postgresql.org>
  References: <E1xBKm8-00000001flg-1lrs@gemulon.postgresql.org>

* 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