pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: PG_DIAG_SEVERITY and a possible bug in pq_parse_errornotice()
Date: Fri, 26 Aug 2016 14:28:41 -0400
Message-ID: <6387.1472236121@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZO0TarcnkG2d9QtDTJCmmPAQdgvB1H7tgV9_tMRNN4tg@mail.gmail.com>
References: <A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at>
	<11859.1472139831@sss.pgh.pa.us>
	<CA+Tgmoa8cbvmet4zBjVggbXkq8uZfHnqL2Nxtv_jTVMKiOwCig@mail.gmail.com>
	<15203.1472145555@sss.pgh.pa.us>
	<CA+TgmobD0JZ_cunwBc4e1GZ9AuuZ8UuhYG+F066j+M_bXt-aNw@mail.gmail.com>
	<23534.1472212411@sss.pgh.pa.us>
	<16610.1472222135@sss.pgh.pa.us>
	<CA+Tgmob_sBvnxjdJCE2NLrpry0x942XqWva149uKGbyOOcmhUw@mail.gmail.com>
	<18609.1472225212@sss.pgh.pa.us>
	<CA+TgmoZO0TarcnkG2d9QtDTJCmmPAQdgvB1H7tgV9_tMRNN4tg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Aug 26, 2016 at 11:26 AM, Tom Lane <tgl@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



view thread (15+ messages)

Message-ID: <6387.1472236121@sss.pgh.pa.us>
Permalink:  ../6387.1472236121@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6387.1472236121@sss.pgh.pa.us

 · 

reply

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, robertmhaas@gmail.com
  Subject: Re: PG_DIAG_SEVERITY and a possible bug in pq_parse_errornotice()
  In-Reply-To: <6387.1472236121@sss.pgh.pa.us>
  References: <A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at> <11859.1472139831@sss.pgh.pa.us> <CA+Tgmoa8cbvmet4zBjVggbXkq8uZfHnqL2Nxtv_jTVMKiOwCig@mail.gmail.com> <15203.1472145555@sss.pgh.pa.us> <CA+TgmobD0JZ_cunwBc4e1GZ9AuuZ8UuhYG+F066j+M_bXt-aNw@mail.gmail.com> <23534.1472212411@sss.pgh.pa.us> <16610.1472222135@sss.pgh.pa.us> <CA+Tgmob_sBvnxjdJCE2NLrpry0x942XqWva149uKGbyOOcmhUw@mail.gmail.com> <18609.1472225212@sss.pgh.pa.us> <CA+TgmoZO0TarcnkG2d9QtDTJCmmPAQdgvB1H7tgV9_tMRNN4tg@mail.gmail.com> <6387.1472236121@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