Skip to content

Commit e5b7451

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 933b466 commit e5b7451

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
@@ -484,7 +484,6 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
484484
volatile PROC_HDR *procglobal = ProcGlobal;
485485
uint32 nextidx;
486486
uint32 wakeidx;
487-
int extraWaits = -1;
488487

489488
/* We should definitely have an XID to clear. */
490489
Assert(TransactionIdIsValid(allPgXact[proc->pgprocno].xid));
@@ -511,6 +510,8 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
511510
*/
512511
if (nextidx != INVALID_PGPROCNO)
513512
{
513+
int extraWaits = 0;
514+
514515
/* Sleep until the leader clears our XID. */
515516
for (;;)
516517
{

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