iOS10.3 Crash:PAC::PACExecutor::executePACScript

We encountered a large number of crashes reported by Crashlytics, but our development team was unable to reproduce it so far.

According to our analysis,this kind of crash only happen on iPhone OS 10.3 and above.

Here is the stacktrace from Crashlytics:


  • 0 JavaScriptCore 0x000000018c5a1a80 _llint_entry + 29920
  • 1 JavaScriptCore 0x000000018bde1140 JSC::Heap::Heap(JSC::VM*, JSC::HeapType) + 212
  • 2 JavaScriptCore 0x000000018bdde18c JSC::VM::VM(JSC::VM::VMType, JSC::HeapType) + 132
  • 3 JavaScriptCore 0x000000018c6e9168 JSC::VM::createContextGroup(JSC::HeapType) + 40
  • 4 JavaScriptCore 0x000000018c4c73e0 JSGlobalContextCreateInGroup + 72
  • 5 CFNetwork 0x00000001885842f0 PAC::JavaScript::_createJSRuntime(__CFAllocator const*, __CFString const*, __CFString const*) + 96
  • 6 CFNetwork 0x0000000188583fe4 _CreateJSContextForAutoConfigurationScript + 408
  • 7 CFNetwork 0x00000001886f74f4 PAC::JavaScript::JavaScripter::findProxyForURL(__CFString const*, std::__1::shared_ptr<PAC::PACQuery>, SmartBlockWithArgs<std::__1::shared_ptr<__CFArray const>, std::__1::shared_ptr<__CFError> >) + 68
  • 8 CFNetwork 0x000000018859663c PAC::PACExecutor::executePACScript(__CFString const*, std::__1::shared_ptr<PAC::PACQuery>) + 204
  • 9 CFNetwork 0x0000000188596bc8 invocation function for block in PAC::PACExecutor::executePACURL(std::__1::shared_ptr<PAC::PACQuery>, std::__1::shared_ptr<PAC::PACFetcher>) + 408
  • 10 CFNetwork 0x00000001885972ac BlockHolderVar<std::__1::shared_ptr<__CFString const>, double, std::__1::shared_ptr<__CFError> >::invoke_initial(std::__1::shared_ptr<__CFString const>, double, std::__1::shared_ptr<__CFError>) + 116
  • 11 CFNetwork 0x00000001886bb778 SmartBlockWithArgs<std::__1::shared_ptr<__CFString const>, double, std::__1::shared_ptr<__CFError> >::operator()(std::__1::shared_ptr<__CFString const>, double, std::__1::shared_ptr<__CFError>) const + 148
  • 12 CFNetwork 0x00000001886bba28 PAC::URLSessionPACFetcher::handlePACResponse(__CFURL const*, __CFData const*, _CFURLResponse*, SmartBlockWithArgs<std::__1::shared_ptr<__CFString const>, double, std::__1::shared_ptr<__CFError> >) + 612
  • 13 CFNetwork 0x00000001886bb6c0 invocation function for block in PAC::URLSessionPACFetcher::fetchPACFile(dispatch_queue_s*, std::__1::shared_ptr<PAC::PACQuery>, SmartBlockWithArgs<std::__1::shared_ptr<__CFString const>, double, std::__1::shared_ptr<__CFError> >) + 240
  • 14 CFNetwork 0x000000018867158c ___FetchPACFile_block_invoke + 272
  • 15 CFNetwork 0x000000018850834c ___75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 32
  • 16 CFNetwork 0x0000000188520048 ___49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 148
  • 17 Foundation 0x00000001889cd814 ___NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
  • 18 Foundation 0x0000000188912770 -[NSBlockOperation main] + 96
  • 19 Foundation 0x0000000188902b28 -[__NSOperationInternal _start:] + 612
  • 20 Foundation 0x00000001889cfbb0 ___NSOQSchedule_f + 228
  • 3 libdispatch.dylib 0x0000000186db69a0 __dispatch_client_callout + 16
  • 22 libdispatch.dylib 0x0000000186dc4ad4 __dispatch_queue_serial_drain + 928
  • 8 libdispatch.dylib 0x0000000186dba2cc __dispatch_queue_invoke + 884
  • 9 libdispatch.dylib 0x0000000186dc6a50 __dispatch_root_queue_drain + 540
  • 10 libdispatch.dylib 0x0000000186dc67d0 __dispatch_worker_thread3 + 124
  • 11 libsystem_pthread.dylib 0x0000000186fbf100 _pthread_wqthread + 1096
  • 1 libsystem_pthread.dylib 0x0000000186fbecac pthread_workqueue_addthreads_np + 120


Does anybody know about what could be the cause of this crash? If so, is there a fix/workaround for it?

Thanks,

levylin

It’s hard to do any sort of analysis on low-level crashes like this based on a third-party crash report. Do you have an Apple crash report for this problem?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

levylin emailed me a crash log. Running that through some tools here points to a known issue (r. 30462648). The underlying cause for this crash seems to be a bug in CFNetwork itself. This underlying cause may have been fixed in iOS 11 beta although the situation is a bit muddy so it’s hard to be 100% sure. What I am sure about is that this crash won’t affect your app on iOS 11, because the relevant code has been moved out into a separate process (as it was in earlier OS releases).

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

We are seeing the same crash occuring with a lot of our Mac OS 10.12.6 machines, is this fixed with Mac OS 10.13+ as well?

… is this fixed with Mac OS 10.13+ as well?

Probably. The bug I mentioned earlier (r. 30462648) was fixed indirectly by moving the core PAC execution out of each client’s process and in to a system process. That change applies to both iOS 11 and macOS 10.13. There may still be crashing bugs in that PAC execution code, but if there is then the resulting crash reports will be assigned to the system process that’s hosting the PAC execution.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
iOS10.3 Crash:PAC::PACExecutor::executePACScript
 
 
Q