Re: Bug in v13 due to "Fix corruption when relation truncation fails."

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <tmunro(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Bug in v13 due to "Fix corruption when relation truncation fails."
Date: 2025-01-08 03:30:51
Message-ID: Z33xax4kqc9euHMK@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 26, 2024 at 01:10:59PM +0300, Yura Sokolov wrote:
> Commit "Fix corruption when relation truncation fails." [0] makes
> smgrtruncate be called in a critical section. Unfortunately in version 13 it
> leads to occasional call to palloc0 inside of critical section, which
> triggers Assert in debug builds:
>
> - smgrtruncate calls mdtruncate
> - mdtruncate may call register_dirty_segment
> - register_dirty_segment calls RegisterSyncRequest
> - RegisterSyncRequest calls ForwardSyncRequest
> - ForwardSyncRequest may call CompactCheckpointerRequestQueue
> - CompactCheckpointerRequestQueue may call palloc0 ...
>
> In versions 14 and above CompactCheckpointerRequestQueue does check for
> critical section due to commit "Fix bugs in MultiXact truncation" [1],
> which were backported down to 14 version, but not 13.
>
> We caught it in our private tests, so it is real.
> Cherry-pick of [1] from 14 version to 13 solves the issue.
>
> [0] https://git.postgresql.org/gitweb/?p=postgresql.git;h=2280912165d
> [1] https://git.postgresql.org/gitweb/?p=postgresql.git;h=4c8e00ae9ae

Ah, you're right. This chain of events is possible in REL_13_STABLE,
and only there. Thomas?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-01-08 04:18:36 Re: Converting contrib SQL functions to new style
Previous Message Noah Misch 2025-01-08 02:52:33 Re: Converting contrib SQL functions to new style