From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Prevent long-term memory leakage in autovacuum launcher. |
Date: | 2022-08-31 20:23:49 |
Message-ID: | E1oTUFZ-000o2Z-DM@gemulon.postgresql.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Prevent long-term memory leakage in autovacuum launcher.
get_database_list() failed to restore the caller's memory context,
instead leaving current context set to TopMemoryContext which is
how CommitTransactionCommand() leaves it. The callers both think
they are using short-lived contexts, for the express purpose of
not having to worry about cleaning up individual allocations.
The net effect therefore is that supposedly short-lived allocations
could accumulate indefinitely in the launcher's TopMemoryContext.
Although this has been broken for a long time, it seems we didn't
have any obvious memory leak here until v15's rearrangement of the
stats logic. I (tgl) am not entirely convinced that there's no
other leak at all, though, and we're surely at risk of adding one
in future back-patched fixes. So back-patch to all supported
branches, even though this may be only a latent bug in pre-v15.
Reid Thompson
Discussion: https://postgr.es/m/972a4e12b68b0f96db514777a150ceef7dcd2e0f.camel@crunchydata.com
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/cb9232d166a858e85e883212d59f6fda14ddd313
Modified Files
--------------
src/backend/postmaster/autovacuum.c | 3 +++
1 file changed, 3 insertions(+)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2022-08-31 21:09:12 | pgsql: doc: simplify WITH clause syntax in CREATE DATABASE |
Previous Message | Peter Geoghegan | 2022-08-31 18:38:51 | pgsql: Derive freeze cutoff from nextXID, not OldestXmin. |