pgsql: Don't reset latch in ConditionVariablePrepareToSleep(). - Mailing list pgsql-committers

From Thomas Munro
Subject pgsql: Don't reset latch in ConditionVariablePrepareToSleep().
Date
Msg-id E1iwGeL-0001AX-WF@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Amit Kapila
Date:
Subject: pgsql: Added relation name in error messages for constraint checks.
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.