Re: Parallel autovacuum: leader crashes when no DSM segment can be created

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Parallel autovacuum: leader crashes when no DSM segment can be created
Date: 2026-09-28 16:58:02
Message-ID: CAD21AoD5hamnmf8SWLRtLa_SqJ_W3LCizm3SqRm2T5wcB=_y1Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sun, Sep 27, 2026 at 5:06 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> Hi,
>
> AI review found a bug in parallel autovacuum (1ff3180ca01). I checked
> it myself and it reproduces on HEAD and PG19. Patch and reproducer
> attached.
>
> When no DSM segment can be created, InitializeParallelDSM() does not
> fail. It sets up the parallel context in the leader's own memory with
> zero workers and leaves pcxt->seg NULL. Parallel query checks that
> pointer before using it, see ExecInitParallelPlan(), and VACUUM
> (PARALLEL) never looks at it and vacuums all the indexes in the
> leader. Parallel autovacuum registers a DSM detach callback on it, so
> the autovacuum worker segfaults and the database goes through crash
> recovery. It also leaves pv_shared_cost_params pointing into the
> leader's private memory with nothing left to reset it.

Thank you for the report and the patch!

I agree with your analysis and it should be fixed. The proposed patch
is simple and looks good to me, so I'm going to push it barring any
objections.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nitin Motiani 2026-09-28 17:05:17 Re: [PATCH v1] Fix for Bug#19724 - ALTER TYPE ... ALTER ATTRIBUTE triggers internal error for base type of domain with check
Previous Message Andrew Dunstan 2026-09-28 16:54:18 Re: [PATCH] Fix TAP tests with recent IPC::Run on Windows