Merge "Make runOnTransactionIdleCallbacks() handle dangling transactions"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 10 Nov 2015 23:49:30 +0000 (23:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 10 Nov 2015 23:49:30 +0000 (23:49 +0000)
includes/db/Database.php

index 60cf0ec..99716a5 100644 (file)
@@ -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 ) );