mapbox / mapbox/mapbox-maps-flutter

Bug(android): Failed to create snapshot: snapshotting timed out.

Open
#794 3 comments 0 reactions 0 assignees View on GitHub

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.