mapbox / mapbox/mapbox-maps-flutter
Bug(android): Failed to create snapshot: snapshotting timed out.
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
MapBox version: 2.4.1
Sometimes I got a timed out exception:
`Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(2342345, Failed to create snapshot: snapshotting timed out., null, null)`
I see in the android code, current timeout is 1 second. Can we increate the timeout?
```
@RenderThread
fun snapshot(): Bitmap? {
if (!readyForSnapshot.get()) {
logE(TAG, "Could not take map snapshot because map is not ready yet.")
return null
}
val lock = ReentrantLock()
val waitCondition = lock.newCondition()
val legacyMode = snapshotLegacyModeEnabled
lock.withLock {
var snapshot: Bitmap? = null
renderThread.queueRenderEvent(
RenderEvent(
runnable = {
lock.withLock {
snapshot = performSnapshot(legacyMode)
waitCondition.signal()
}
},
needRender = true,
)
)
waitCondition.await(1, TimeUnit.SECONDS)
return snapshot
}
}
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Android snapshot() implementation shown in the issue and inspect the one-second wait around waitCondition.await. Reproduce the snapshot timeout if possible and determine whether the timeout behavior addresses the reported failure; done means timed-out snapshots no longer fail under the affected conditions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, dart, flutter, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100