From 52334f9121f24ccaee0255c008e1b270c019324c Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Mon, 16 Dec 2019 15:13:45 -0800 Subject: [PATCH] Closes #6937: Disable runStorageMaintenance during startup This call will acquire a "write" lock at the storage layer (sqlite's reserved+), which may interfere with migrations that run during startup as well (they need to write to storage, and so also need to acquire a lock). If these operations clash, we get a SQLITE_BUSY crash. For now, just disable the maintenance operation. --- .../main/java/org/mozilla/fenix/FenixApplication.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index ceae78f9c..5edd19b34 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -131,11 +131,17 @@ open class FenixApplication : Application() { components.core.sessionManager.register(NotificationSessionObserver(this)) - if ((System.currentTimeMillis() - settings().lastPlacesStorageMaintenance) > ONE_DAY_MILLIS) { - runStorageMaintenance() - } + // Storage maintenance disabled, for now, as it was interfering with background migrations. + // See https://github.com/mozilla-mobile/fenix/issues/7227 for context. + // if ((System.currentTimeMillis() - settings().lastPlacesStorageMaintenance) > ONE_DAY_MILLIS) { + // runStorageMaintenance() + // } } + // See https://github.com/mozilla-mobile/fenix/issues/7227 for context. + // To re-enable this, we need to do so in a way that won't interfere with any startup operations + // which acquire reserved+ sqlite lock. Currently, Fennec migrations need to write to storage + // on startup, and since they run in a background service we can't simply order these operations. private fun runStorageMaintenance() { GlobalScope.launch(Dispatchers.IO) { // Bookmarks and history storage sit on top of the same db file so we only need to