Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Crash on NativeMapView create with React Native #7587

Closed
esamelson opened this issue Jan 3, 2017 · 9 comments
Closed

Crash on NativeMapView create with React Native #7587

esamelson opened this issue Jan 3, 2017 · 9 comments
Assignees
Labels
Android Mapbox Maps SDK for Android crash

Comments

@esamelson
Copy link

esamelson commented Jan 3, 2017

I'm using this library through the react-native-mapbox-gl repo, and I'm attempting to upgrade to version 4.2.x (the repo still uses 4.1.1). Everything goes fine if I upgrade to 4.2.0-beta.3, but starting with 4.2.0-beta.4, my app crashes as soon as the MapView component mounts. I have reproduced this minimally using the test app provided in the react-native-mapbox-gl repo, which I've forked and provided instructions for below, in case anyone wants to try reproducing this themselves.

I'm aware this is likely an issue in the react native component repo and how it handles the MapView lifecycle, but I'm unsure where to begin looking. Any insight into what might have changed between SDK betas 3 and 4 would be extremely helpful.

Thanks very much!

Platform: Android
Mapbox SDK version: 4.2.0-beta.4 or later, including stable releases

Steps to trigger behavior

  1. Clone the minimal project repo I've created at https://github.com/esamelson/mapboxtest
  2. Add a real access token in index.android.js
  3. npm/yarn install
  4. Edit node_modules/react-native-mapbox-gl/android/build.gradle to require mapbox SDK version 4.2.0-beta.4 (or later) [note: the project should run fine if you instead require 4.2.0-beta.3]
  5. Run app on a physical device using react-native run-android

Expected behavior

Map is mounted and app is usable

Actual behavior

App crashes with the following log

D/mbgl    (21457): {com.mapboxtest}[JNI]: nativeCreate
D/mbgl    (21457): {com.mapboxtest}[Android]: NativeMapView::NativeMapView
F/libc    (21457): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x20 in tid 21457 (com.mapboxtest)
I/DEBUG   (  122): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  122): Build fingerprint: 'google/nakasi/grouper:5.1.1/LMY47V/1836172:user/release-keys'
I/DEBUG   (  122): Revision: '0'
I/DEBUG   (  122): ABI: 'arm'
I/DEBUG   (  122): pid: 21457, tid: 21457, name: com.mapboxtest  >>> com.mapboxtest <<<
I/DEBUG   (  122): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
I/DEBUG   (  122):     r0 00000000  r1 400d6e30  r2 14965af0  r3 00000018
I/DEBUG   (  122):     r4 60d268f8  r5 beb97c28  r6 beb97c28  r7 60d77a0c
I/DEBUG   (  122):     r8 60d26600  r9 60d77938  sl 60d26580  fp 60d26634
I/DEBUG   (  122):     ip 6dbf28c0  sp beb97c00  lr 6d8a90ec  pc 6d8a90ec  cpsr 800b0010
I/DEBUG   (  122):
I/DEBUG   (  122): backtrace:
I/DEBUG   (  122):     #00 pc 001530ec  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  122):     #01 pc 00152274  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  122):     #02 pc 001521cc  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  122):     #03 pc 000c4548  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  122):     #04 pc 000c43b4  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  122):     #05 pc 000a93f4  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  122):     #06 pc 000b0e70  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  122):     #07 pc 002bd4e5  /data/dalvik-cache/arm/data@app@com.mapboxtest-1@base.apk@classes.dex
W/adb     (17744): type=1400 audit(0.0:15863): avc: denied { read } for name="usb" dev=tmpfs ino=5257 scontext=u:r:shell:s0 tcontext=u:object_r:usb_device:s0 tclass=dir
W/ActivityManager(  467):   Force finishing activity 1 com.mapboxtest/.MainActivity
I/DEBUG   (  122):
I/DEBUG   (  122): Tombstone written to: /data/tombstones/tombstone_00
I/BootReceiver(  467): Copying /data/tombstones/tombstone_00 to DropBox (SYSTEM_TOMBSTONE)
W/InputDispatcher(  467): channel '2851eed7 com.mapboxtest/com.mapboxtest.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
E/InputDispatcher(  467): channel '2851eed7 com.mapboxtest/com.mapboxtest.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/WindowState(  467): WIN DEATH: Window{2851eed7 u0 com.mapboxtest/com.mapboxtest.MainActivity}
W/InputDispatcher(  467): Attempted to unregister already unregistered input channel '2851eed7 com.mapboxtest/com.mapboxtest.MainActivity (server)'
I/Zygote  (  130): Process 21457 exited due to signal (11)
W/adb     (17744): type=1400 audit(0.0:15864): avc: denied { read } for name="usb" dev=tmpfs ino=5257 scontext=u:r:shell:s0 tcontext=u:object_r:usb_device:s0 tclass=dir
I/ActivityManager(  467): Process com.mapboxtest (pid 21457) has died
@tobrun tobrun added Android Mapbox Maps SDK for Android crash labels Jan 4, 2017
@tobrun tobrun changed the title Crash on NativeMapView create Crash on NativeMapView create with React Native Jan 4, 2017
@esamelson
Copy link
Author

