Closed D10NGYANG closed 7 months ago
I have exactly the same issue but slightly different case (multiple workers downloading different tile regions which may overlap, but I'm not sure if this is the real root cause). Crashes seem more random and not all devices seem to be affected. Currently I'm able to reproduce it on Pixel 6 with Android 14. I've tried other Android 14 devices (e.g. Galaxy Tab S6 Lite) and it works correctly. Also OnePlus 9 with Android 13 seem to work fine. Also some Lenovo tablet with Android 10 does not report crashes. I can post my crash log but it looks much more like above. Limit of 51200 references reached, Buffer and DataRef one after each other, etc.
Mapbox v11.1
@RealFictionFactory
@kiryldz
@RealFictionFactory are you also using Jetpack Compose as in the code in issue description?
@kiryldz Nope. We launched several CoroutineWorkers (in the main dispatcher of course) that download several tile regions. It does not matter if Workers are launched in groups or as unique jobs. Usually, it crashes on downloading the tile region that contains most of the points. So far we had no crashes when downloading only one tile region but maybe it depends on how many points it contains and the area those points cover.
Some additional notes. Maybe this will help.
It doesn't matter if I do loadStylePack before or not (just loadTiles, like in example from the first post).
Sometimes I can see warnings with HTTP 429 statuses from Mapbox and sometimes not when crash happens so delay because of that should not have an impact on crash.
This is Geometry for which tile region is downloaded and crashes:
MultiPoint{type=MultiPoint, bbox=null, coordinates=[Point{type=Point, bbox=null, coordinates=[0.0, 0.0]}, Point{type=Point, bbox=null, coordinates=[14.436532, 35.826528]}, Point{type=Point, bbox=null, coordinates=[14.441787, 35.827686]}, Point{type=Point, bbox=null, coordinates=[14.511931, 35.89339]}, Point{type=Point, bbox=null, coordinates=[0.0, 0.0]}, Point{type=Point, bbox=null, coordinates=[14.509771, 35.896282]}, Point{type=Point, bbox=null, coordinates=[14.188232, 36.053514]}, Point{type=Point, bbox=null, coordinates=[14.493742, 35.915075]}, Point{type=Point, bbox=null, coordinates=[14.528094, 35.836536]}, Point{type=Point, bbox=null, coordinates=[0.0, 0.0]}, Point{type=Point, bbox=null, coordinates=[0.0, 0.0]}, Point{type=Point, bbox=null, coordinates=[139.78244, 35.699342]}, Point{type=Point, bbox=null, coordinates=[-72.5254412, -13.1547062]}, Point{type=Point, bbox=null, coordinates=[-72.2642679, -13.2583689]}, Point{type=Point, bbox=null, coordinates=[130.4415237, 33.665107]}, Point{type=Point, bbox=null, coordinates=[-85.8054879, 30.1765914]}, Point{type=Point, bbox=null, coordinates=[24.1056221, 56.9676941]}, Point{type=Point, bbox=null, coordinates=[22.0253844, 50.0310627]}, Point{type=Point, bbox=null, coordinates=[14.34312, 35.974713]}, Point{type=Point, bbox=null, coordinates=[14.397791, 35.880955]}, Point{type=Point, bbox=null, coordinates=[14.5127, 35.897837]}, Point{type=Point, bbox=null, coordinates=[21.8540812, 50.0171156]}, Point{type=Point, bbox=null, coordinates=[21.82, 50.009953]}, Point{type=Point, bbox=null, coordinates=[36.2636, 51.65764]}, Point{type=Point, bbox=null, coordinates=[20.764218, 39.645963]}, Point{type=Point, bbox=null, coordinates=[21.85, 50.018]}, Point{type=Point, bbox=null, coordinates=[22.7530111, 50.29954]}, Point{type=Point, bbox=null, coordinates=[22.0685343, 50.0146319]}, Point{type=Point, bbox=null, coordinates=[22.4937548, 50.0583341]}, Point{type=Point, bbox=null, coordinates=[21.9891106, 50.0186761]}, Point{type=Point, bbox=null, coordinates=[18.5984214, 53.0138191]}, Point{type=Point, bbox=null, coordinates=[22.0091208, 50.0496673]}, Point{type=Point, bbox=null, coordinates=[16.7382037, 53.1509859]}, Point{type=Point, bbox=null, coordinates=[17.0385548, 51.1078821]}, Point{type=Point, bbox=null, coordinates=[21.015462, 52.2291168]}, Point{type=Point, bbox=null, coordinates=[22.013293, 50.0284103]}]}
I've created separate activity inside our project and it crashes on the following set of points (a bit more than above).
` class CrashTestActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_crash_test) mapboxOfflineTest() }
private fun mapboxOfflineTest() {
val offlineManager = OfflineManager()
val tilesetDescriptor = offlineManager.createTilesetDescriptor(
TilesetDescriptorOptions.Builder()
.styleURI(Style.OUTDOORS)
.minZoom(0)
.maxZoom(16)
.build()
)
val tileRegionLoadOptions = TileRegionLoadOptions.Builder()
.geometry(createPoints())
.descriptors(listOf(tilesetDescriptor))
.acceptExpired(true)
.networkRestriction(NetworkRestriction.NONE)
.build()
val tileStore = TileStore.create()
val tileRegionCancelable = tileStore.loadTileRegion(
"offlinecrashtest",
tileRegionLoadOptions,
{ progress ->
println("offline progress:$progress")
}
) { expected ->
if (expected.isValue) {
// Tile region download finishes successfully
expected.value?.let {
println("offline result,$it")
}
}
expected.error?.let {
// Handle errors that occurred during the tile region download.
println("offline error: ${it}")
}
}
}
private fun createPoints(): Geometry {
val pointList = listOf(
Point.fromLngLat(18.7948147, 52.8790493),
Point.fromLngLat(-82.6979351, 27.4652927),
Point.fromLngLat(-86.902298, 32.3182314),
Point.fromLngLat(-97.5164276, 35.4675602),
Point.fromLngLat(-111.0937311, 39.3209801),
Point.fromLngLat(-95.5377215, 29.6185669),
Point.fromLngLat(-74.0059728, 40.7127753),
Point.fromLngLat(-84.2700179, 37.8393332),
Point.fromLngLat(-122.4194155, 37.7749295),
Point.fromLngLat(-98.4945922, 29.4251905),
Point.fromLngLat(18.7948147, 52.8790493),
Point.fromLngLat(14.441787, 35.827686),
Point.fromLngLat(14.509771, 35.896282),
Point.fromLngLat(14.511931, 35.89339),
Point.fromLngLat(14.528094, 35.836536),
Point.fromLngLat(-7.9879296, 31.6329983),
Point.fromLngLat(-72.2642679, -13.2583689),
Point.fromLngLat(-72.5254412, -13.1547062),
Point.fromLngLat(14.493742, 35.915075),
Point.fromLngLat(-9.7959788, 31.3558178),
Point.fromLngLat(14.436532, 35.826528),
Point.fromLngLat(0.0, 0.0),
Point.fromLngLat(-7.7632607, 31.3583253),
Point.fromLngLat(0.0, 0.0),
Point.fromLngLat(0.0, 0.0),
Point.fromLngLat(130.4415237, 33.665107),
Point.fromLngLat(-6.153352, 29.8056293),
Point.fromLngLat(14.188232, 36.053514),
Point.fromLngLat(-6.153352, 29.8056293),
Point.fromLngLat(0.0, 0.0),
Point.fromLngLat(25.4501846, 36.3831048),
Point.fromLngLat(34.595581, 31.522694),
Point.fromLngLat(139.78244, 35.699342),
Point.fromLngLat(22.0253844, 50.0310627),
Point.fromLngLat(14.34312, 35.974713),
Point.fromLngLat(-6.153352, 29.8056293),
Point.fromLngLat(22.0090041, 50.0495154),
Point.fromLngLat(22.490404, 50.0558258),
Point.fromLngLat(22.4905856, 50.0558821),
Point.fromLngLat(22.0671666, 50.1143897),
Point.fromLngLat(22.0049195, 50.037125),
Point.fromLngLat(22.0050053, 50.0372421),
Point.fromLngLat(21.9988924, 50.0421225),
Point.fromLngLat(14.279725, 50.0801628),
Point.fromLngLat(21.015462, 52.2291168),
Point.fromLngLat(21.015462, 52.2291168),
Point.fromLngLat(16.7382037, 53.1509859),
Point.fromLngLat(16.1553263, 51.2069962),
Point.fromLngLat(18.6326253, 54.4077955),
Point.fromLngLat(21.0094913, 52.2490297),
Point.fromLngLat(22.013293, 50.0284103)
)
return MultiPoint.fromLngLats(pointList)
}
}
` Layout file used in the sample is an empty one provided by Android Studio when creating empty activity.
@RealFictionFactory thanks, I was just writing the comment asking you to provide reproducible code if possible 😄 . We'll take a look.
I've realised there are several points duplicated in my sample. Removing duplicates and leaving only one copy of them did not helped. The crash still happens.
Just to confirm, I've just created a clean Empty Views android project using Android Studio, then used exact code I pasted above and it crashes.
@RealFictionFactory FYI this was reproduced locally from our end, thanks for the code! We will take a look.
@kiryldz Thank you for the information. Since the delay's affecting our release timeline and customer expectations, any idea when we can expect a fix? Would really appreciate an update.
@kiryldz Thank you for the information. Since the delay's affecting our release timeline and customer expectations, any idea when we can expect a fix? Would really appreciate an update.
@RealFictionFactory the fix is WIP and is expected in v11.3.0-rc.1 release coming out W13 (in 2 weeks).
This should be fixed in https://github.com/mapbox/mapbox-maps-android/releases/tag/v11.3.0-rc.1.
@kiryldz Thanks. First quick tests show that it doesn't crash anymore.
Environment
MyCode
LOG