Re: Enhancing Memory Context Statistics Reporting
Rahila Syed <rahilasyed90@gmail.com>
From: Rahila Syed <rahilasyed90@gmail.com>
To: Daniel Gustafsson <daniel@yesql.se>,
torikoshia <torikoshia@oss.nttdata.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-01-09T11:22:25Z
Lists: pgsql-hackers
Attachments
- v47-0002-Test-module-to-test-memory-context-reporting-wit.patch (application/octet-stream) patch v47-0002
- v47-0001-Add-function-to-report-memory-context-statistics.patch (application/octet-stream) patch v47-0001
Hi, >> *Error Reported in Thread [2]*: This issue has been fixed by switching >> to a NULL resource owner before attaching >> to DSM in the CFI handler. >> >> > This error mentioned in thread [2] is triggered during CFI() call from > secure_read() when a > backend is waiting for commands and it has an open transaction which is > going to abort > > Below are some details about this fix. > > It is safe to temporarily set the resource owner to NULL before attaching > to the DSA > and DSHASH, since these segments are intended to be attached for the full > session > and are detached only when the session ends. > We also restore the original resource owner immediately after the attach > completes. > > After further discussion and reviewing Robert's email[1] on this topic, a safer solution is to avoid running ProcessGetMemoryContextInterrupt during an aborted transaction. This should help prevent additional errors when the transaction is already in error handling state. Also, reporting memory context statistics from an aborting transaction won't be very useful as some of that memory usage won't be valid after abort completes. Attached is the updated patch that addresses this. > Other possible fixes include: > 1.Adjusting resource‑owner behavior > Either allow resource‑owner enlargement during release, or delay marking > it as releasing until > the abort actually begins. > Sorry, this point is invalid as resource-owner is already being marked as releasing from AbortTransaction. Thank you, Rahila Syed [1]. https://www.postgresql.org/message-id/CA%2BTgmoapJ6erjT21uPO12wTtoOmj6w-dp6T3qySN%2BNSc1cdEKw%40mail.gmail.com >
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Cross-check lists of built-in LWLock tranches.
- 2047ad068139 19 (unreleased) cited
-
Convert strncpy to strlcpy
- 45e7e8ca9e93 18.0 landed
-
Typo and doc fixups for memory context reporting
- f8c115a6cb65 18.0 landed
-
Add missing string terminator
- d2a1ed1727a8 18.0 landed
-
Rename argument in pg_get_process_memory_contexts().
- c57971034e69 18.0 landed
-
Add function to get memory context stats for processes
- 042a66291b04 18.0 landed