Make DeferredUpdates exception handling more robust
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 3 Nov 2015 20:47:05 +0000 (12:47 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 3 Nov 2015 21:05:41 +0000 (13:05 -0800)
Change-Id: Ica2b8dce0978818a2f51684b97c93a3ba845d81a

includes/deferred/DeferredUpdates.php

index 0194a61..8eec202 100644 (file)
@@ -130,11 +130,13 @@ class DeferredUpdates {
                                        wfGetLBFactory()->commitMasterChanges();
                                } catch ( Exception $e ) {
                                        // We don't want exceptions thrown during deferred updates to
                                        wfGetLBFactory()->commitMasterChanges();
                                } catch ( Exception $e ) {
                                        // We don't want exceptions thrown during deferred updates to
-                                       // be reported to the user since the output is already sent.
-                                       // Instead we just log them.
+                                       // be reported to the user since the output is already sent
                                        if ( !$e instanceof ErrorPageError ) {
                                                MWExceptionHandler::logException( $e );
                                        }
                                        if ( !$e instanceof ErrorPageError ) {
                                                MWExceptionHandler::logException( $e );
                                        }
+                                       // Make sure incomplete transactions are not committed and end any
+                                       // open atomic sections so that other DB updates have a chance to run
+                                       wfGetLBFactory()->rollbackMasterChanges();
                                }
                        }
 
                                }
                        }