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

Slow MGLOfflineStorage removePack hang the map #15728

Closed
halset opened this issue Sep 28, 2019 · 5 comments · Fixed by #15837
Closed

Slow MGLOfflineStorage removePack hang the map #15728

halset opened this issue Sep 28, 2019 · 5 comments · Fixed by #15837
Assignees
Labels
Core The cross-platform C++ core, aka mbgl iOS Mapbox Maps SDK for iOS offline

Comments

@halset
Copy link
Contributor

halset commented Sep 28, 2019

Steps to reproduce

  1. Load some offline packs with a total of around 500MB tiles.
  2. call MGLOfflineStorage removePack to remove a small pack of around 20MB of tiles.
  3. Zoom or pan the map to an area where there are no tiles in the cache.

Expected behavior

The map should work right away and the delete complete after some seconds.

Actual behavior

The map will not load new tiles until the pack remove are completed and this takes around 3 minutes on a iPhone X.

Configuration

Mapbox SDK versions: 5.4.0
iOS/macOS versions: 13.1.1
Device/simulator models:
Xcode version: 11.1

Here is a screen shot from Profiler showing this delete going on for several minutes. Mainly working on a db exec in deleteRegion. Perhaps the VACUUM?

Screenshot 2019-09-29 at 00 33 55

@halset
Copy link
Contributor Author

halset commented Sep 28, 2019

Reading up on https://www.sqlite.org/lang_vacuum.html , it says that:

The VACUUM command works by copying the contents of the database into a temporary database file and then overwriting the original with the contents of the temporary file.

So, it probably tries to copy the ~480MB database? The change from auto_vacuum to vacuum seem to be from bf0be56 that was a part of #14901, but I do not know if that is relevant.

@julianrex julianrex added Core The cross-platform C++ core, aka mbgl iOS Mapbox Maps SDK for iOS labels Sep 30, 2019
@julianrex
Copy link
Contributor

Hi @halset - just to confirm - when you say the this "hangs the map" you mean that new tiles aren't displaying, rather than interaction being completely blocked?

cc @tmpsantos for VACUUM discussions

@halset
Copy link
Contributor Author

halset commented Sep 30, 2019

@julianrex Zooming and paning are fine and the UI responds, but new tiles are not loaded in to the map. Like if the device lost internet connection. I have not checked if cached tiles are also not loaded.

@halset
Copy link
Contributor Author

halset commented Sep 30, 2019

Current workaround for me is to skip vacuum in deleteRegion. The delete is then very fast and map tile loading does not suffer. The downside is that the database then probably just grows.

@halset
Copy link
Contributor Author

halset commented Oct 22, 2019

Seems like #15837 is relevant to this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl iOS Mapbox Maps SDK for iOS offline
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants