pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Don't run RelationInitTableAccessMethod in a long-lived context.
3+ messages / 1 participants
[nested] [flat]

* pgsql: Don't run RelationInitTableAccessMethod in a long-lived context.
@ 2021-03-19 02:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't run RelationInitTableAccessMethod in a long-lived context.

Some code paths in this function perform syscache lookups, which
can lead to table accesses and possibly leakage of cruft into
the caller's context.  If said context is CacheMemoryContext,
we eventually will have visible bloat.  But fixing this is no
harder than moving one memory context switch step.  (The other
callers don't have a problem.)

Andres Freund and I independently found this via valgrind testing.
Back-patch to v12 where this code was added.

Discussion: https://postgr.es/m/20210317023101.anvejcfotwka6gaa@alap3.anarazel.de
Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/utils/cache/relcache.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)



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

* pgsql: Don't run RelationInitTableAccessMethod in a long-lived context.
@ 2021-03-19 02:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't run RelationInitTableAccessMethod in a long-lived context.

Some code paths in this function perform syscache lookups, which
can lead to table accesses and possibly leakage of cruft into
the caller's context.  If said context is CacheMemoryContext,
we eventually will have visible bloat.  But fixing this is no
harder than moving one memory context switch step.  (The other
callers don't have a problem.)

Andres Freund and I independently found this via valgrind testing.
Back-patch to v12 where this code was added.

Discussion: https://postgr.es/m/20210317023101.anvejcfotwka6gaa@alap3.anarazel.de
Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1452a0bb87c78812372f103de14cb6492a932ac6

Modified Files
--------------
src/backend/utils/cache/relcache.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)



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

* pgsql: Don't run RelationInitTableAccessMethod in a long-lived context.
@ 2021-03-19 02:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't run RelationInitTableAccessMethod in a long-lived context.

Some code paths in this function perform syscache lookups, which
can lead to table accesses and possibly leakage of cruft into
the caller's context.  If said context is CacheMemoryContext,
we eventually will have visible bloat.  But fixing this is no
harder than moving one memory context switch step.  (The other
callers don't have a problem.)

Andres Freund and I independently found this via valgrind testing.
Back-patch to v12 where this code was added.

Discussion: https://postgr.es/m/20210317023101.anvejcfotwka6gaa@alap3.anarazel.de
Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/415ffdc2205e209b6a73fb42a3fdd6e57e16c7b2

Modified Files
--------------
src/backend/utils/cache/relcache.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)



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


end of thread, other threads:[~2021-03-19 02:23 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 02:23 pgsql: Don't run RelationInitTableAccessMethod in a long-lived context. Tom Lane <tgl@sss.pgh.pa.us>
2021-03-19 02:23 pgsql: Don't run RelationInitTableAccessMethod in a long-lived context. Tom Lane <tgl@sss.pgh.pa.us>
2021-03-19 02:23 pgsql: Don't run RelationInitTableAccessMethod in a long-lived context. Tom Lane <tgl@sss.pgh.pa.us>

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