Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Verify database path update after resuming the thread #14334

Closed
LukasPaczos opened this issue Apr 4, 2019 · 0 comments · Fixed by #14546
Closed

Verify database path update after resuming the thread #14334

LukasPaczos opened this issue Apr 4, 2019 · 0 comments · Fixed by #14546
Assignees
Labels
Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl

Comments

@LukasPaczos
Copy link
Contributor

LukasPaczos commented Apr 4, 2019

Let's imagine this example in the Android world - we set a custom database path, receive a callback that the path has been successfully set and immediately change the path again while removing the previous directory. Pseudocode:

fileSource.changePath(TEST_PATH) {
  fileSource.changePath(ORIGINAL_PATH) {
    val testFile = File(TEST_PATH)
    if (testFile.exists()) {
      testFile.deleteRecursively()
    }
  }
}

Because we can change the path only when the default_file_source is not active, which means that its thread is going to be paused, those updates are going to be queued in the actor's queue and executed when we activate the default_file_source next time around, for example when launching the map. The issue is, that the first update's path (TEST_PATH) doesn't exist anymore and we're going to run into a

abort_message: assertion "terminating with uncaught exception of type mapbox::sqlite::Exception: unable to open database file" failed'

To resolve this issue, we can either verify the path again in the OfflineDatabase::initialize, or overwrite the updates and run only the latest one when the default_file_source's thread is resumed.

@LukasPaczos LukasPaczos added Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl labels Apr 4, 2019
@LukasPaczos LukasPaczos added this to the release-mojito milestone Apr 4, 2019
@LukasPaczos LukasPaczos modified the milestones: release-mojito, release-n Apr 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant