mapbox / mapbox/mapbox-maps-ios

Failed to resolve tileset descriptors: database is locked when calling TileStore.default.loadTileRegion

Open
#1,811 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Swift
Stars
601
Forks
196
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Xcode version: 14.2
- iOS version: 16
- Devices affected: iPhone XR
- Maps SDK Version: 10.9.0

## Observed behavior and steps to reproduce

We randomly (random as in "we do not know how this can happen yet") the following error when calling `TileStore.default.loadTileRegion`

`Failed to resolve tileset descriptors: database is locked`

Here are the parameters we are passing:

```
tileStore.setOptionForKey(TileStoreOptions.diskQuota, value: 1)
tileStore.setOptionForKey("tile-region-max-tile-count", domain: TileDataDomain.maps, value: IOSMapboxConstants.maxTileCount)

let tilesetDescriptors: [TilesetDescriptor] = styleUrls.compactMap { styleUrl in
guard let styleUrl = StyleURI(rawValue: styleUrl) else { return nil }

return offlineManager.createTilesetDescriptor(
for: TilesetDescriptorOptions(
styleURI: styleUrl,
zoomRange: UInt8(Constants.Companion().offlineMapMinZoomLevel)...UInt8(Constants.Companion().offlineMapMaxZoomLevel)
)
)
}

let tileRegionLoadOptions = TileRegionLoadOptions(
geometry: metadata.boundingBox.asPolygon(),
descriptors: tilesetDescriptors,
acceptExpired: true,
networkRestriction: .none
)!

tileStore.loadTileRegion(
forId: metadata.id,
loadOptions: tileRegionLoadOptions
```

We sadly do not have anymore info for now. I have added some trace logs to our released app to gather more information but any assistance on how to gather more information would be appreciated.

Even better if you are already aware of this issue

## Expected behavior

Not getting any database locker error 😅

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Xcode 14.2 and iOS 16 setup, reproducing the failure around TileStore.default.loadTileRegion and reviewing the trace logs mentioned in the issue. Done means identifying why the database-lock error occurs and verifying that tile-region loading no longer reports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
databases, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.