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

Sample crashes in Android #2058

Closed
bmeine opened this issue Aug 13, 2015 · 3 comments
Closed

Sample crashes in Android #2058

bmeine opened this issue Aug 13, 2015 · 3 comments
Assignees
Labels
Android Mapbox Maps SDK for Android crash

Comments

@bmeine
Copy link

bmeine commented Aug 13, 2015

I'm using an HTC One M8 with Android version 5.0.1

I got the latest from git just a few moments ago (8/12/2015 10:40PM Central)

To reproduce I debug the sample within Android Studio and zoom in all the way then back out while panning around now and then...happens much quicker using satellite view

Before the following error, there's several "stencil mask overflow" messages as well.

Here's the logcat output for when it crashes:
08-12 22:17:09.938      454-454/? I/DEBUG﹕ *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-12 22:17:09.938      454-454/? I/DEBUG﹕ Build fingerprint: 'htc/HTCOneM8vzw/htc_m8wl:5.0.1/LRX22C/452965.5:user/release-keys'
08-12 22:17:09.938      454-454/? I/DEBUG﹕ Revision: '0'
08-12 22:17:09.938      454-454/? I/DEBUG﹕ ABI: 'arm'
08-12 22:17:09.938      454-454/? I/DEBUG﹕ pid: 3887, tid: 4262, name: HTTPAndroidCont  >>> com.mapbox.mapboxgl.testapp <<<
08-12 22:17:09.938      454-454/? I/DEBUG﹕ signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x38
08-12 22:17:09.968      454-454/? I/DEBUG﹕ r0 00000000  r1 a0de2728  r2 00000001  r3 00000000
08-12 22:17:09.968      454-454/? I/DEBUG﹕ r4 b99a50b0  r5 00000001  r6 b9123670  r7 a1333778
08-12 22:17:09.968      454-454/? I/DEBUG﹕ r8 fffff518  r9 00000000  sl 00000000  fp 000042fc
08-12 22:17:09.968      454-454/? I/DEBUG﹕ ip b52d7988  sp a0de2718  lr b50dee05  pc a10b4df4  cpsr 60070010
08-12 22:17:09.968      454-454/? I/DEBUG﹕ backtrace:
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #00 pc 001cfdf4  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so (mbgl::HTTPAndroidRequest::cancel()+240)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #01 pc 0015e620  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so (mbgl::DefaultFileSource::Impl::cancel(mbgl::Request*)+140)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #02 pc 0016082c  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so (_ZN4mbgl4util7RunLoop7InvokerIZNS0_6ThreadINS_17DefaultFileSource4ImplEE4bindIMS5_FvPNS_7RequestEEEEDaT_EUlDpOT_E_NSt3__15tupleIJS9_EEEEclEv+76)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #03 pc 001b3e78  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so (mbgl::util::RunLoop::process()+352)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #04 pc 00333454  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #05 pc 00333680  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #06 pc 0033efe8  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #07 pc 00333b40  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so (uv_run+340)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #08 pc 00160d08  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so (_ZN4mbgl4util6ThreadINS_17DefaultFileSource4ImplEE3runINSt3__15tupleIJRPNS_9FileCacheERKNS6_12basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEEEJLj0ELj1EEEEvNS0_13ThreadContextEOT_NS6_16integer_sequenceIjJXspT0_EEEE+148)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #09 pc 00160c00  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so (_ZZN4mbgl4util6ThreadINS_17DefaultFileSource4ImplEEC1IJRPNS_9FileCacheERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEEEERKNS0_13ThreadContextEDpOT_ENKUlvE_clEv+220)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #10 pc 00160ad4  /data/app/com.mapbox.mapboxgl.testapp-2/lib/arm/libmapbox-gl.so (_ZNSt3__114__thread_proxyINS_5tupleIJZN4mbgl4util6ThreadINS2_17DefaultFileSource4ImplEEC1IJRPNS2_9FileCacheERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEEEERKNS3_13ThreadContextEDpOT_EUlvE_EEEEEPvSS_+88)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #11 pc 00012f83  /system/lib/libc.so (__pthread_start(void*)+30)
08-12 22:17:09.968      454-454/? I/DEBUG﹕ #12 pc 00011047  /system/lib/libc.so (__start_thread+6)
@ljbade ljbade added Android Mapbox Maps SDK for Android crash labels Aug 13, 2015
@ljbade
Copy link
Contributor

ljbade commented Aug 13, 2015

Looks like a bug in the OkHTTP refactor #2033

@bleege bleege added this to the Android b1 milestone Aug 14, 2015
@ljbade
Copy link
Contributor

ljbade commented Aug 14, 2015

Hmm this is what I get in the log:

