From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: PostmasterContext survives into parallel workers!?
Date: Tue, 02 Aug 2016 14:06:31 -0400
Message-ID: <21144.1470161191@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoYZ7LB5erAQ7AbigruWhcHoqxhvfYOF1mVxU-XT7rs+FA@mail.gmail.com>
References: <14111.1470082717@sss.pgh.pa.us>
<CA+TgmoYZ7LB5erAQ7AbigruWhcHoqxhvfYOF1mVxU-XT7rs+FA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Aug 1, 2016 at 4:18 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Now, I'm undecided whether to flush that context only in parallel workers,
>> or to try to make it go away for all bgworkers of any stripe. The latter
>> seems a little better from a security standpoint, but I wonder if anyone
>> has a use-case where that'd be a bad idea?
> I think it would be better to get rid of it in all bgworkers.
I looked into this, and immediately found this in the spot in postmaster.c
that would be the obvious place to kill the PostmasterContext:
/* Do NOT release postmaster's working memory context */
MyBgworkerEntry = &rw->rw_worker;
StartBackgroundWorker();
This comment was in Alvaro's original commit adding bgworkers (da07a1e8).
It looks to me like the reason for it is simply not having bothered to
copy the rw->rw_worker data to somewhere that would survive deletion
of the PostmasterContext. I wonder though if anyone remembers a more
fundamental reason? Surely the bgworker is not supposed to touch any
of the rest of the BackgroundWorkerList?
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, robertmhaas@gmail.com
Subject: Re: PostmasterContext survives into parallel workers!?
In-Reply-To: <21144.1470161191@sss.pgh.pa.us>
References: <14111.1470082717@sss.pgh.pa.us> <CA+TgmoYZ7LB5erAQ7AbigruWhcHoqxhvfYOF1mVxU-XT7rs+FA@mail.gmail.com> <21144.1470161191@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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