postgresql/src
Tom Lane 5f86cd70d8 Preserve CurrentMemoryContext across notify and sinval interrupts.
ProcessIncomingNotify is called from the main processing loop that
normally runs in MessageContext.  That outer-loop code assumes that
whatever it allocates will be cleaned up when we're done processing
the current client message --- but if we service a notify interrupt,
then whatever gets allocated before the next switch into
MessageContext will be permanently leaked in TopMemoryContext,
because CommitTransactionCommand sets CurrentMemoryContext to
TopMemoryContext.  There are observable leaks associated with
(at least) encoding conversion of incoming queries and parameters
attached to Bind messages.

sinval catchup interrupts have a similar problem.  There might be
others, but I've not identified any other clear cases.

To fix, take care to save and restore CurrentMemoryContext across
the Start/CommitTransactionCommand calls in these functions.

Per bug #18512 from wizardbrony.  Commit to back branches only;
in HEAD, this was dealt with by the riskier but more thoroughgoing
approach in commit 1afe31f03.

Discussion: https://postgr.es/m/3478884.1718656625@sss.pgh.pa.us
2024-07-01 12:21:07 -04:00
..
backend Preserve CurrentMemoryContext across notify and sinval interrupts. 2024-07-01 12:21:07 -04:00
bin Improve test coverage for changes to inplace-updated catalogs. 2024-06-27 19:21:12 -07:00
common Fix overread in JSON parsing errors for incomplete byte sequences 2024-05-09 12:45:51 +09:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include Remove comment about xl_heap_inplace "AT END OF STRUCT". 2024-06-27 19:21:13 -07:00
interfaces Remove race conditions between ECPGdebug() and ecpg_log(). 2024-05-23 15:52:06 -04:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Remove redundant perl version checks 2024-06-26 07:25:00 -04:00
port Clean up Windows-specific mutex code in libpq and ecpglib. 2024-02-09 11:11:39 -05:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:29:08 -04:00
test Remove configuration-dependent output from new inplace-inval test. 2024-06-28 09:33:44 -07:00
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools Fix MVCC bug with prepared xact with subxacts on standby 2024-06-27 21:08:55 +03:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Suppress macOS warnings about duplicate libraries in link commands. 2023-09-29 14:07:30 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00