Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0d97d7

Browse files
committed
Fix deadlock with LWLockAcquireWithVar and LWLockWaitForVar.
LWLockRelease should release all backends waiting with LWLockWaitForVar,even when another backend has already been woken up to acquire the lock,i.e. when releaseOK is false. LWLockWaitForVar can return as soon as theprotected value changes, even if the other backend will acquire the lock.Fix that by resetting releaseOK to true in LWLockWaitForVar, wheneveradding itself to the wait queue.This should fix the bug reported by MauMau, where the system occasionallyhangs when there is a lot of concurrent WAL activity and a checkpoint.Backpatch to 9.4, where this code was added.
1 parent0ff5047 commite0d97d7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎src/backend/storage/lmgr/lwlock.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,12 @@ LWLockWaitForVar(LWLock *lock, uint64 *valptr, uint64 oldval, uint64 *newval)
10051005
lock->tail=proc;
10061006
lock->head=proc;
10071007

1008+
/*
1009+
* Set releaseOK, to make sure we get woken up as soon as the lock is
1010+
* released.
1011+
*/
1012+
lock->releaseOK= true;
1013+
10081014
/* Can release the mutex now */
10091015
SpinLockRelease(&lock->mutex);
10101016

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp