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

Commit2897e06

Browse files
committed
Fix rare core dump in BackendIdGetTransactionIds().
BackendIdGetTransactionIds() neglected the possibility that the PROCpointer in a ProcState array entry is null. In current usage, this couldonly crash if the other backend had exited since pgstat_read_current_statussaw it as active, which is a pretty narrow window. But it's reachable inthe field, per bug #12918 from Vladimir Borodin.Back-patch to 9.4 where the faulty code was introduced.
1 parentf444de5 commit2897e06

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

‎src/backend/storage/ipc/sinvaladt.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,7 @@ BackendIdGetProc(int backendID)
410410
void
411411
BackendIdGetTransactionIds(intbackendID,TransactionId*xid,TransactionId*xmin)
412412
{
413-
ProcState*stateP;
414413
SISeg*segP=shmInvalBuffer;
415-
PGXACT*xact;
416414

417415
*xid=InvalidTransactionId;
418416
*xmin=InvalidTransactionId;
@@ -422,11 +420,16 @@ BackendIdGetTransactionIds(int backendID, TransactionId *xid, TransactionId *xmi
422420

423421
if (backendID>0&&backendID <=segP->lastBackend)
424422
{
425-
stateP=&segP->procState[backendID-1];
426-
xact=&ProcGlobal->allPgXact[stateP->proc->pgprocno];
423+
ProcState*stateP=&segP->procState[backendID-1];
424+
PGPROC*proc=stateP->proc;
427425

428-
*xid=xact->xid;
429-
*xmin=xact->xmin;
426+
if (proc!=NULL)
427+
{
428+
PGXACT*xact=&ProcGlobal->allPgXact[proc->pgprocno];
429+
430+
*xid=xact->xid;
431+
*xmin=xact->xmin;
432+
}
430433
}
431434

432435
LWLockRelease(SInvalWriteLock);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp