Changeset 285720 in webkit
- Timestamp:
- Nov 12, 2021, 8:18:51 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (modified) (1 diff)
-
Source/WebKit/UIProcess/Launcher/ProcessLauncher.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/Launcher/ProcessLauncher.h (modified) (1 diff)
-
Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebProcessTerminate.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r285717 r285720 1 2021-11-12 Chris Dumez <cdumez@apple.com> 2 3 WebKit is unable to recover if a WebProcess gets terminated while it is launching 4 https://bugs.webkit.org/show_bug.cgi?id=233001 5 <rdar://85302938> 6 7 Reviewed by Brent Fulgham. 8 9 While investigating <rdar://83941760>, I found that the WebAuthn Process would get 10 jetsammed, which would cause us to call WebProcessPool::terminateAllWebContentProcesses(). 11 I also noticed that if one of these WebProcesses was still launching at the time 12 of the termination, then the WebProcessProxy / WebPageProxy would keep thinking the 13 WebProcess is still launching and would never attempt to relaunch it. This would result 14 in a blank and unresponsive WKWebView which wouldn't be able to do any loads. 15 16 The issue was due to ProcessLauncher::terminateProcess() calling invalidate(), which 17 it would not only terminate the XPC connection, it would also null out m_client. As a 18 result, we wouldn't notify the client that the process failed to launch. To address 19 the issue, I move the XPC connection termination logic out of invalidate() and into 20 its own terminateXPCConnection() function. I then called terminateXPCConnection() 21 instead of invalidate() inside ProcessLauncher::terminateProcess(). 22 23 * UIProcess/API/Cocoa/WKProcessPool.mm: 24 (-[WKProcessPool _terminateAllWebContentProcesses]): 25 * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 26 * UIProcess/Launcher/ProcessLauncher.cpp: 27 (WebKit::ProcessLauncher::invalidate): 28 * UIProcess/Launcher/ProcessLauncher.h: 29 * UIProcess/Launcher/mac/ProcessLauncherMac.mm: 30 (WebKit::ProcessLauncher::terminateProcess): 31 (WebKit::ProcessLauncher::platformInvalidate): 32 (WebKit::ProcessLauncher::terminateXPCConnection): 33 1 34 2021-11-12 Chris Dumez <cdumez@apple.com> 2 35 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
r285047 r285720 591 591 } 592 592 593 - (void)_terminateAllWebContentProcesses 594 { 595 _processPool->terminateAllWebContentProcesses(); 596 } 597 593 598 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
r282218 r285720 99 99 - (pid_t)_prewarmedProcessIdentifier WK_API_AVAILABLE(macos(10.15), ios(13.0)); 100 100 101 - (void)_terminateAllWebContentProcesses; 102 101 103 // Test only. 102 104 - (size_t)_webProcessCount WK_API_AVAILABLE(macos(10.13), ios(11.0)); -
trunk/Source/WebKit/UIProcess/Launcher/ProcessLauncher.cpp
r249274 r285720 62 62 void ProcessLauncher::invalidate() 63 63 { 64 m_client = 0;64 m_client = nullptr; 65 65 platformInvalidate(); 66 66 } -
trunk/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h
r285594 r285720 123 123 void platformInvalidate(); 124 124 125 #if PLATFORM(COCOA) 126 void terminateXPCConnection(); 127 #endif 128 125 129 Client* m_client; 126 130 -
trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm
r285594 r285720 323 323 { 324 324 if (m_isLaunching) { 325 invalidate();325 terminateXPCConnection(); 326 326 return; 327 327 } … … 336 336 void ProcessLauncher::platformInvalidate() 337 337 { 338 terminateXPCConnection(); 339 } 340 341 void ProcessLauncher::terminateXPCConnection() 342 { 338 343 if (!m_xpcConnection) 339 344 return; -
trunk/Tools/ChangeLog
r285717 r285720 1 2021-11-12 Chris Dumez <cdumez@apple.com> 2 3 WebKit is unable to recover if a WebProcess gets terminated while it is launching 4 https://bugs.webkit.org/show_bug.cgi?id=233001 5 <rdar://85302938> 6 7 Reviewed by Brent Fulgham. 8 9 Add API test coverage, this test was timing out before the fix. 10 11 * TestWebKitAPI/Tests/WebKitCocoa/WebProcessTerminate.mm: 12 (TEST): 13 1 14 2021-11-12 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebProcessTerminate.mm
r242339 r285720 30 30 #import "TestNavigationDelegate.h" 31 31 32 #import <WebKit/WKProcessPoolPrivate.h> 32 33 #import <WebKit/WKWebViewPrivate.h> 33 34 #import <WebKit/WebKit.h> … … 48 49 EXPECT_TRUE(pid != pid2); 49 50 } 51 52 TEST(WebKit, TerminateAllProcessesDuringLaunch) 53 { 54 auto webView = adoptNS([WKWebView new]); 55 56 // Initiate a load to make sure the process actually launches. 57 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; 58 59 // Call terminateAllProcesses while the process is still launching. 60 [webView.get().configuration.processPool _terminateAllWebContentProcesses]; 61 62 TestWebKitAPI::Util::sleep(0.5); 63 64 // The WKWebView should be able to recover from the WebProcess termination and navigation should succeed. 65 [webView loadHTMLString:@"test" baseURL:nil]; 66 [webView _test_waitForDidFinishNavigation]; 67 }
Note:
See TracChangeset
for help on using the changeset viewer.