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

Commit0d21f91

Browse files
committed
Fix crash when reporting CREATE INDEX progress
A race condition can make us try to dereference a NULL pointer to thePGPROC struct of a process that's already finished. That results incrashes during REINDEX CONCURRENTLY and CREATE INDEX CONCURRENTLY.This was introduced inab0dfc9, so backpatch to pg12.Reported by: Justin PryzbyReviewed-by: Michaël PaquierDiscussion:https://postgr.es/m/20191012004446.GT10470@telsasoft.com
1 parenta524f50 commit0d21f91

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

‎src/backend/commands/indexcmds.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,14 @@ WaitForOlderSnapshots(TransactionId limitXmin, bool progress)
384384

385385
if (VirtualTransactionIdIsValid(old_snapshots[i]))
386386
{
387+
/* If requested, publish who we're going to wait for. */
387388
if (progress)
388389
{
389390
PGPROC*holder=BackendIdGetProc(old_snapshots[i].backendId);
390391

391-
pgstat_progress_update_param(PROGRESS_WAITFOR_CURRENT_PID,
392-
holder->pid);
392+
if (holder)
393+
pgstat_progress_update_param(PROGRESS_WAITFOR_CURRENT_PID,
394+
holder->pid);
393395
}
394396
VirtualXactLock(old_snapshots[i], true);
395397
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -900,16 +900,14 @@ WaitForLockersMultiple(List *locktags, LOCKMODE lockmode, bool progress)
900900

901901
while (VirtualTransactionIdIsValid(*lockholders))
902902
{
903-
/*
904-
* If requested, publish who we're going to wait for. This is not
905-
* 100% accurate if they're already gone, but we don't care.
906-
*/
903+
/* If requested, publish who we're going to wait for. */
907904
if (progress)
908905
{
909906
PGPROC*holder=BackendIdGetProc(lockholders->backendId);
910907

911-
pgstat_progress_update_param(PROGRESS_WAITFOR_CURRENT_PID,
912-
holder->pid);
908+
if (holder)
909+
pgstat_progress_update_param(PROGRESS_WAITFOR_CURRENT_PID,
910+
holder->pid);
913911
}
914912
VirtualXactLock(*lockholders, true);
915913
lockholders++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp