Re: pgsql: Add function to get memory context stats for processes

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Rahila Syed <rahilasyed90(at)gmail(dot)com>
Subject: Re: pgsql: Add function to get memory context stats for processes
Date: 2025-04-22 16:58:28
Message-ID: rznpn3hfiojkn2g647kspne42swrzsjf7logaqeyl2zsyyzj5p@bfq63rw4zltd
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Hi,

On 2025-04-17 10:42:45 -0400, Robert Haas wrote:
> On Tue, Apr 15, 2025 at 6:11 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > There very well could be a CFI - but it better be somewhere where the
> > in-memory state is consistent. Otherwise an error inside raised in the CFI
> > would lead the in-memory state inconsistent which then would cause problems
> > when cleaning up the dsa during resowner release or process exit.
> >
> > What am I missing here?
>
> I think maybe you're only thinking about gathering the data. What
> about publishing it? If the DSA code were interrupted at a CFI and the
> interrupting code went and tried to perform a DSA allocation to store
> the resulting data and then returned to the interrupted DSA operation,
> would you expect the code to cope with that?

I would expect the DSA code to not call CFI() in such a place - afaict nearly
all such cases would also not be safe against errors being raised in the CFI()
and then later again allocating memory from the DSA (or resetting
it). Similarly, aset.c better not accept interrupts in the middle of, e.g.,
AllocSetAllocFromNewBlock(), since we'd loose track of the allocation.

Greetings,

Andres Freund

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-04-22 17:56:38 pgsql: gen_node_support.pl: improve error message for unclosed struct.
Previous Message Daniel Gustafsson 2025-04-22 08:11:43 Re: pgsql: Add function to get memory context stats for processes

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-04-22 17:13:16 Re: Fortify float4 and float8 regression tests by ordering test results
Previous Message Laurenz Albe 2025-04-22 16:55:49 Re: Cygwin support