Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6032991

Browse files
committed
Fix possible leak of semaphore count.
Commit 4aec498 reorganized the order of operations here so that we no longer increment the number of "extra waits" before locking the semaphore, but it did not change the starting value of extraWaits from 0 to -1 to compensate. In the worst case, this could leak a semaphore count, but that seems to be unlikely in practice. Discussion: http://postgr.es/m/CAA4eK1JyVqXiMba+-a589Rk0pyHsyKkGxeumVKjU6Y74hdrVLQ@mail.gmail.com Amit Kapila, per an off-list report by Dilip Kumar. Reviewed by me.
1 parent 5b4f8f4 commit 6032991

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
491491
volatile PROC_HDR *procglobal = ProcGlobal;
492492
uint32 nextidx;
493493
uint32 wakeidx;
494-
int extraWaits = -1;
495494

496495
/* We should definitely have an XID to clear. */
497496
Assert(TransactionIdIsValid(allPgXact[proc->pgprocno].xid));
@@ -518,6 +517,8 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
518517
*/
519518
if (nextidx != INVALID_PGPROCNO)
520519
{
520+
int extraWaits = 0;
521+
521522
/* Sleep until the leader clears our XID. */
522523
for (;;)
523524
{

0 commit comments

Comments
 (0)