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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
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-17 14:42:45
Message-ID: CA+TgmoZgOwiF1auY+wxUBC+7GcjKqXFBf7D97sF4WL7HER4LgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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 do not believe we have
anywhere enough guarantees about reentrancy for that to be safe.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-04-17 16:57:47 pgsql: Make functions.c mostly run in a short-lived memory context.
Previous Message Noah Misch 2025-04-17 12:04:34 pgsql: Assert lack of hazardous buffer locks before possible catalog re

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-04-17 14:56:25 Re: disabled SSL log_like tests
Previous Message torikoshia 2025-04-17 14:27:42 Re: Align memory context level numbering in pg_log_backend_memory_contexts()