Skip to content

Commit 78aaa0e

Browse files
committed
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 1321509, 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
1 parent 05f18c6 commit 78aaa0e

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/backend/storage/lmgr/condition_variable.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,6 @@ ConditionVariablePrepareToSleep(ConditionVariable *cv)
9393
/* Record the condition variable on which we will sleep. */
9494
cv_sleep_target = cv;
9595

96-
/*
97-
* Reset my latch before adding myself to the queue, to ensure that we
98-
* don't miss a wakeup that occurs immediately.
99-
*/
100-
ResetLatch(MyLatch);
101-
10296
/* Add myself to the wait queue. */
10397
SpinLockAcquire(&cv->mutex);
10498
proclist_push_tail(&cv->wakeup, pgprocno, cvWaitLink);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy