Re: Parallel autovacuum: leader crashes when no DSM segment can be created - Mailing list pgsql-hackers

From Masahiko Sawada
Subject Re: Parallel autovacuum: leader crashes when no DSM segment can be created
Date
Msg-id CAD21AoD5hamnmf8SWLRtLa_SqJ_W3LCizm3SqRm2T5wcB=_y1Q@mail.gmail.com
Whole thread
In response to Parallel autovacuum: leader crashes when no DSM segment can be created  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
Hi,

On Sun, Sep 27, 2026 at 5:06 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.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



pgsql-hackers by date:

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