From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PostmasterContext survives into parallel workers!? |
Date: | 2016-08-02 18:24:02 |
Message-ID: | 20160802182402.GA556987@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > On Mon, Aug 1, 2016 at 4:18 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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).
Hm, I don't have the development branch in this laptop. I might find
some evidence in the old one, but I won't be able to reach it till
tonight.
> 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?
I just checked BDR, which is the more complex code using workers I know
of, and I don't see any reason why this cannot be changed.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2016-08-02 18:33:47 | Re: AdvanceXLInsertBuffer vs. WAL segment compressibility |
Previous Message | Peter Eisentraut | 2016-08-02 18:11:37 | Re: PostgreSQL 10 kick-off |