From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: HandleParallelMessages contains CHECK_FOR_INTERRUPTS?
Date: Mon, 01 Aug 2016 16:37:28 -0400
Message-ID: <14869.1470083848@sss.pgh.pa.us> (raw)
In-Reply-To: <20160801202058.GA529842@alvherre.pgsql>
References: <20160801202058.GA529842@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Tom Lane wrote:
>> $SUBJECT seems like a pretty bad idea, because it implies a recursive
>> entry to ProcessInterrupts and thence to HandleParallelMessages itself.
>> By what reasoning is that call necessary where it's placed?
> I notice you just removed the CHECK_FOR_INTERRUPTS in
> HandleParallelMessages(). Did you notice that HandleParallelMessages
> calls shm_mq_receive(), which calls shm_mq_receive_bytes(), which
> contains a CHECK_FOR_INTERRUPTS() call?
I figured there were probably other cases of recursion; it's unlikely
we could prevent them altogether. But a check in a function that's
called *only* from ProcessInterrupts seems pretty dubious.
I wonder whether we should make use of HOLD_INTERRUPTS/RESUME_INTERRUPTS
to avoid the recursion scenario here. It's not really clear to me whether
this stack of function would behave sanely if it's invoked recursively
when the outer level is partway through reading a message. At the very
least, it seems like there might be a risk for out-of-order message
processing (inner recursion reads and processes next message while outer
level has read but not yet processed previous message).
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@2ndquadrant.com
Subject: Re: HandleParallelMessages contains CHECK_FOR_INTERRUPTS?
In-Reply-To: <14869.1470083848@sss.pgh.pa.us>
References: <20160801202058.GA529842@alvherre.pgsql> <14869.1470083848@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