From: Aaron Schulz Date: Tue, 3 Nov 2015 21:12:14 +0000 (-0800) Subject: Make runOnTransactionIdleCallbacks() handle dangling transactions X-Git-Tag: 1.31.0-rc.0~9023^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=commitdiff_plain;h=2cbb042deac9905e4455952a61522fdd4034d9da;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ) );