tangrams / tangram-es

2D and 3D map renderer using OpenGL ES
MIT License
828 stars 240 forks source link

Crash on iOS when using mbtiles data source #2176

Open rwrx opened 4 years ago

rwrx commented 4 years ago

Hello, on iOS when using mbtiles data source, I am getting this crash:

Crashed: Thread #1
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000111d09a10

Crashed: Thread
0  libz.1.dylib                   0x1d17407bc gzclose_w + 1300
1  libz.1.dylib                   0x1d174092c gzclose_w + 1668
2  TangramMap                     0x103831198 Tangram::zlib::inflate(char const*, unsigned long, std::__1::vector<char, std::__1::allocator<char> >&) + 4382757272
3  TangramMap                     0x103749dc8 Tangram::MBTilesDataSource::getTileData(Tangram::TileID const&, std::__1::vector<char, std::__1::allocator<char> >&) + 4381810120
4  TangramMap                     0x10374b8dc std::__1::__function::__func<Tangram::MBTilesDataSource::loadTileData(std::__1::shared_ptr<Tangram::TileTask>, Tangram::TileTaskCb)::$_0, std::__1::allocator<Tangram::MBTilesDataSource::loadTileData(std::__1::shared_ptr<Tangram::TileTask>, Tangram::TileTaskCb)::$_0>, void ()>::operator()() + 4381817052
5  TangramMap                     0x10374b0d4 Tangram::AsyncWorker::run() + 4381814996
6  TangramMap                     0x10374b3c4 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (Tangram::AsyncWorker::*)(), Tangram::AsyncWorker*> >(void*) + 4381815748
7  libsystem_pthread.dylib        0x19b09fd98 _pthread_start + 156
8  libsystem_pthread.dylib        0x19b0a374c thread_start + 8

On Android, I have never seen this kind of crash. What could be wrong? Thank you.

warpedgeoid commented 3 years ago

We saw a similar crash on occasion when loading a scene with an mbtiles data source. We switched to a individual tile files in a directory structure as a workaround.

rwrx commented 3 years ago

@warpedgeoid thank you a lot for your suggestion, however in our use case we need to use mbtiles as a data source.

matteblair commented 3 years ago

Apologies for not addressing this sooner! @rwrx can you share a sample mbtiles file that produces this crash?

rwrx commented 3 years ago

@matteblair thank you. It is ok, I was also very busy. I have seen this crash directly on device - iPhone 8, but after very long time, it is happening very occasionally, but it is happening, here are some mbtiles for Slovakia country (there is vector, normal and contours data):

https://io.vecturagames.com/offline-maps/vector/slovakia_85633769_z14.mbtiles https://io.vecturagames.com/offline-maps/normal/slovakia_85633769_z10.mbtiles https://io.vecturagames.com/offline-maps/contours/slovakia_85633769_z13.mbtiles

Also I am using all of these pull requests in built Tangram-ES library:

https://github.com/tangrams/tangram-es/pull/2185 https://github.com/tangrams/tangram-es/pull/2111 https://github.com/tangrams/tangram-es/pull/2120 https://github.com/tangrams/tangram-es/pull/2142