diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-12-21 09:09:04 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-12-21 09:24:48 -0500 |
commit | f3decdc94ea3dea05715325757db7b0295672bbe (patch) | |
tree | 7d46e9a5bb5fea5d3af0879788ab7db80b9137b0 | |
parent | 7be0d775a2e78d052c00f154741e9d8d76166fa3 (diff) | |
download | postgresql-f3decdc94ea3dea05715325757db7b0295672bbe.tar.gz postgresql-f3decdc94ea3dea05715325757db7b0295672bbe.zip |
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
-rw-r--r-- | src/backend/access/transam/xact.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 5e7e8122003..d43819a3e7f 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -4596,6 +4596,9 @@ AbortSubTransaction(void) /* Reset WAL record construction state */ XLogResetInsertion(); + /* Cancel condition variable sleep */ + ConditionVariableCancelSleep(); + /* * Also clean up any open wait for lock, since the lock manager will choke * if we try to wait for another lock before doing this. |