mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

Thread : Crashed: com.apple.main-thread #2958

Closed minikin closed 8 years ago

minikin commented 8 years ago

I'm not 100% sure that's the Mapbox related bug but please have a look. Xcode 7.1 (7B91b), Mapbox ios-v3.0.0-pre.4.

Thread : Crashed: com.apple.main-thread
0  libswiftCore.dylib             23174740 _TTSf4s_s_d_d___TFSs18_fatalErrorMessageFTVSs12StaticStringS_S_Su_T_ + 72
1  libswiftCore.dylib             23912747 swift_reportFatalError + 86
2  App Name                  946672 MainViewController.centerOnUser(AnyObject) -> () (MainViewController.swift:197)
3  App Name                   947132 @objc MainViewController.centerOnUser(AnyObject) -> () (MainViewController.swift)
4  UIKit                          667817441 -[UIApplication sendAction:to:from:forEvent:] + 80
5  UIKit                          669392201 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 140
6  UIKit                          667817441 -[UIApplication sendAction:to:from:forEvent:] + 80
7  UIKit                          667817329 -[UIControl sendAction:to:forEvent:] + 64
8  UIKit                          667718791 -[UIControl _sendActionsForEvents:withEvent:] + 446
9  UIKit                          667719091 -[UIControl _sendActionsForEvents:withEvent:] + 746
10 UIKit                          667815617 -[UIControl touchesEnded:withEvent:] + 616
11 UIKit                          667814703 -[UIWindow _sendTouchesForEvent:] + 646
12 UIKit                          667784271 -[UIWindow sendEvent:] + 642
13 UIKit                          667591409 -[UIApplication sendEvent:] + 204
14 UIKit                          667584823 _UIApplicationHandleEventQueue + 5134
15 CoreFoundation                 598968263 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
16 CoreFoundation                 598967223 __CFRunLoopDoSources0 + 454
17 CoreFoundation                 598959903 __CFRunLoopRun + 806
18 CoreFoundation                 598249689 CFRunLoopRunSpecific + 516
Thread : FileSource
0  libsystem_kernel.dylib         902788288 kevent + 24
1  App Name                  1757505 uv__io_poll (kqueue.c:142)
2  App Name                 1746517 uv_run (core.c:341)
3  App Name                  2291265 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&>, 0ul, 1ul>(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 long, 0ul, 1ul>) + 200
4  App Name                  2290955 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*) + 234
5  libsystem_pthread.dylib        903507071 _pthread_body + 138
6  libsystem_pthread.dylib        903506931 _pthread_start + 110
7  libsystem_pthread.dylib        903498248 thread_start + 8
Thread : Map
0  libsystem_kernel.dylib         902788288 kevent + 24
1  App Name                 1757505 uv__io_poll (kqueue.c:142)
2  App Name                  1746517 uv_run (core.c:341)
3  App Name                  2066877 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
4  App Name                  2066571 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
5  libsystem_pthread.dylib        903507071 _pthread_body + 138
6  libsystem_pthread.dylib        903506931 _pthread_start + 110
7  libsystem_pthread.dylib        903498248 thread_start + 8

I have 4 "Thread : Worker"s :

Thread : Worker
0  libsystem_kernel.dylib         902788288 kevent + 24
1  App Name                  1757505 uv__io_poll (kqueue.c:142)
2  App Name                 1746517 uv_run (core.c:341)
3  App Name                  2540007 void mbgl::util::Thread<mbgl::Worker::Impl>::run<std::__1::tuple<> >(mbgl::util::ThreadContext, std::__1::tuple<>&&, std::__1::integer_sequence<unsigned long>) + 178
4  App Name                  2539719 std::__1::__thread_proxy<std::__1::tuple<mbgl::util::Thread<mbgl::Worker::Impl>::Thread<>(mbgl::util::ThreadContext const&)::'lambda'()> >(void*, void*) + 234
5  libsystem_pthread.dylib        903507071 _pthread_body + 138
6  libsystem_pthread.dylib        903506931 _pthread_start + 110
7  libsystem_pthread.dylib        903498248 thread_start + 8

My IBAction which have caused the bug:

@IBAction func centerOnUser(sender: AnyObject) {

// Remove all annotations
      mapView.removeAnnotations(mapView.annotations!)

// Add annotations from Realm db.
      populateMap()

// Center map to current user location.
      centerToUsersLocation()
    }
1ec5 commented 8 years ago

There’s not much to go on here. Do you see anything in the console?

Per https://github.com/mapbox/mapbox-gl-native/issues/2962#issuecomment-155163224, I wonder if pulling in 7b8b2b1790863c7103067d40c690e273a8af5198 would fix the issue.

minikin commented 8 years ago

I usually get this error only with real devices (iPhone 5S or 6Plus) during my daily commute to work and back.

I guess, the scenario to bring about that error is:

I hope you understand the idea.

Anyway, if you can give me any advice on how I can debug this error, I’ll be grateful.

ps: I didn't have this kind of error when I used Mapkit in my app but I've rewritten my app completely and I have not finished unit tests yet, so maybe that is my bug...

picciano commented 8 years ago

Sort of looks like the Swift version of a crash we've been seeing. It's also tough to debug and I'm not entirely certain it's from Mapbox code.

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                6841203664 objc_msgSend + 16
1  CoreLocation                   6550161444 (null) + 5756
2  CoreFoundation                 6542197036 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
3  CoreFoundation                 6542196188 __CFRunLoopDoTimer + 888
4  CoreFoundation                 6542186536 __CFRunLoopRun + 1372
5  CoreFoundation                 6541316820 CFRunLoopRunSpecific + 396
6  GraphicsServices               6703150844 GSEventRunModal + 168
7  UIKit                          6620999488 UIApplicationMain + 1488
minikin commented 8 years ago

I've got related bug with Mapbox3pre5. Please, have a look:

Thread : Crashed: Map
0  App Name                  4296355332 mbgl::Painter::render(mbgl::Style const&, mbgl::TransformState, mbgl::FrameData const&)
1  App Name                  4296234900 mbgl::MapContext::renderSync(mbgl::TransformState const&, mbgl::FrameData const&)
2  App Name                  4296216344 std::__1::packaged_task<bool ()>::operator()()
3  App Name                  4296216172 mbgl::util::RunLoop::Invoker<std::__1::packaged_task<bool ()>, std::__1::tuple<> >::operator()()
4  App Name                  4296682836 mbgl::util::RunLoop::process()
5  App Name                  4295883388 uv__async_event (async.c:92)
6  App Name                  4295883836 uv__async_io (async.c:137)
7  App Name                  4295899140 uv__io_poll (kqueue.c:247)
8  App Name                  4295884780 uv_run (core.c:341)
9  App Name                  4296212848 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>)
10 App Name                  4296212600 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*)
11 libsystem_pthread.dylib        6848314152 _pthread_body + 156
12 libsystem_pthread.dylib        6848313996 _pthread_body + 154
13 libsystem_pthread.dylib        6848303144 thread_start + 4
jfirebaugh commented 8 years ago

Thanks for the report @minikin -- that last stack trace is a bug that was fixed shortly after 3.0.0pre5 (in 7b8b2b1790863c7103067d40c690e273a8af5198). We're going to release pre6 soon. Sorry for the inconvenience!

friedbunny commented 8 years ago

Going to close this as it's not particularly actionable. @minikin if you learn anything new, please reopen.