From 2cbb042deac9905e4455952a61522fdd4034d9da Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 3 Nov 2015 13:12:14 -0800 Subject: [PATCH] Make runOnTransactionIdleCallbacks() handle dangling transactions This avoids "Got COMMIT while atomic sections X are still open" if the this DB had active transactions when an error occurred. Change-Id: I1e2eb3a3382537108ecb269c483d2e62a218b656 --- includes/db/Database.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/db/Database.php b/includes/db/Database.php index 531086b363..943667e2ac 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -3314,6 +3314,11 @@ abstract class DatabaseBase implements IDatabase { MWExceptionHandler::logException( $ePrior ); } $ePrior = $e; + // Some callbacks may use startAtomic/endAtomic, so make sure + // their transactions are ended so other callbacks don't fail + if ( $this->trxLevel() ) { + $this->rollback( __METHOD__ ); + } } } } while ( count( $this->mTrxIdleCallbacks ) ); -- 2.20.1