Just wanted to clarify, the title of the issue referenced above is misleading - this is still an issue we're having. There has been no change or PR to react-native-mapbox-gl that resolves it.

@K-Leon
Copy link

K-Leon commented Jan 25, 2017

********** Crash dump: **********
Build fingerprint: 'generic/vbox86p/vbox86p:5.1/LMY47D/genymotion08250738:userdebug/test-keys'
pid: 27005, tid: 27005, name: s.testapp  >>> testapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x24
Stack frame #00 pc 001753d0  /data/app/testapp/lib/x86/libmapbox-gl.so: Routine std::__ndk1::unique_ptr<mbgl::util::RunLoop::Impl, std::__ndk1::default_delete<mbgl::util::RunLoop::Impl> >::get() const at mapbox-gl-native/mason_packages/osx-x86_64/android-ndk/x86-9-r13b/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../include/c++/4.9.x/memory:2725
Stack frame #01 pc 00174514  /data/app/testapp/lib/x86/libmapbox-gl.so: Routine Impl at mapbox-gl-native/platform/android/src/async_task.cpp:44
Stack frame #02 pc 00174457  /data/app/testapp/lib/x86/libmapbox-gl.so: Routine std::__ndk1::__unique_if<mbgl::util::AsyncTask::Impl>::__unique_single std::__ndk1::make_unique<mbgl::util::AsyncTask::Impl, std::__ndk1::function<void ()> >(std::__ndk1::function<void ()>&&) at mapbox-gl-native/mason_packages/osx-x86_64/android-ndk/x86-9-r13b/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../include/c++/4.9.x/memory:3149
Stack frame #03 pc 000d56b5  /data/app/testapp/lib/x86/libmapbox-gl.so: Routine Impl at mapbox-gl-native/src/mbgl/map/map.cpp:138 (discriminator 1)
Stack frame #04 pc 000d5532  /data/app/testapp/lib/x86/libmapbox-gl.so: Routine std::__ndk1::__unique_if<mbgl::Map::Impl>::__unique_single std::__ndk1::make_unique<mbgl::Map::Impl, mbgl::Backend&, float const&, mbgl::FileSource&, mbgl::Scheduler&, mbgl::MapMode&, mbgl::GLContextMode&, mbgl::ConstrainMode&, mbgl::ViewportMode&>(mbgl::Backend&, float const&, mbgl::FileSource&, mbgl::Scheduler&, mbgl::MapMode&, mbgl::GLContextMode&, mbgl::ConstrainMode&, mbgl::ViewportMode&) at mapbox-gl-native/mason_packages/osx-x86_64/android-ndk/x86-9-r13b/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../include/c++/4.9.x/memory:3149
Stack frame #05 pc 000b38d4  /data/app/testapp/lib/x86/libmapbox-gl.so: Routine std::__ndk1::__unique_if<mbgl::Map>::__unique_single std::__ndk1::make_unique<mbgl::Map, mbgl::android::NativeMapView&, mbgl::Size, float&, mbgl::DefaultFileSource&, mbgl::ThreadPool&, mbgl::MapMode>(mbgl::android::NativeMapView&, mbgl::Size&&, float&, mbgl::DefaultFileSource&, mbgl::ThreadPool&, mbgl::MapMode&&) at mapbox-gl-native/mason_packages/osx-x86_64/android-ndk/x86-9-r13b/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../include/c++/4.9.x/memory:3149
Stack frame #06 pc 000bce37  /data/app/testapp/lib/x86/libmapbox-gl.so: Routine (anonymous namespace)::nativeCreate(_JNIEnv*, jni::jobject*, jni::jstring*, jni::jstring*, jni::jstring*, float, int, long long) at mapbox-gl-native/platform/android/src/jni.cpp:307 (discriminator 1)
Stack frame #07 pc 000b1b37  /data/data/testapp/cache/slice-slice_6-classes.dex