08-14 11:59:25.176  28890-29076/com.mapbox.mapboxgl.testapp I/OkHttpClient﹕ Callback failure for canceled call to https://www.mapbox.com/...
    java.net.ProtocolException: unexpected end of stream
            at com.squareup.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:421)
            at okio.Buffer.writeAll(Buffer.java:956)
            at okio.RealBufferedSource.readByteArray(RealBufferedSource.java:92)
            at com.squareup.okhttp.ResponseBody.bytes(ResponseBody.java:57)
            at com.mapbox.mapboxgl.http.HTTPContext$HTTPRequest.onResponse(HTTPContext.java:87)
            at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:170)
            at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: can't call void com.mapbox.mapboxgl.http.HTTPContext$HTTPRequest.cancel() on null object
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]     in call to CallVoidMethodV
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65] "HTTPAndroidContext::cancel()" prio=5 tid=38 Runnable
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x13139ec0 self=0xaecc7400
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   | sysTid=28953 nice=0 cgrp=apps sched=0/0 handle=0xb3c75000
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   | state=R schedstat=( 141092979 125854205 509 ) utm=5 stm=9 core=2 HZ=100
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   | stack=0xa189a000-0xa189c000 stackSize=1012KB
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #00 pc 00004640  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #01 pc 00002e8d  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #02 pc 0023f09d  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #03 pc 002245eb  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #04 pc 000afafb  /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #05 pc 000b0235  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #06 pc 000b0511  /system/lib/libart.so (art::ScopedCheck::CheckVirtualMethod(_jobject*, _jmethodID*)+408)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #07 pc 000ba827  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+70)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #08 pc 000d1314  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (_JNIEnv::CallVoidMethod(_jobject*, _jmethodID*, ...)+56)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #09 pc 001cfddc  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (mbgl::HTTPAndroidRequest::cancel()+184)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #10 pc 00139960  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (mbgl::DefaultFileSource::Impl::cancel(mbgl::Request*)+140)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #11 pc 0013c388  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (mbgl::util::RunLoop::Invoker<auto mbgl::util::Thread<mbgl::DefaultFileSource::Impl>::bind<void (mbgl::DefaultFileSource::Impl::*)(mbgl::Request*)>(void (mbgl::DefaultFileSource::Impl::*)(mbgl::Request*))::'lambda'(void (mbgl::DefaultFileSource::Impl::*&&)(mbgl::Request*)), std::__1::tuple<mbgl::Request*> >::operator()()+76)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #12 pc 001503b0  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (mbgl::util::RunLoop::process()+352)
08-14 11:59:29.870  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #13 pc 00333474  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (???)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #14 pc 003336a0  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (???)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #15 pc 0033f008  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (???)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #16 pc 00333b60  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (uv_run+340)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #17 pc 0013c864  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (void mbgl::util::Thread<mbgl::DefaultFileSource::Impl>::run<std::__1::tuple<mbgl::FileCache*&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>, 0u, 1u>(mbgl::util::ThreadContext, std::__1::tuple<mbgl::FileCache*&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>&&, std::__1::integer_sequence<unsigned int, 0u, 1u>)+148)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #18 pc 0013c75c  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (mbgl::util::Thread<mbgl::DefaultFileSource::Impl>::Thread<mbgl::FileCache*&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(mbgl::util::ThreadContext const&, mbgl::FileCache*&&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&&&)::'lambda'()::operator()() const+220)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #19 pc 0013c630  /data/app/com.mapbox.mapboxgl.testapp-1/lib/arm/libmapbox-gl.so (std::__1::__thread_proxy<std::__1::tuple<mbgl::util::Thread<mbgl::DefaultFileSource::Impl>::Thread<mbgl::FileCache*&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(mbgl::util::ThreadContext const&, mbgl::FileCache*&&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&&&)::'lambda'()> >(void*, void*)+88)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #20 pc 000138ef  /system/lib/libc.so (__pthread_start(void*)+30)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #21 pc 000118e3  /system/lib/libc.so (__start_thread+6)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]   (no managed stack frames)
08-14 11:59:29.871  28890-28953/com.mapbox.mapboxgl.testapp A/art﹕ art/runtime/check_jni.cc:65]
08-14 11:59:29.920  28890-28953/com.mapbox.mapboxgl.testapp A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x10 in tid 28953 (HTTPAndroidCont)

@ljbade
Copy link
Contributor

ljbade commented Aug 14, 2015

Figured out the problem, onResponse/onFailure called from different thread (Java thread created by OkHTTP) then what created the HTTPAndroidRequest.

Thus there was a race condition between cancel() and delete this causing JNI to be called on a nullptr for obj.

Correct way to handle this via a uv::async back to the original thread to perform the delete this. Copied it from the NSURL implementation.

Working on a patch now.

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

3 participants