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 23:29:25
Message-ID: CAD21AoC697jCn=nqKXKpf-bJOXbj2iN7cbRpCmbghPP2eWzWMw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 28, 2026 at 9:58 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> 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.

Pushed.

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-09-28 23:45:21 Re: parallel autovacuum: Propagate track_cost_delay_timing to parallel workers
Previous Message Michael Paquier 2026-09-28 23:24:24 Re: [PATCH] Fix TAP tests with recent IPC::Run on Windows