This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Changing style repeatedly consistently causes crash. #788
Copy link
Copy link
Closed
Description
Here is how to reproduce it consistently.
- Launch sample iosapp.
- Keep tapping on the center of the navigation bar to change styles.
- It consistently crashes after 10 or so style switches.
I have copy pasted the lldb stack traces for the crashes below. I've included two unique stack traces.
Crash number 1
eneral: painter setup: 0.057500000000000002ms
libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc
(lldb) bt
* thread #35: tid = 0x40a830, 0x3a90b1f0 libsystem_kernel.dylib`__pthread_kill + 8, name = 'Map', stop reason = signal SIGABRT
frame #0: 0x3a90b1f0 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x3a975796 libsystem_pthread.dylib`pthread_kill + 58
frame #2: 0x3a8bbfdc libsystem_c.dylib`abort + 76
frame #3: 0x39beacd6 libc++abi.dylib`abort_message + 74
frame #4: 0x39c036e4 libc++abi.dylib`default_terminate_handler() + 252
frame #5: 0x3a348f88 libobjc.A.dylib`_objc_terminate() + 228
frame #6: 0x39c011c6 libc++abi.dylib`std::__terminate(void (*)()) + 78
frame #7: 0x39c00a1c libc++abi.dylib`__cxa_throw + 116
frame #8: 0x006ee7c0 libglInterpose.dylib`operator new(unsigned long) + 160
* frame #9: 0x00086188 Mapbox GL`std::__1::__split_buffer<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&) [inlined] std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::allocate(this=0x1a9445b8, __n=357913941, (null)=0x00000000) + 180 at memory:1630
frame #10: 0x0008617a Mapbox GL`std::__1::__split_buffer<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&) [inlined] std::__1::__split_buffer<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>::__alloc(this=0x03741968, __a=0x1a9445b8, __n=357913941) + 10 at memory:1435
frame #11: 0x00086170 Mapbox GL`std::__1::__split_buffer<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>::__split_buffer(this=0x03741968, __cap=357913941, __start=78261014, __a=0x1a9445b8) + 156 at __split_buffer:325
frame #12: 0x00085482 Mapbox GL`std::__1::__split_buffer<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>::__split_buffer(this=0x03741968, __cap=357913941, __start=78261014, __a=0x1a9445b8) + 50 at __split_buffer:328
frame #13: 0x001e8194 Mapbox GL`void std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__emplace_back_slow_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(this=0x1a9445b0, __args=0x03741b2c) + 404 at vector:1572
frame #14: 0x001e76f8 Mapbox GL`mbgl::parse(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, char const*) [inlined] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(this=0x03741b2c, this=0x1a9445b0, __s=0x080d8698, __args=0x03741b2c, __n=183) + 310 at vector:1593
frame #15: 0x001e75c2 Mapbox GL`mbgl::parse(value=0x03741d04, target=0x1a9445b0, name=0x0026efa0) + 378 at style_source.cpp:22
frame #16: 0x001e7b1a Mapbox GL`mbgl::SourceInfo::parseTileJSONProperties(this=0x1a9445a0, value=0x03741d04) + 54 at style_source.cpp:69
frame #17: 0x000db480 Mapbox GL`mbgl::Source::load(this=0x1aa4403c, res=0x1aa44380)::$_0::operator()(mbgl::Response const&) const + 388 at source.cpp:56
frame #18: 0x000db238 Mapbox GL`std::__1::__function::__func<mbgl::Source::load(mbgl::Map&, mbgl::FileSource&)::$_0, std::__1::allocator<mbgl::Source::load(mbgl::Map&, mbgl::FileSource&)::$_0>, void (mbgl::Response const&)>::operator()(mbgl::Response const&) [inlined] decltype(this=0x1aa4403c, __f=0x1aa4403c, __args=0x1aa44380)::$_0&>(fp)(std::__1::forward<mbgl::Response const&>(fp0))) std::__1::__invoke<mbgl::Source::load(mbgl::Map&, mbgl::FileSource&)::$_0&, mbgl::Response const&>(mbgl::Source::load(mbgl::Map&, mbgl::FileSource&)::$_0&&&, mbgl::Response const&&&) + 16 at __functional_base:413
frame #19: 0x000db228 Mapbox GL`std::__1::__function::__func<mbgl::Source::load(this=0x1aa44038, __arg=0x1aa44380)::$_0, std::__1::allocator<mbgl::Source::load(mbgl::Map&, mbgl::FileSource&)::$_0>, void (mbgl::Response const&)>::operator()(mbgl::Response const&) + 48 at functional:1370
frame #20: 0x00189d46 Mapbox GL`std::__1::function<void (this=0x1aa44038, __arg=0x1aa44380)>::operator()(mbgl::Response const&) const + 158 at functional:1755
frame #21: 0x00189998 Mapbox GL`void mbgl::invoke<std::__1::function<void (list=0x03741f64, args=0x1aa44380)>, mbgl::Response&>(std::__1::forward_list<std::__1::unique_ptr<mapbox::util::variant<std::__1::function<void (mbgl::Response const&)>, std::__1::function<void ()> >, std::__1::default_delete<mapbox::util::variant<std::__1::function<void (mbgl::Response const&)>, std::__1::function<void ()> > > >, std::__1::allocator<std::__1::unique_ptr<mapbox::util::variant<std::__1::function<void (mbgl::Response const&)>, std::__1::function<void ()> >, std::__1::default_delete<mapbox::util::variant<std::__1::function<void (mbgl::Response const&)>, std::__1::function<void ()> > > > > > const&, mbgl::Response&&&) + 324 at base_request.cpp:17
frame #22: 0x00188e10 Mapbox GL`mbgl::BaseRequest::notify(this=0x1aa438ec) + 436 at base_request.cpp:49
frame #23: 0x00193778 Mapbox GL`mbgl::HTTPRequest::handleCacheResponse(this=0x1aa438ec, res=0x1aa43bf0) + 600 at http_request.cpp:58
frame #24: 0x001959d2 Mapbox GL`mbgl::HTTPRequest::startCacheRequest(this=0x1a800430, response_=0x1aa43bf0, ptr=0x1a800430)::$_0::operator()(std::__1::unique_ptr<mbgl::Response, std::__1::default_delete<mbgl::Response> >&&, void*) const + 250 at http_request.cpp:44
frame #25: 0x001958bc Mapbox GL`mbgl::HTTPRequest::startCacheRequest(response_=0x1aa43bf0, ptr=0x1a800430)::$_0::__invoke(std::__1::unique_ptr<mbgl::Response, std::__1::default_delete<mbgl::Response> >&&, void*) + 40 at http_request.cpp:39
frame #26: 0x0019a64a Mapbox GL`mbgl::SQLiteStore::get(this=0x0019a505, data=0x1aa43bd0)(std::__1::unique_ptr<mbgl::Response, std::__1::default_delete<mbgl::Response> >&&, void*), void*)::$_2::operator()(void*) const + 262 at sqlite_store.cpp:149
frame #27: 0x0019a528 Mapbox GL`mbgl::SQLiteStore::get(data=0x1aa43bd0)(std::__1::unique_ptr<mbgl::Response, std::__1::default_delete<mbgl::Response> >&&, void*), void*)::$_2::__invoke(void*) + 36 at sqlite_store.cpp:146
frame #28: 0x002326aa Mapbox GL`uv__worker_after(ptr=0x1a800450) + 130 at uv-worker.c:56
frame #29: 0x00232398 Mapbox GL`uv__messenger_callback(async=0x1a8003bc, status=0) + 104 at uv-messenger.c:37
frame #30: 0x0023917e Mapbox GL`uv__async_event(loop=0x1566fbe0, w=0x1566fcb8, nevents=2) + 126 at async.c:80
frame #31: 0x00239426 Mapbox GL`uv__async_io(loop=0x1566fbe0, w=0x1566fcbc, events=1) + 190 at async.c:156
frame #32: 0x0024c20c Mapbox GL`uv__io_poll(loop=0x1566fbe0, timeout=-1) + 2252 at kqueue.c:233
frame #33: 0x002398e6 Mapbox GL`uv_run(loop=0x1566fbe0, mode=UV_RUN_DEFAULT) + 130 at core.c:317
frame #34: 0x000c3a5a Mapbox GL`mbgl::Map::run(this=0x1566fa50) + 330 at map.cpp:238
frame #35: 0x000c9860 Mapbox GL`mbgl::Map::start(this=0x1a8a3290)::$_5::operator()() const + 192 at map.cpp:189
frame #36: 0x000c9656 Mapbox GL`void* std::__1::__thread_proxy<std::__1::tuple<mbgl::Map::start(__vp=0x1a8a3290)::$_5> >(void*) + 274 at memory:2602
frame #37: 0x3a974918 libsystem_pthread.dylib`_pthread_body + 140
frame #38: 0x3a97488a libsystem_pthread.dylib`_pthread_start + 102
frame #39: 0x3a972aa4 libsystem_pthread.dylib`thread_start + 8
(lldb)
Crash number 2
Assertion failed: (std::this_thread::get_id() == thread_id), function cancel, file /Users/mb/Documents/MAPBOX_MASON_SCRATCH/mapbox-gl-native/src/mbgl/storage/http_request.cpp, line 264.
(lldb) bt
* thread #37: tid = 0x40ac23, 0x3a90b1f0 libsystem_kernel.dylib`__pthread_kill + 8, name = 'Map', stop reason = signal SIGABRT
frame #0: 0x3a90b1f0 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x3a975796 libsystem_pthread.dylib`pthread_kill + 58
frame #2: 0x3a8bbfdc libsystem_c.dylib`abort + 76
frame #3: 0x3a89bcae libsystem_c.dylib`__assert_rtn + 182
* frame #4: 0x00192ed8 Mapbox GL`mbgl::HTTPRequest::cancel(this=0x15df979c) + 228 at http_request.cpp:264
frame #5: 0x001894c6 Mapbox GL`mbgl::CachingHTTPFileSource::clearLoop(this=0x15d56260) + 778 at caching_http_file_source.cpp:51
frame #6: 0x000c97ce Mapbox GL`mbgl::Map::start(this=0x1b0782cc)::$_3::operator()() const + 574 at map.cpp:154
frame #7: 0x000c94cc Mapbox GL`std::__1::__function::__func<mbgl::Map::start()::$_3, std::__1::allocator<mbgl::Map::start()::$_3>, void ()>::operator()() [inlined] decltype(this=0x1b0782cc, __f=0x1b0782cc)::$_3&>(fp)(std::__1::forward<>(fp0))) std::__1::__invoke<mbgl::Map::start()::$_3&>(mbgl::Map::start()::$_3&&&) + 10 at __functional_base:413
frame #8: 0x000c94c2 Mapbox GL`std::__1::__function::__func<mbgl::Map::start(this=0x1b0782c8)::$_3, std::__1::allocator<mbgl::Map::start()::$_3>, void ()>::operator()() + 38 at functional:1370
frame #9: 0x0018ca1e Mapbox GL`std::__1::function<void (this=0x1b0782c8)>::operator()() const + 146 at functional:1755
frame #10: 0x000cfab8 Mapbox GL`uv::async::async_cb(a=0x1b078310, (null)=0) + 36 at uv_detail.hpp:81
frame #11: 0x0023717e Mapbox GL`uv__async_event(loop=0x15d56820, w=0x15d568f8, nevents=1) + 126 at async.c:80
frame #12: 0x00237426 Mapbox GL`uv__async_io(loop=0x15d56820, w=0x15d568fc, events=1) + 190 at async.c:156
frame #13: 0x0024a20c Mapbox GL`uv__io_poll(loop=0x15d56820, timeout=-1) + 2252 at kqueue.c:233
frame #14: 0x002378e6 Mapbox GL`uv_run(loop=0x15d56820, mode=UV_RUN_DEFAULT) + 130 at core.c:317
frame #15: 0x000c1a5a Mapbox GL`mbgl::Map::run(this=0x15d56690) + 330 at map.cpp:238
frame #16: 0x000c7860 Mapbox GL`mbgl::Map::start(this=0x1b07b0b0)::$_5::operator()() const + 192 at map.cpp:189
frame #17: 0x000c7656 Mapbox GL`void* std::__1::__thread_proxy<std::__1::tuple<mbgl::Map::start(__vp=0x1b07b0b0)::$_5> >(void*) + 274 at memory:2602
frame #18: 0x3a974918 libsystem_pthread.dylib`_pthread_body + 140
frame #19: 0x3a97488a libsystem_pthread.dylib`_pthread_start + 102
(lldb)
Activity
ljbade commentedon Jan 29, 2015
Looks like the app is running out of memory. I know @kkaefer has been trying to track down a memory leak.
/cc @incanus
mb12 commentedon Jan 29, 2015
The second stack trace is an assert failure (The first one is most likely out of memory (std::bad_alloc)).
Assertion failed: (std::this_thread::get_id() == thread_id), function cancel, file /Users/mb/Documents/MAPBOX_MASON_SCRATCH/mapbox-gl-native/src/mbgl/storage/http_request.cpp, line 264.
mb12 commentedon Jan 29, 2015
@ljbade Should I file a separate issue for stack trace 2?
I've updated the title to accurately reflect your stack trace 1 analysis.
ljbade commentedon Jan 29, 2015
I have seen that second crash before. I believe it happens when a tile finished loading after the map changes style. @kkaefer is also working to refactor that code.
mb12 commentedon Feb 5, 2015
@kkaefer Can you please let me know if the following commit addresses this/similar issues?
b9bf66e
mb12 commentedon Feb 5, 2015
These are not fixed in the latest build. The crash can be trivially reproduced by switching styles in the sample app. I've included the stack track with the latest one.
incanus commentedon Mar 24, 2015
Check on #1077. With that I am able to tap the style switcher as fast as possible many times and not get a crash.