I symbolicated the crash log from 4.2.2 - anyone has an idea what could solve this? It's also present in 4.2.2

cc: @tobrun

@K-Leon
Copy link

K-Leon commented Feb 3, 2017

I'm still stuck with this... i've no idea how to proceed debugging this and it's by far the largest crash i'm experiencing. Can u give me a hint how to proceed @tobrun?

@gillessed
Copy link

Anybody found anything on this? This is still a huge blocker for android with react native mapbox.

@tobrun tobrun self-assigned this Mar 10, 2017
@tobrun
Copy link
Member

tobrun commented Mar 10, 2017

I was able to reproduce the crash shown in the OP and debugged it to the mbgl::Map creation. I'm now trying to migrate to a 5.0.0 version of the SDK and see if that resolves the issue.

@tobrun
Copy link
Member

tobrun commented Mar 10, 2017

Hitting:

03-10 11:03:10.565 7251-7251/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-10 11:03:10.566 7251-7251/? A/DEBUG: Build fingerprint: 'google/sailfish/sailfish:7.1.1/NOF26V/3636322:user/release-keys'
03-10 11:03:10.566 7251-7251/? A/DEBUG: Revision: '0'
03-10 11:03:10.566 7251-7251/? A/DEBUG: ABI: 'arm'
03-10 11:03:10.567 7251-7251/? A/DEBUG: pid: 7177, tid: 7177, name: com.mapboxtest  >>> com.mapboxtest <<<
03-10 11:03:10.567 7251-7251/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
03-10 11:03:10.567 7251-7251/? A/DEBUG:     r0 00000000  r1 f1dfc664  r2 00000000  r3 3b9aca00
03-10 11:03:10.567 7251-7251/? A/DEBUG:     r4 cfde2c90  r5 ffb228e8  r6 ffb228e8  r7 ffb228b0
03-10 11:03:10.567 7251-7251/? A/DEBUG:     r8 00000000  r9 e2c1faa0  sl 00000000  fp 40280000
03-10 11:03:10.567 7251-7251/? A/DEBUG:     ip d3942b64  sp ffb228b0  lr d357e0d5  pc d357e0d4  cpsr 40070030
03-10 11:03:10.577 7251-7251/? A/DEBUG: backtrace:
03-10 11:03:10.577 7251-7251/? A/DEBUG:     #00 pc 000460d4  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.577 7251-7251/? A/DEBUG:     #01 pc 000f245b  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.577 7251-7251/? A/DEBUG:     #02 pc 000f2401  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.577 7251-7251/? A/DEBUG:     #03 pc 0009890b  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.577 7251-7251/? A/DEBUG:     #04 pc 000987fd  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.577 7251-7251/? A/DEBUG:     #05 pc 0006f37f  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.577 7251-7251/? A/DEBUG:     #06 pc 0008ab37  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.578 7251-7251/? A/DEBUG:     #07 pc 0007af45  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.578 7251-7251/? A/DEBUG:     #08 pc 0007aed5  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.578 7251-7251/? A/DEBUG:     #09 pc 0007afe1  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so
03-10 11:03:10.578 7251-7251/? A/DEBUG:     #10 pc 005a1fd7  /data/app/com.mapboxtest-1/oat/arm/base.odex (offset 0x56e000)

this symbolicates to:

