pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix leak with SMgrRelations in startup process
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix leak with SMgrRelations in startup process
@ 2025-09-09 22:23 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2025-09-09 22:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix leak with SMgrRelations in startup process

The startup process does not process shared invalidation messages, only
sending them, and never calls AtEOXact_SMgr() which clean up any
unpinned SMgrRelations.  Hence, it is never able to free SMgrRelations
on a periodic basis, bloating its hashtable over time.

Like the checkpointer and the bgwriter, this commit takes a conservative
approach by freeing periodically SMgrRelations when replaying a
checkpoint record, either online or shutdown, so as the startup process
has a way to perform a periodic cleanup.

Issue caused by 21d9c3ee4ef7, so backpatch down to v17.

Author: Jingtang Zhang <mrdrivingduck@gmail.com>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Discussion: https://postgr.es/m/28C687D4-F335-417E-B06C-6612A0BD5A10@gmail.com
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8c8f7b199d9095dbc2e101a4614043b5ae13bde3

Modified Files
--------------
src/backend/access/transam/xlog.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix leak with SMgrRelations in startup process
@ 2025-09-09 22:23 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2025-09-09 22:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix leak with SMgrRelations in startup process

The startup process does not process shared invalidation messages, only
sending them, and never calls AtEOXact_SMgr() which clean up any
unpinned SMgrRelations.  Hence, it is never able to free SMgrRelations
on a periodic basis, bloating its hashtable over time.

Like the checkpointer and the bgwriter, this commit takes a conservative
approach by freeing periodically SMgrRelations when replaying a
checkpoint record, either online or shutdown, so as the startup process
has a way to perform a periodic cleanup.

Issue caused by 21d9c3ee4ef7, so backpatch down to v17.

Author: Jingtang Zhang <mrdrivingduck@gmail.com>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Discussion: https://postgr.es/m/28C687D4-F335-417E-B06C-6612A0BD5A10@gmail.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/039301b3fceb00a8c7c6cdf8ccbfaf912dd8cd5f

Modified Files
--------------
src/backend/access/transam/xlog.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix leak with SMgrRelations in startup process
@ 2025-09-09 22:23 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2025-09-09 22:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix leak with SMgrRelations in startup process

The startup process does not process shared invalidation messages, only
sending them, and never calls AtEOXact_SMgr() which clean up any
unpinned SMgrRelations.  Hence, it is never able to free SMgrRelations
on a periodic basis, bloating its hashtable over time.

Like the checkpointer and the bgwriter, this commit takes a conservative
approach by freeing periodically SMgrRelations when replaying a
checkpoint record, either online or shutdown, so as the startup process
has a way to perform a periodic cleanup.

Issue caused by 21d9c3ee4ef7, so backpatch down to v17.

Author: Jingtang Zhang <mrdrivingduck@gmail.com>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Discussion: https://postgr.es/m/28C687D4-F335-417E-B06C-6612A0BD5A10@gmail.com
Backpatch-through: 17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e2dd7b2acf27336d47f78d68f4aac03f7770a6a6

Modified Files
--------------
src/backend/access/transam/xlog.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-09-09 22:23 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-09-09 22:23 pgsql: Fix leak with SMgrRelations in startup process Michael Paquier <michael@paquier.xyz>
2025-09-09 22:23 pgsql: Fix leak with SMgrRelations in startup process Michael Paquier <michael@paquier.xyz>
2025-09-09 22:23 pgsql: Fix leak with SMgrRelations in startup process Michael Paquier <michael@paquier.xyz>

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