首页 > 解决方案 > WKWebView 进程在 CI 中终止但不在本地

问题描述

WKWebView当我在单元测试中加载页面时,内容进程 100% 崩溃。

它们在我的开发计算机上正常运行,但是当我在持续集成中运行测试时WKWebView不断调用。webViewWebContentProcessDidTerminate:这会导致测试失败。这是 CI 的输出:

Child process terminated with signal 11: Segmentation fault
Test crashed while running.
CRASH REPORT: xctest_2019-12-09-141138_pb74.crash
Process:               xctest [11083]
Path:                  /Applications/Xcode10.2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest
Identifier:            xctest
Version:               14490.71
Code Type:             X86-64 (Native)
Parent Process:        ??? [11077]
Responsible:           xctest [11083]
User ID:               503
Date/Time:             2019-12-09 14:11:37.719 -0800
OS Version:            Mac OS X 10.14.4 (18E226)
Report Version:        12
Anonymous UUID:        24ECA480-650F-8C0B-AE5B-4D2E3666588E
Time Awake Since Boot: 290000 seconds
System Integrity Protection: disabled
Crashed Thread:        0  Dispatch queue: com.apple.main-thread
Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY
Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [11083]
VM Regions Near 0:
--> 
__TEXT                 00000001067ea000-00000001067f0000 [   24K] r-x/rwx SM=COW  /Applications/Xcode10.2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest
Application Specific Information:
CoreSimulator 587.35 - Device: iPhone 8 (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) - Runtime: iOS 12.2 (16E226) - DeviceType: iPhone 8
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebKit                0x000000011f852f0b WebKit::WebProcessPool::networkProcessCrashed(WebKit::NetworkProcessProxy&, WTF::Vector<std::__1::pair<WTF::RefPtr<WebKit::WebProcessProxy, WTF::DumbPtrTraits<WebKit::WebProcessProxy> >, WTF::CompletionHandler<void (IPC::Attachment const&)> >, 0ul, WTF::CrashOnOverflow, 16ul>&&) + 89
1   com.apple.WebKit                0x000000011f8fc913 WebKit::NetworkProcessProxy::networkProcessCrashed() + 447
2   com.apple.WebKit                0x000000011f8fd604 WebKit::NetworkProcessProxy::didFinishLaunching(WebKit::ProcessLauncher*, IPC::Connection::Identifier) + 352
3   com.apple.WebKit                0x000000011f6b99e5 WebKit::ProcessLauncher::didFinishLaunchingProcess(int, IPC::Connection::Identifier) + 101
4   com.apple.WebKit                0x000000011f80db30 WTF::Function<void ()>::CallableWrapper<WebKit::ProcessLauncher::launchProcess()::$_2::operator()(NSObject<OS_xpc_object>*)::'lambda'()>::call() + 148
5   com.apple.JavaScriptCore        0x00000001121bb1f4 WTF::RunLoop::performWork() + 228
6   com.apple.JavaScriptCore        0x00000001121bb482 WTF::RunLoop::performWork(void*) + 34
7   com.apple.CoreFoundation        0x0000000107a60be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
8   com.apple.CoreFoundation        0x0000000107a60463 __CFRunLoopDoSources0 + 243
9   com.apple.CoreFoundation        0x0000000107a5ab1f __CFRunLoopRun + 1231
10  com.apple.CoreFoundation        0x0000000107a5a302 CFRunLoopRunSpecific + 626
11  com.apple.dt.XCTest             0x0000000106f81f24 -[XCTWaiter waitForExpectations:timeout:enforceOrder:] + 996
12  com.apple.dt.XCTest             0x0000000106f1beb2 -[XCTestCase(AsynchronousTesting) waitForExpectations:timeout:enforceOrder:] + 113
13  com.MyStupidApp.MyStupidFramework   0x000000011f06f391 -[MyStupidTestCase _loadSomeURL] + 369
...

我正在使用 Buckbuck test在本地和 CI中构建和运行单元测试。

据我所知,我的机器和 CI 机器最大的区别是:

  1. 用于 CI 的 Xcode 10.2,我的计算机上的 Xcode 10.3
  2. CI 运行的单元测试比我的要多得多,因此可能会从其他测试套件中溢出。

我现在正在努力解决这些差异。WKWebView但是,在我的计算机上正常工作时,什么样的事情可能会导致CI​​ 上的内容进程崩溃?

谢谢!

标签: iosunit-testingcontinuous-integrationwkwebviewbuck

解决方案


推荐阅读