pgsql: Preserve caller's memory context in ProcessCompletedNotifies().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Preserve caller's memory context in ProcessCompletedNotifies().
Date: 2011-05-27 16:11:34
Message-ID: E1QPzdO-0005N4-6l@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Preserve caller's memory context in ProcessCompletedNotifies().

This is necessary to avoid long-term memory leakage, because the main loop
in PostgresMain expects to be executing in MessageContext, and hence is a
bit sloppy about freeing stuff that is only needed for the duration of
processing the current client message. The known case of an actual leak
is when encoding conversion has to be done on the incoming command string,
but there might be others. Per report from Per-Olov Esgard.

Back-patch to 9.0, where the bug was introduced by the LISTEN/NOTIFY
rewrite.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/722548e4309c28631ada292fe6cad04ae8f9c151

Modified Files
--------------
src/backend/commands/async.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-05-27 18:13:46 pgsql: Improve corner cases in pg_ctl's new wait-for-postmaster-startup
Previous Message User Okbob 2011-05-27 11:13:09 orafce - orafce: new files - PostgreSQL 9.1 extensions support