From: torikoshia <torikoshia@oss.nttdata.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: pgsql: Add function to log the memory contexts of specified backend pro
Date: Fri, 02 May 2025 14:58:29 +0900
Message-ID: <d7d7364d149587e5da2299f7acbc90dc@oss.nttdata.com> (raw)
In-Reply-To: <1983bca8-e1c4-45cd-9fd4-de38cd7b5896@oss.nttdata.com>
References: <E1lTdaH-0002Zo-DS@gemulon.postgresql.org>
<CA+TgmoZMrv32tbNRrFTvF9iWLnTGqbhYSLVcrHGuwZvCtph0NA@mail.gmail.com>
<ce64a21b-9764-4782-ac94-58703ad6b258@oss.nttdata.com>
<CA+TgmoZfVES0SaS3NpP1kf__fW1ODc_wzVaNNC9HBHvERvh9xA@mail.gmail.com>
<b636ab38-8c55-4deb-a621-8651dcab4ced@oss.nttdata.com>
<1983bca8-e1c4-45cd-9fd4-de38cd7b5896@oss.nttdata.com>
On 2025-05-02 09:02, Fujii Masao wrote:
> On 2025/05/02 2:27, Fujii Masao wrote:
>>
>>
>> On 2025/05/01 21:42, Robert Haas wrote:
>>> On Thu, May 1, 2025 at 3:53 AM Fujii Masao
>>> <masao.fujii@oss.nttdata.com> wrote:
>>>> Just idea, what do you think about adding a flag to indicate whether
>>>> ProcessLogMemoryContextInterrupt() is currently running? Then,
>>>> when a backend receives a signal and
>>>> ProcessLogMemoryContextInterrupt()
>>>> is invoked, it can simply return immediately if the flag is already
>>>> set
>>>> like this:
>>>
>>> I think that something like this could work, but you would need more
>>> than this. Otherwise, if the function errors out, the flag would
>>> remain permanently set.
>>
>> Yes, we need to either use PG_TRY()/PG_FINALLY() or handle the flag as
>> a global variable and reset it in the error handling path. I think
>> using
>> PG_TRY()/PG_FINALLY() is the simpler option.
>
> I've implemented the patch in that way. Patch attached.
Thank you for the patch!
I confirmed that with this patch applied, the process no longer crashes
even after applying the change Robert used to trigger the crash.
a small nitpick:
+ * requested repeatedly and rapidly, potentially
leading to infinite
It looks like there are two spaces between "requested" and "repeatedly".
--
Regards,
--
Atsushi Torikoshi
Seconded from NTT DATA GROUP CORPORATION to SRA OSS K.K.
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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: torikoshia@oss.nttdata.com, masao.fujii@oss.nttdata.com, robertmhaas@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: pgsql: Add function to log the memory contexts of specified backend pro
In-Reply-To: <d7d7364d149587e5da2299f7acbc90dc@oss.nttdata.com>
* 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