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

Commit f3decdc

Browse files
committed
Cancel CV sleep during subtransaction abort.
Generally, error recovery paths that need to do things like LWLockReleaseAll and pgstat_report_wait_end also need to call ConditionVariableCancelSleep, but AbortSubTransaction was missed. Since subtransaction abort might destroy up the DSM segment that contains the ConditionVariable stored in cv_sleep_target, this can result in a crash for anything using condition variables. Reported and diagnosed by Andres Freund. Discussion: http://postgr.es/m/20171221110048.rxk6464azzl5t2fi@alap3.anarazel.de
1 parent 7be0d77 commit f3decdc

File tree

1 file changed

+3
-0
lines changed
  • src/backend/access/transam

1 file changed

+3
-0
lines changed

src/backend/access/transam/xact.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4596,6 +4596,9 @@ AbortSubTransaction(void)
45964596
/* Reset WAL record construction state */
45974597
XLogResetInsertion();
45984598

4599+
/* Cancel condition variable sleep */
4600+
ConditionVariableCancelSleep();
4601+
45994602
/*
46004603
* Also clean up any open wait for lock, since the lock manager will choke
46014604
* if we try to wait for another lock before doing this.

0 commit comments

Comments
 (0)