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

Crash in NSURLConnectionLoader #6471

Closed
kkaefer opened this issue Sep 27, 2016 · 9 comments
Closed

Crash in NSURLConnectionLoader #6471

kkaefer opened this issue Sep 27, 2016 · 9 comments
Labels
crash iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS

Comments

@kkaefer
Copy link
Contributor

kkaefer commented Sep 27, 2016

Just encountered this crash while running test cases. The crash occured while running OnlineFileSource.Load:

It's a little bit worrying that there's no Mapbox GL code in there; this seems to be internal to the framework. However, it could also point to us misusing it:

com.apple.NSURLConnectionLoader (11)
#0  0x0000000100816e49 in __gcd_queue_item_enqueue_hook_block_invoke ()
#1  0x0000000100816477 in gcd_queue_item_enqueue_hook ()
#2  0x00000001008504e4 in _dispatch_introspection_queue_item_enqueue_hook ()
#3  0x000000010083a699 in _dispatch_queue_push ()
#4  0x00007fffc97db5f2 in HSTSStorage::copyHSTSInfoDictionary(__CFString const*) ()
#5  0x00007fffc969cce2 in HSTSPolicy::isKnownHSTSHost(unsigned char*, long) const ()
#6  0x00007fffc9775438 in HSTSPolicy::isKnownHSTSHost(__CFURL const*) const ()
#7  0x00007fffc98ba12b in StrictSecurityPolicy::strictSecurityPolicyInEffectForURL(__CFURL const*, __CFDictionary const*) ()
#8  0x00007fffc9892446 in HTTPProtocol::loadConformsToStrictSecurityPolicy() ()
#9  0x00007fffc96a60d4 in HTTPProtocol::_protocolInterface_startLoad(_CFCachedURLResponse const*) ()
#10 0x00007fffc969ea4a in ___ZN19URLConnectionLoader27_private_ScheduleOriginLoadEPK12NSURLRequestPK20_CFCachedURLResponse_block_invoke_2 ()
#11 0x00007fffc969e9d9 in ___ZNK19URLConnectionLoader25withExistingProtocolAsyncEU13block_pointerFvP11URLProtocolE_block_invoke ()
#12 0x0000000100823fcc in _dispatch_client_callout ()
#13 0x0000000100839b04 in _dispatch_block_invoke_direct ()
#14 0x00007fffc969d8d0 in RunloopBlockContext::_invoke_block(void const*, void*) ()
#15 0x00007fffca468bf4 in CFArrayApplyFunction ()
#16 0x00007fffc969d7c9 in RunloopBlockContext::perform() ()
#17 0x00007fffc969d660 in MultiplexerSource::perform() ()
#18 0x00007fffc969d482 in MultiplexerSource::_perform(void*) ()
#19 0x00007fffca4c4581 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#20 0x00007fffca4a598c in __CFRunLoopDoSources0 ()
#21 0x00007fffca4a4e76 in __CFRunLoopRun ()
#22 0x00007fffca4a4874 in CFRunLoopRunSpecific ()
#23 0x00007fffc9679144 in +[NSURLConnection(Loader) _resourceLoadLoop:] ()
#24 0x00007fffcbed130d in __NSThread__start__ ()
#25 0x000000010089bc60 in _pthread_body ()
#26 0x000000010089bbac in _pthread_start ()
#27 0x000000010089b3bd in thread_start ()
@kkaefer kkaefer added the crash label Sep 27, 2016
@kkaefer
Copy link
Contributor Author

kkaefer commented Sep 27, 2016

Just triggered this again.

@kkaefer
Copy link
Contributor Author

kkaefer commented Sep 27, 2016

Got it again. I should add that in all cases, Xcode crashed shortly after reporting this error.

@1ec5
Copy link
Contributor

1ec5 commented Sep 29, 2016

Did you encounter this crash on iOS or macOS?

@kkaefer
Copy link
Contributor Author

kkaefer commented Sep 29, 2016

macOS

@kkaefer kkaefer closed this as completed Sep 29, 2016
@kkaefer kkaefer reopened this Sep 29, 2016
@1ec5 1ec5 added the macOS Mapbox Maps SDK for macOS label Sep 29, 2016
@1ec5
Copy link
Contributor

1ec5 commented Sep 29, 2016

What specific version of macOS are you running? Is this macosapp or a test application (and is it sandboxed)? Do you know what URL we were trying to fetch when the crash occurred?

@kkaefer
Copy link
Contributor Author

kkaefer commented Oct 6, 2016

Got another one on master:

Queue : com.apple.main-thread (serial)
#0  0x0000000101c2ee49 in __gcd_queue_item_enqueue_hook_block_invoke ()
#1  0x0000000101c2e477 in gcd_queue_item_enqueue_hook ()
#2  0x0000000101c684e4 in _dispatch_introspection_queue_item_enqueue_hook ()
#3  0x0000000101c52699 in _dispatch_queue_push ()
#4  0x00007fffcea88972 in -[__NSCFURLSessionTask resume] ()
#5  0x00000001004eeccc in mbgl::HTTPFileSource::request(mbgl::Resource const&, std::__1::function<void (mbgl::Response)>) at platform/darwin/src/http_file_source.mm:331
#6  0x0000000100575964 in mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*) at platform/default/online_file_source.cpp:103
#7  0x00000001005733b0 in mbgl::OnlineFileSource::Impl::activatePendingRequest() at platform/default/online_file_source.cpp:122
#8  0x0000000100577f07 in mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*)::'lambda'(mbgl::Response)::operator()(mbgl::Response) const at platform/default/online_file_source.cpp:105
#9  0x0000000100577e5b in decltype(std::__1::forward<mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*)::'lambda'(mbgl::Response)&>(fp)(std::__1::forward<mbgl::Response>(fp0))) std::__1::__invoke<mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*)::'lambda'(mbgl::Response)&, mbgl::Response>(mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*)::'lambda'(mbgl::Response)&&&, mbgl::Response&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__functional_base:416
#10 0x0000000100577e0a in void std::__1::__invoke_void_return_wrapper<void>::__call<mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*)::'lambda'(mbgl::Response)&, mbgl::Response>(mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*)::'lambda'(mbgl::Response)&&&, mbgl::Response&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__functional_base:468
#11 0x0000000100577d19 in std::__1::__function::__func<mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*)::'lambda'(mbgl::Response), std::__1::allocator<mbgl::OnlineFileSource::Impl::activateRequest(mbgl::OnlineFileRequest*)::'lambda'(mbgl::Response)>, void (mbgl::Response)>::operator()(mbgl::Response&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1437
#12 0x00000001000dbec1 in std::__1::function<void (mbgl::Response)>::operator()(mbgl::Response) const at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1817
#13 0x00000001004f7c3f in _ZNK4mbgl11HTTPRequest5asyncMUlvE_clEv at platform/darwin/src/http_file_source.mm:77
#14 0x00000001004f7b9d in _ZNSt3__18__invokeIRN4mbgl11HTTPRequest5asyncMUlvE_EJEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOS5_DpOS6_ [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__functional_base:416
#15 0x00000001004f7b8c in _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRN4mbgl11HTTPRequest5asyncMUlvE_EEEEvDpOT_ at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__functional_base:468
#16 0x00000001004f7ab9 in _ZNSt3__110__function6__funcIN4mbgl11HTTPRequest5asyncMUlvE_ENS_9allocatorIS4_EEFvvEEclEv at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1437
#17 0x0000000100123fae in std::__1::function<void ()>::operator()() const at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1817
#18 0x0000000100b18a3e in mbgl::util::AsyncTask::Impl::runTask() at platform/darwin/src/async_task.cpp:45
#19 0x0000000100b189a5 in mbgl::util::AsyncTask::Impl::perform(void*) at platform/darwin/src/async_task.cpp:50
#20 0x00007fffcf8cc581 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#21 0x00007fffcf8ad98c in __CFRunLoopDoSources0 ()
#22 0x00007fffcf8ace76 in __CFRunLoopRun ()
#23 0x00007fffcf8ac874 in CFRunLoopRunSpecific ()
#24 0x00007fffcf8ebdc1 in CFRunLoopRun ()
#25 0x0000000100b1a0c1 in mbgl::util::RunLoop::run() at platform/darwin/src/run_loop.cpp:39
#26 0x000000010026be52 in OnlineFileSource_Load_Test::TestBody() at test/storage/online_file_source.test.cpp:258
#27 0x0000000100b100f3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#28 0x0000000100afb027 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#29 0x0000000100acac95 in testing::Test::Run() ()
#30 0x0000000100acc1db in testing::TestInfo::Run() ()
#31 0x0000000100acce77 in testing::TestCase::Run() ()
#32 0x0000000100adb653 in testing::internal::UnitTestImpl::RunAllTests() ()
#33 0x0000000100b13fb3 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
#34 0x0000000100afd707 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
#35 0x0000000100adb250 in testing::UnitTest::Run() ()
#36 0x0000000100166b21 in RUN_ALL_TESTS() at mason_packages/osx-x86_64/gtest/1.7.0/include/gtest/gtest.h:20058
#37 0x0000000100166906 in mbgl::runTests(int, char**) at test/src/mbgl/test/test.cpp:14
#38 0x00000001001576af in main at test/src/main.cpp:19
#39 0x00007fffe497e255 in start ()

@mheins57
Copy link

mheins57 commented Oct 24, 2016

I've been getting these occasionally on iOS 10.0.2 (14A456), so it's not unique to OS X:

