pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't reset latch in ConditionVariablePrepareToSleep().
Date: Tue, 28 Jan 2020 02:30:46 +0000
Message-ID: <E1iwGeL-0001AX-WF@gemulon.postgresql.org> (raw)

Don't reset latch in ConditionVariablePrepareToSleep().

It's not OK to do that without calling CHECK_FOR_INTERRUPTS().
Let the next wait loop deal with it, following the usual pattern.

One consequence of this bug was that a SIGTERM delivered in a very
narrow timing window could leave a parallel worker process waiting
forever for a condition variable that will never be signaled, after
an error was raised in other process.

The code is a bit different in the stable branches due to commit
1321509f, making problems less likely there.  No back-patch for now,
but we may finish up deciding to make a similar change after more
discussion.

Author: Thomas Munro
Reviewed-by: Shawn Debnath
Reported-by: Tomas Vondra
Discussion: https://postgr.es/m/CA%2BhUKGJOm8zZHjVA8svoNT3tHY0XdqmaC_kHitmgXDQM49m1dA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/78aaa0e82335527b8cc91601c98c9abbbc3ef3ee

Modified Files
--------------
src/backend/storage/lmgr/condition_variable.c | 6 ------
1 file changed, 6 deletions(-)



Message-ID: <E1iwGeL-0001AX-WF@gemulon.postgresql.org>
Permalink:  ../E1iwGeL-0001AX-WF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iwGeL-0001AX-WF@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tmunro@postgresql.org
  Subject: Re: pgsql: Don't reset latch in ConditionVariablePrepareToSleep().
  In-Reply-To: <E1iwGeL-0001AX-WF@gemulon.postgresql.org>
  References: <E1iwGeL-0001AX-WF@gemulon.postgresql.org>

* 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