Robert Haas <robertmh...@gmail.com> writes:
> On Fri, Aug 26, 2016 at 11:26 AM, Tom Lane <t...@sss.pgh.pa.us> wrote:
>> I'm not quite sure what to do about this.  It feels a tad wrong to use
>> ErrorContext as the active context during HandleParallelMessages, but
>> what else should we use?  Maybe this needs its very own private context
>> that we can reset after each use?

> If we use ErrorContext, will anything go wrong?

I think it might, if we were unlucky enough to be doing this while the
leader was engaged in reporting some other error for its own reasons.
To avoid accumulated memory leakage over multiple worker error reports,
we ought to do a MemoryContextReset at the start or end (probably start)
of HandleParallelMessages, and that would be problematic if ErrorContext
had some data in it already.  It's possible that the scenario can't occur
because CHECK_FOR_INTERRUPTS is never done inside error processing, but
I would not feel very comfortable with that assumption.

I'm thinking a dedicated context is the way to go.  It won't take very
much code.

                        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 via email to