#0  0x000000010139ae8c in __gcd_queue_item_enqueue_hook_block_invoke ()
#1  0x000000010139a41c in gcd_queue_item_enqueue_hook ()
#2  0x00000001019d9ee8 in _dispatch_introspection_queue_item_enqueue_hook ()
#3  0x00000001019b8ba4 in _dispatch_queue_push ()
#4  0x000000018a07dac0 in URLConnectionInstanceData::withWorkQueueAsync(void () block_pointer) const ()
#5  0x000000018a08eb9c in URLConnectionLoader_Classic::protocolDidLoadData(__CFData const*, long long) ()
#6  0x000000018a0487f0 in HTTPProtocol::tryToSendDispatchDataToDelegate(dispatch_data_s*) ()
#7  0x000000018a04252c in HTTPProtocol::bytesAvailable(dispatch_data_s*) ()
#8  0x000000018a041b5c in HTTPProtocol::handleStreamEvent(__CFHTTPMessage*, dispatch_data_s*, CFStreamError const*) ()
#9  0x000000018a120d48 in ___ZN15HTTPTransaction22_onqueue_invokeHandlerEv_block_invoke.64 ()
#10 0x00000001019ad21c in _dispatch_client_callout ()
#11 0x00000001019b7c9c in _dispatch_block_invoke_direct ()
#12 0x000000018a13ae98 in RunloopBlockContext::_invoke_block(void const*, void*) ()
#13 0x00000001897f99a8 in CFArrayApplyFunction ()
#14 0x000000018a13ad7c in RunloopBlockContext::perform() ()
#15 0x000000018a13c0a4 in MultiplexerSource::perform() ()
#16 0x000000018a13be10 in MultiplexerSource::_perform(void*) ()
#17 0x00000001898ce278 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#18 0x00000001898cdbc0 in __CFRunLoopDoSources0 ()
#19 0x00000001898cb7c0 in __CFRunLoopRun ()
#20 0x00000001897fa048 in CFRunLoopRunSpecific ()
#21 0x0000000189fe7cec in +[NSURLConnection(Loader) _resourceLoadLoop:] ()
#22 0x000000018a40650c in __NSThread__start__ ()
#23 0x00000001889b3860 in _pthread_body ()
#24 0x00000001889b3770 in _pthread_start ()
#25 0x00000001889b0dbc in thread_start ()

@1ec5 1ec5 added the iOS Mapbox Maps SDK for iOS label Oct 24, 2016
@wibge
Copy link

wibge commented Dec 7, 2016

I get this consistently on the ios 10.1 simulator when downloading a multi-thousand tile region.

* thread #27: tid = 0x24bbd06, 0x0000000107623eac libBacktraceRecording.dylib`__gcd_queue_item_enqueue_hook_block_invoke + 4, queue = 'com.apple.NSURLSession-work', stop reason = EXC_BAD_ACCESS (code=1, address=0x36)
  * frame #0: 0x0000000107623eac libBacktraceRecording.dylib`__gcd_queue_item_enqueue_hook_block_invoke + 4
    frame #1: 0x000000010762351d libBacktraceRecording.dylib`gcd_queue_item_enqueue_hook + 241
    frame #2: 0x000000010edace47 libdispatch.dylib`_dispatch_introspection_queue_item_enqueue_hook + 46
    frame #3: 0x000000010ed866a0 libdispatch.dylib`_dispatch_queue_push + 313
    frame #4: 0x0000000107a864ff CFNetwork`-[__NSCFURLSessionConnection withWorkQueueAsync:] + 79
    frame #5: 0x0000000107a9153d CFNetwork`SessionConnectionLoadable::withLoaderClientAsync(void (LoaderClientInterface*) block_pointer) + 99
    frame #6: 0x0000000107aa0d02 CFNetwork`URLConnectionLoader::protocolDidFinishLoading() + 608
    frame #7: 0x0000000107a8b45d CFNetwork`___ZNK25URLConnectionInstanceData18withWorkQueueAsyncEU13block_pointerFvvE_block_invoke + 16
    frame #8: 0x000000010ed81980 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #9: 0x000000010edab0cd libdispatch.dylib`_dispatch_client_callout + 8
    frame #10: 0x000000010ed88e6b libdispatch.dylib`_dispatch_queue_serial_drain + 236
    frame #11: 0x000000010ed89b9f libdispatch.dylib`_dispatch_queue_invoke + 1073
    frame #12: 0x000000010ed8c3b7 libdispatch.dylib`_dispatch_root_queue_drain + 720
    frame #13: 0x000000010ed8c08b libdispatch.dylib`_dispatch_worker_thread3 + 123
    frame #14: 0x000000010f1544de libsystem_pthread.dylib`_pthread_wqthread + 1129
    frame #15: 0x000000010f152341 libsystem_pthread.dylib`start_wqthread + 13

@jfirebaugh
Copy link
Contributor

http://stackoverflow.com/a/40536997/52207

After speaking with Apple Technical Support we confirmed that it's a bug within the libBacktraceRecording.dylib library, which is used for debugging within Xcode. I have filed a bug report and have been told that it won't crash on a users device since this is a debug error that occurs within a library not present on most users' devices.

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 macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

No branches or pull requests

5 participants