********** Crash dump: **********
Build fingerprint: 'google/sailfish/sailfish:7.1.1/NOF26V/3636322:user/release-keys'
pid: 7177, tid: 7177, name: com.mapboxtest  >>> com.mapboxtest <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
Stack frame #00 pc 000460d4  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine (anonymous namespace)::looperCallbackNew(int, int, void*) at /Users/Nurbot/mapbox-gl-native/platform/android/src/run_loop.cpp:28
Stack frame #01 pc 000f245b  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine __split_buffer at /Users/Nurbot/mapbox-gl-native/mason_packages/osx-x86_64/android-ndk/arm-v7-9-r13b/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/__split_buffer:312
Stack frame #02 pc 000f2401  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine recursive_wrapper at /Users/Nurbot/mapbox-gl-native/build/android-arm-v7-9/Debug/../../../mason_packages/headers/variant/1.1.4/include/mapbox/recursive_wrapper.hpp:56 (discriminator 6)
Stack frame #03 pc 0009890b  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine std::__ndk1::__vector_base<unsigned int, std::__ndk1::allocator<unsigned int> >::__alloc() at /Users/Nurbot/mapbox-gl-native/mason_packages/osx-x86_64/android-ndk/arm-v7-9-r13b/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/vector:424 (discriminator 1)
Stack frame #04 pc 000987fd  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine ~__MBGL_C_E at /Users/Nurbot/mapbox-gl-native/src/mbgl/gl/context.cpp:333
Stack frame #05 pc 0006f37f  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine operator()<jni::jobject *> at /Users/Nurbot/mapbox-gl-native/build/android-arm-v7-9/Debug/../../../mason_packages/headers/jni.hpp/3.0.0/include/jni/native_method.hpp:60
Stack frame #06 pc 0008ab37  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > std::__ndk1::operator+<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >&&, char const*) at /Users/Nurbot/mapbox-gl-native/mason_packages/osx-x86_64/android-ndk/arm-v7-9-r13b/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/string:2748 (discriminator 1)
Stack frame #07 pc 0007af45  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine mapbox::util::detail::dispatcher<mbgl::android::conversion::GeometryEvaluator<double> const&, mapbox::geometry::geometry<double>, jni::jobject*, mapbox::geometry::line_string<double, std::__ndk1::vector>, mapbox::geometry::polygon<double, std::__ndk1::vector>, mapbox::geometry::multi_point<double, std::__ndk1::vector>, mapbox::geometry::multi_line_string<double, std::__ndk1::vector>, mapbox::geometry::multi_polygon<double, std::__ndk1::vector>, mapbox::geometry::geometry_collection<double, std::__ndk1::vector> >::apply_const(mapbox::geometry::geometry<double> const&, mbgl::android::conversion::GeometryEvaluator<double> const&) at /Users/Nurbot/mapbox-gl-native/build/android-arm-v7-9/Debug/../../../mason_packages/headers/variant/1.1.4/include/mapbox/variant.hpp:304 (discriminator 27)
Stack frame #08 pc 0007aed5  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine jni::jobject* mbgl::android::conversion::toArrayList<jni::jobject>(_JNIEnv&, jni::jarray<jni::jobject>&) at /Users/Nurbot/mapbox-gl-native/platform/android/src/geometry/conversion/../../conversion/collection.hpp:21 (discriminator 4)
Stack frame #09 pc 0007afe1  /data/app/com.mapboxtest-1/lib/arm/libmapbox-gl.so: Routine mapbox::util::detail::dispatcher<mbgl::android::conversion::GeometryEvaluator<double> const&, mapbox::geometry::geometry<double>, jni::jobject*, mapbox::geometry::multi_polygon<double, std::__ndk1::vector>, mapbox::geometry::geometry_collection<double, std::__ndk1::vector> >::apply_const(mapbox::geometry::geometry<double> const&, mbgl::android::conversion::GeometryEvaluator<double> const&) at /Users/Nurbot/mapbox-gl-native/build/android-arm-v7-9/Debug/../../../mason_packages/headers/variant/1.1.4/include/mapbox/variant.hpp:298
Stack frame #10 pc 005a1fd7  /data/app/com.mapboxtest-1/oat/arm/base.odex (offset 0x56e000)

@jfirebaugh
Copy link
Contributor

The symbolicated stack trace is nonsense, e.g. there's no way that recursive_wrapper calls __split_buffer calls looperCallbackNew. I think the symbolicator just saw random addresses on the stack or something.

@tobrun
Copy link
Member

tobrun commented Mar 10, 2017

@jfirebaugh thank you for 👀 , I thought it would be valid to build the release tag and use that with ndk-stack. As you point out the addresses don't match, though this has given me the indication that something is wrong with the thread we are loading the native library with. After making sure that the library is loaded on the main thread, I'm not seeing the crashes anymore. Currently still seeing a blank map. Working now on resolving this.

@tobrun
Copy link
Member

tobrun commented Mar 13, 2017

Crash has been identified, I created a ticket downstream covering all the requirements to update the react-native module to the latest Android SDK in nitaliano/react-native-mapbox-gl#516. Closing as resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android crash
Projects
None yet
Development

No branches or pull requests

5 participants