Bug 1034977 - "Crash in mozalloc_abort(char const* const) | NS_DebugBreak | nsDebugImpl::Abort(char const*, int) with AsyncShutdownTimer "Sqlite.jsm Waiting for connections to close"" r=gps, a=sledru
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Mon, 07 Jul 2014 06:29:00 +0200
changeset 207951 a3dce4eedb9a35fa82199b84d75bdb01d3cc1f04
parent 207950 65af5e10bfe45c0cbcaf412ab5ccf60dde81bc1d
child 207952 49f3928fe06297ad205123d7a870cd5a38c70f15
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, sledru
bugs1034977
milestone32.0a2
Bug 1034977 - "Crash in mozalloc_abort(char const* const) | NS_DebugBreak | nsDebugImpl::Abort(char const*, int) with AsyncShutdownTimer "Sqlite.jsm Waiting for connections to close"" r=gps, a=sledru
toolkit/modules/Sqlite.jsm
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -353,20 +353,29 @@ function OpenedConnection(connection, ba
   if (this._idleShrinkMS) {
     this._idleShrinkTimer = Cc["@mozilla.org/timer;1"]
                               .createInstance(Ci.nsITimer);
     // We wait for the first statement execute to start the timer because
     // shrinking now would not do anything.
   }
 
   this._deferredClose = Promise.defer();
+  this._closeRequested = false;
 
   Barriers.connections.client.addBlocker(
     this._connectionIdentifier + ": waiting for shutdown",
-    this._deferredClose.promise
+    this._deferredClose.promise,
+    () =>  ({
+      identifier: this._connectionIdentifier,
+      isCloseRequested: this._closeRequested,
+      hasDbConn: !!this._dbConn,
+      hasInProgressTransaction: !!this._inProgressTransaction,
+      pendingStatements: this._pendingStatements.size,
+      statementCounter: this._statementCounter,
+    })
   );
 }
 
 OpenedConnection.prototype = Object.freeze({
   TRANSACTION_DEFERRED: "DEFERRED",
   TRANSACTION_IMMEDIATE: "IMMEDIATE",
   TRANSACTION_EXCLUSIVE: "EXCLUSIVE",
 
@@ -414,16 +423,18 @@ OpenedConnection.prototype = Object.free
    * Successive calls to close() return the same promise.
    *
    * IMPROVEMENT: Resolve the promise to a closed connection which can be
    * reopened.
    *
    * @return Promise<>
    */
   close: function () {
+    this._closeRequested = true;
+
     if (!this._connection) {
       return this._deferredClose.promise;
     }
 
     this._log.debug("Request to close connection.");
     this._clearIdleShrinkTimer();
 
     // We need to take extra care with transactions during shutdown.