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

Map crashes in airplane mode (iOS v3.0.1). #3280

Closed
DejanRistic opened this issue Dec 14, 2015 · 26 comments
Closed

Map crashes in airplane mode (iOS v3.0.1). #3280

DejanRistic opened this issue Dec 14, 2015 · 26 comments
Labels
crash iOS Mapbox Maps SDK for iOS

Comments

@DejanRistic
Copy link

The map will crash every time when initializing when in airplane mode if the map has been loaded at least once. The map is just black if its a fresh install with airplane mode, but if its been loaded once before we get a crash.

Error:

libc++abi.dylib: terminating with uncaught exception of type mbgl::util::SpriteLoadingException: Failed to load [mapbox://sprites/roadtrippers/cignsecsw001aa6ksebcdpmrl@2x.json]: The operation couldn’t be completed. (NSURLErrorDomain error -1009.)

StackTrace:

* thread #19: tid = 0x21a7, 0x31af6dfc libsystem_kernel.dylib`__pthread_kill + 8, name = 'Map', stop reason = signal SIGABRT
  * frame #0: 0x31af6dfc libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x31b74d36 libsystem_pthread.dylib`pthread_kill + 62
    frame #2: 0x31a96908 libsystem_c.dylib`abort + 76
    frame #3: 0x30dd29c8 libc++abi.dylib`abort_message + 88
    frame #4: 0x30dec63a libc++abi.dylib`default_terminate_handler() + 214
    frame #5: 0x314b0f48 libobjc.A.dylib`_objc_terminate() + 228
    frame #6: 0x30de9de2 libc++abi.dylib`std::__terminate(void (*)()) + 78
    frame #7: 0x30de9ee0 libc++abi.dylib`std::terminate() + 156
    frame #8: 0x30d8d16e libc++.1.dylib`std::rethrow_exception(std::exception_ptr) + 14
    frame #9: 0x004736f4 Roadtrippers`mbgl::Style::emitResourceLoadingFailed(std::exception_ptr) + 108
    frame #10: 0x00473be0 Roadtrippers`non-virtual thunk to mbgl::Style::onSpriteLoadingFailed(std::exception_ptr) + 92
    frame #11: 0x00457fca Roadtrippers`mbgl::SpriteStore::emitSpriteLoadingFailed(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 234
    frame #12: 0x00458910 Roadtrippers`___lldb_unnamed_function327$$Roadtrippers + 464
    frame #13: 0x0045d6f8 Roadtrippers`mbgl::Request::notifyCallback() + 156
    frame #14: 0x003d2276 Roadtrippers`___lldb_unnamed_function119$$Roadtrippers + 66
    frame #15: 0x003d23a4 Roadtrippers`___lldb_unnamed_function120$$Roadtrippers + 120
    frame #16: 0x003d5270 Roadtrippers`uv__io_poll + 1000
    frame #17: 0x003d25b0 Roadtrippers`uv_run + 232
    frame #18: 0x00421c04 Roadtrippers`void mbgl::util::Thread<mbgl::MapContext>::run<std::__1::tuple<mbgl::View&, mbgl::FileSource&, mbgl::MapData&>, 0ul, 1ul, 2ul>(mbgl::util::ThreadContext, std::__1::tuple<mbgl::View&, mbgl::FileSource&, mbgl::MapData&>&&, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul>) + 196
    frame #19: 0x00421ad2 Roadtrippers`std::__1::__thread_proxy<std::__1::tuple<mbgl::util::Thread<mbgl::MapContext>::Thread<mbgl::View&, mbgl::FileSource&, mbgl::MapData&>(mbgl::util::ThreadContext const&, mbgl::View&&&, mbgl::FileSource&&&, mbgl::MapData&&&)::'lambda'()> >(void*, void*) + 234
    frame #20: 0x31b73e92 libsystem_pthread.dylib`_pthread_body + 138
    frame #21: 0x31b73e06 libsystem_pthread.dylib`_pthread_start + 118
    frame #22: 0x31b71b90 libsystem_pthread.dylib`thread_start + 8
@DejanRistic DejanRistic changed the title Map crashes in airplane mode (v3.0.1). Map crashes in airplane mode (iOS v3.0.1). Dec 14, 2015
@friedbunny
Copy link
Contributor

I can't reproduce this with ios-app on master d2d722a — killing and reloading the app while in airplane mode with a warmed cache shows the cached resources where available and the style's background color where missing.

(I do see some strange flashing/stuttering while zooming and the marker image does not load, though.)

Until offline support is implemented, the behavior in these types of situations is largely undefined and untested. Styles, sprites, vector tiles, and glyphs all typically require a network connection right now, which means that you may better off not showing the map at all if there's no connection.

@jfirebaugh
Copy link
Contributor

The error is coming from this line. SpriteLoadingException does inherit from std::exception, via Exceptionstd::runtime_error, so should be caught by the subsequent catch(const std::exception& e).

@DejanRistic are you building your own custom copy of Mapbox GL? If so, are you changing the compiler settings in some way that could cause C++ exception handling to stop working correctly, e.g. disabling RTTI?

@DejanRistic
Copy link
Author

@jfirebaugh We aren't doing anything custom actually. We are just using pods to pull in the iOS SDK. The crash above happens on either:

pod 'Mapbox-iOS-SDK'

or

pod 'Mapbox-iOS-SDK', '3.0.1'

I assume those are the same at this point. The weird thing is that the crash does not happen when using:

pod 'Mapbox-iOS-SDK', '3.0.0'

Doing the same steps in 3.0.0 results in the following errors in the console but no crashes.

[ERROR] {Map}[Style]: Failed to load [mapbox://sprites/roadtrippers/cignsecsw001aa6ksebcdpmrl@2x.json]: The operation couldn’t be completed. (NSURLErrorDomain error -1009.)
[ERROR] {Map}[Style]: Failed to load [mapbox://sprites/roadtrippers/cignsecsw001aa6ksebcdpmrl@2x.png]: The operation couldn’t be completed. (NSURLErrorDomain error -1009.)

But when on 3.0.1 the crash happens instead. I know since 3.0.1 CocoaPods is now distributed via a static framework. But i'm not sure that could cause exceptions to stop working.

Another thing to note is that we were able to get a similar crash sometimes by just switching to airplane mode while in the app and panning around (more rare).

@jfirebaugh
Copy link
Contributor

cc @1ec5

@1ec5
Copy link
Contributor

1ec5 commented Dec 15, 2015

As @DejanRistic points out, we did switch to a static framework in 3.0.1 and start stripping more aggressively, as a stopgap until I land the dynamic framework in #3183. I don't know how just stuffing the static library inside a framework bundle would make any difference here, but perhaps the stripping that takes place in framework.sh effectively changes symbol visibility? (cc @incanus)

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS crash labels Dec 22, 2015
@mpetroff
Copy link

mpetroff commented Jan 3, 2016

I'm able to consistently reproduce what appears to be the same error on Android, using the test app.

On a clean emulator (Nexus 5, API 23, x86):

  1. Open test app with data connection enabled.
  2. Close test app.
  3. Turn on airplane mode.
  4. Open test app again.

Error:

01-02 20:38:35.200 19032-19058/com.mapbox.mapboxsdk.testapp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdeadcab1 in tid 19058 (Map Thread)

Stack trace:

01-02 20:38:35.315 949-949/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-02 20:38:35.315 949-949/? A/DEBUG: Build fingerprint: 'Android/sdk_google_phone_x86/generic_x86:6.0/MASTER/2497369:userdebug/test-keys'
01-02 20:38:35.315 949-949/? A/DEBUG: Revision: '0'
01-02 20:38:35.315 949-949/? A/DEBUG: ABI: 'x86'
01-02 20:38:35.315 949-949/? A/DEBUG: pid: 19032, tid: 19058, name: Map Thread  >>> com.mapbox.mapboxsdk.testapp <<<
01-02 20:38:35.315 949-949/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdeadcab1
01-02 20:38:35.317 949-949/? A/DEBUG:     eax a3ecef70  ebx a3ff7720  ecx a3ecef70  edx 00000000
01-02 20:38:35.317 949-949/? A/DEBUG:     esi a3858eb0  edi a3858f08
01-02 20:38:35.317 949-949/? A/DEBUG:     xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000057  xss 0000007b
01-02 20:38:35.317 949-949/? A/DEBUG:     eip a3ecef86  ebp a3858e28  esp a3858e10  flags 00210292
01-02 20:38:35.318 949-949/? A/DEBUG:     #00 pc 00374f86  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so
01-02 20:38:35.318 949-949/? A/DEBUG:     #01 pc 00374fc5  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so
01-02 20:38:35.318 949-949/? A/DEBUG:     #02 pc 00374f66  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (std::terminate()+38)
01-02 20:38:35.318 949-949/? A/DEBUG:     #03 pc 00375b57  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (std::rethrow_exception(std::exception_ptr)+39)
01-02 20:38:35.318 949-949/? A/DEBUG:     #04 pc 0012d952  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (mbgl::util::toString(std::exception_ptr)+66)
01-02 20:38:35.319 949-949/? A/DEBUG:     #05 pc 0019e538  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (mbgl::Style::onSpriteError(std::exception_ptr)+88)
01-02 20:38:35.319 949-949/? A/DEBUG:     #06 pc 0019e6ca  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (non-virtual thunk to mbgl::Style::onSpriteError(std::exception_ptr)+42)
01-02 20:38:35.319 949-949/? A/DEBUG:     #07 pc 001cf2b1  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so
01-02 20:38:35.319 949-949/? A/DEBUG:     #08 pc 002020fe  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so ('lambda'(auto mbgl::util::Thread<mbgl::OnlineFileSource::Impl>::bind<void (mbgl::OnlineFileSource::Impl::*)(mbgl::Resource, mbgl::FileRequest*, std::__1::function<void (mbgl::Response)>)>(void (mbgl::OnlineFileSource::Impl::*)(mbgl::Resource, mbgl::FileRequest*, std::__1::function<void (mbgl::Response)>))::'lambda'(void (mbgl::OnlineFileSource::Impl::*&&)(mbgl::Resource, mbgl::FileRequest*, std::__1::function<void (mbgl:
01-02 20:38:35.319 949-949/? A/DEBUG:     #09 pc 00202034  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (mbgl::util::RunLoop::Invoker<auto std::__1::unique_ptr<mbgl::WorkRequest, std::__1::default_delete<std::__1::default_delete> > mbgl::util::RunLoop::invokeWithCallback<auto mbgl::util::Thread<mbgl::OnlineFileSource::Impl>::bind<void (mbgl::OnlineFileSource::Impl::*)(mbgl::Resource, mbgl::FileRequest*, std::__1::function<void (mbgl::Response)>)>(void (mbgl::OnlineFileSource::Impl::*)(mbgl::Resource, mbgl::FileRequest*, std
01-02 20:38:35.319 949-949/? A/DEBUG:     #10 pc 001f4bde  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (mbgl::util::RunLoop::process()+318)
01-02 20:38:35.319 949-949/? A/DEBUG:     #11 pc 001f7320  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (std::__1::__function::__func<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>, std::__1::allocator<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*> >, void ()>::operator()()+48)
01-02 20:38:35.319 949-949/? A/DEBUG:     #12 pc 001f46a9  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (mbgl::util::AsyncTask::Impl::asyncCallback(uv_async_s*)+41)
01-02 20:38:35.319 949-949/? A/DEBUG:     #13 pc 00357eec  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so
01-02 20:38:35.319 949-949/? A/DEBUG:     #14 pc 0035811c  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so
01-02 20:38:35.319 949-949/? A/DEBUG:     #15 pc 00362165  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so
01-02 20:38:35.319 949-949/? A/DEBUG:     #16 pc 0035867b  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (uv_run+427)
01-02 20:38:35.319 949-949/? A/DEBUG:     #17 pc 001f526d  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (mbgl::util::RunLoop::run()+45)
01-02 20:38:35.319 949-949/? A/DEBUG:     #18 pc 001566f2  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (void mbgl::util::Thread<mbgl::MapContext>::run<std::__1::tuple<mbgl::View&, mbgl::FileSource&, mbgl::MapMode&, mbgl::GLContextMode&, float>, 0u, 1u, 2u, 3u, 4u>(mbgl::util::ThreadContext, std::__1::tuple<mbgl::View&, mbgl::FileSource&, mbgl::MapMode&, mbgl::GLContextMode&, float>&&, std::__1::integer_sequence<unsigned int, 0u, 1u, 2u, 3u, 4u>)+162)
01-02 20:38:35.319 949-949/? A/DEBUG:     #19 pc 001565f4  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (mbgl::util::Thread<mbgl::MapContext>::Thread<mbgl::View&, mbgl::FileSource&, mbgl::MapMode&, mbgl::GLContextMode&, float>(mbgl::util::ThreadContext const&, mbgl::View&&&, mbgl::FileSource&&&, mbgl::MapMode&&&, mbgl::GLContextMode&&&, float&&)::'lambda'()::operator()() const+292)
01-02 20:38:35.319 949-949/? A/DEBUG:     #20 pc 0015647b  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/x86/libmapbox-gl.so (std::__1::__thread_proxy<std::__1::tuple<mbgl::util::Thread<mbgl::MapContext>::Thread<mbgl::View&, mbgl::FileSource&, mbgl::MapMode&, mbgl::GLContextMode&, float>(mbgl::util::ThreadContext const&, mbgl::View&&&, mbgl::FileSource&&&, mbgl::MapMode&&&, mbgl::GLContextMode&&&, float&&)::'lambda'()> >(void*, void*)+123)
01-02 20:38:35.319 949-949/? A/DEBUG:     #21 pc 00080a93  /system/lib/libc.so (__pthread_start(void*)+56)
01-02 20:38:35.319 949-949/? A/DEBUG:     #22 pc 00021952  /system/lib/libc.so (__start_thread+25)
01-02 20:38:35.319 949-949/? A/DEBUG:     #23 pc 000170b6  /system/lib/libc.so (__bionic_clone+70)

@1ec5
Copy link
Contributor

1ec5 commented Jan 22, 2016

I don't know how just stuffing the static library inside a framework bundle would make any difference here, but perhaps the stripping that takes place in framework.sh effectively changes symbol visibility?

@DejanRistic, does the issue still reproduce if you instead install the Mapbox iOS SDK manually? What if you install the symbols package manually?

@parrots
Copy link

parrots commented Jan 24, 2016

I'm also able to reproduce this issue using CocoaPods and iOS. As soon as I view a map with airplane mode turned on, the app crashes. This is particularly bad in my case because my app is used for skiing, which many users turn on airplane mode before to save battery. Using SDK 3.0.1.

@1ec5
Copy link
Contributor

1ec5 commented Jan 24, 2016

@parrots, I’m curious whether you also see this issue in v3.1.0-pre.1. If you use this podspec to install the prerelease, you’ll get the version with debug symbols. Perhaps the presence of debug symbols makes all the difference.

@parrots
Copy link

parrots commented Jan 24, 2016

I’m having a lot of trouble getting that podspec to work. Changing the pod
file to

pod 'Mapbox-iOS-SDK', :podspec => '
https://raw.githubusercontent.com/mapbox/mapbox-gl-native/ios-v3.1.0-pre.1/ios/Mapbox-iOS-SDK.podspec
'

and re-installing leads to a ton of build errors.

[image: Screen Shot 2016-01-24 at 4.01.15 PM.png]
I’ve tried setting Allow Non-Module Includes in Framework Headers in both
the pod project and my project with no luck. Are there any additional
changed needed going from 3.0 -> 3.1 (since you guys are moving to dynamic
framework)? I haven’t had to tweak any settings for any other pods to date
like this.

On Sun, Jan 24, 2016 at 3:14 PM Minh Nguyễn notifications@github.com
wrote:

@parrots https://github.com/parrots, I’m curious whether you also see
this issue in v3.1.0-pre.1
https://github.com/mapbox/mapbox-gl-native/releases/tag/ios-v3.1.0-pre.1.
If you use this podspec
https://github.com/mapbox/mapbox-gl-native/blob/ios-v3.1.0-pre.1/ios/Mapbox-iOS-SDK.podspec
to install the prerelease, you’ll get the version with debug symbols.
Perhaps the presence of debug symbols makes all the difference.


Reply to this email directly or view it on GitHub
#3280 (comment)
.

@1ec5
Copy link
Contributor

1ec5 commented Jan 24, 2016

You’re probably running into #3300. I just fixed that in #3679, so try again in the next prerelease.

@1ec5
Copy link
Contributor

1ec5 commented Jan 26, 2016

I’m suspicious of this strip invocation, which we originally added because of complaints about the SDK’s file size. A normal framework build inside Xcode already runs strip -S, but perhaps strip -Sx is one step too far – could it be stripping RTTI information? We slashed the size of the framework in #3183, so this extra stripping likely doesn’t gain us much anyways.

@minikin
Copy link

minikin commented Feb 7, 2016

I have the same error.

@johnnewman
Copy link

The airplane mode issue seems like it's resolved in 3.1.1!

@1ec5
Copy link
Contributor

1ec5 commented Feb 18, 2016

That’s great to hear, @johnnewman! Were you reproducing the issue consistently in previous versions? Also, can others confirm that upgrading to 3.1.1 addresses the issue?

@johnnewman
Copy link

It seems to work fine in 3.1.0 as well. Builds before that seemed to cause a crash every time.

@parrots
Copy link

parrots commented Feb 18, 2016

Just tried to reproduce. When I load my satellite map in airplane mode all
is fine in 3.1.1. When I try to switch styles to my terrain map, the app
crashes. Both asset JSONs are shipped in the app bundle.

On Thu, Feb 18, 2016 at 4:01 PM John Newman notifications@github.com
wrote:

It seems to work fine in 3.1.0 as well. Builds before that seemed to cause
a crash every time.


Reply to this email directly or view it on GitHub
#3280 (comment)
.

@1ec5
Copy link
Contributor

1ec5 commented Feb 19, 2016

I’m suspicious of this strip invocation, which we originally added because of complaints about the SDK’s file size.

The following custom builds skip the aggressive stripping we introduced in 0514082 for 3.0.1:

However, I’m able to reproduce a crash in iosapp, which isn’t subject to that stripping, by changing this conditional to true. Never mind, silly mistake.

@1ec5
Copy link
Contributor

1ec5 commented Feb 19, 2016

The crash trace in #3280 (comment) is no longer accurate due to refactoring, although it hints at the same throw site as #3280 (comment). If I set this conditional to true and hard-code an error message on the next line, I get the expected log message but no crash. I’ve tried this against version 3.1.1 both on an iPhone 6 and in the iOS Simulator, with and without the aggressive stripping, with and without debug symbols.

@parrots and anyone else who still reproduces this issue, would you mind providing a gist of the crash you’re seeing?

@minikin
Copy link

minikin commented Feb 19, 2016

@1ec5 I've just had an error on real device without internet connection:

2016-02-19 17:07:23.696 APP NAME [606:144028] [ERROR] {Map}[Setup]: loading style failed: The Internet connection appears to be offline.

and I implemented mapViewDidFailLoadingMap.
check the gist

@jfirebaugh
Copy link
Contributor

To be clear, printing an error message like "loading style failed: The Internet connection appears to be offline" is expected behavior. Subsequently crashing in std::terminate is not. @minikin can you clarify which of these you're seeing?

@minikin
Copy link

minikin commented Feb 19, 2016

@jfirebaugh I see both at the same time but only when my phones connected to the computer. I've just tested my app during commute to home and I can't reproduce this error.

@parrots
Copy link

parrots commented Feb 24, 2016

Just to add more fuel to the fire: I have a customer writing in with the following. Isn't limited to airplane mode, seems to be in any case were data is blocked.

"Also I found that the app is always crashing when I have mobile data on outside the country, when I do this I get automatically forwarded to a provider specific website where I can buy data packages, if I don't do this the application will also receive wrong data and that causes it to crash."

@1ec5
Copy link
Contributor

1ec5 commented Feb 24, 2016

Thanks, @parrots, that’s an interesting case. It’s called a “captive network”, and as far as I can tell, we don’t have any provisions for it at the moment. @kkaefer, is this something we’d be able to detect and handle more gracefully?

@1ec5
Copy link
Contributor

1ec5 commented Feb 24, 2016

@kkaefer pointed out that #943 already tracks the captive network scenario.

@jfirebaugh
Copy link
Contributor

We have reason to believe that this crash will be prevented by 46830f1 / #4339; see #4369.

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

No branches or pull requests

8 participants