Title: [274163] trunk/Source/WebKit
- Revision
- 274163
- Author
- [email protected]
- Date
- 2021-03-09 11:57:50 -0800 (Tue, 09 Mar 2021)
Log Message
[WinCairo] Deadlocks in WTF::Thread::ThreadHolder::~ThreadHolder while WebKitWebProcess.exe is shutting down
https://bugs.webkit.org/show_bug.cgi?id=222682
Reviewed by Don Olmstead.
WinCairo WebKit2 layout tests were observing deadlocks in
WTF::Thread::ThreadHolder::~ThreadHolder while
WebKitWebProcess.exe is shutting down in the IPC thread.
WebProcess calls _exit in IPC threads if a IPC connection is
disconnected.
r260911 (Bug 210955) fixed a similar deadlock by skipping the
destruction in ~ThreadHolder if the calling thread is the main
thread.
Microsoft Docs describe how a process is terminated and recommend
TerminateProcess API to avoid such deadlocks.
<https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess>
* NetworkProcess/NetworkProcess.cpp:
(WebKit::callExitSoon): Use TerminateProcess instead of _exit.
* WebProcess/WebProcess.cpp:
(WebKit::callExit): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (274162 => 274163)
--- trunk/Source/WebKit/ChangeLog 2021-03-09 19:24:05 UTC (rev 274162)
+++ trunk/Source/WebKit/ChangeLog 2021-03-09 19:57:50 UTC (rev 274163)
@@ -1,3 +1,29 @@
+2021-03-09 Fujii Hironori <[email protected]>
+
+ [WinCairo] Deadlocks in WTF::Thread::ThreadHolder::~ThreadHolder while WebKitWebProcess.exe is shutting down
+ https://bugs.webkit.org/show_bug.cgi?id=222682
+
+ Reviewed by Don Olmstead.
+
+ WinCairo WebKit2 layout tests were observing deadlocks in
+ WTF::Thread::ThreadHolder::~ThreadHolder while
+ WebKitWebProcess.exe is shutting down in the IPC thread.
+ WebProcess calls _exit in IPC threads if a IPC connection is
+ disconnected.
+
+ r260911 (Bug 210955) fixed a similar deadlock by skipping the
+ destruction in ~ThreadHolder if the calling thread is the main
+ thread.
+
+ Microsoft Docs describe how a process is terminated and recommend
+ TerminateProcess API to avoid such deadlocks.
+ <https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess>
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::callExitSoon): Use TerminateProcess instead of _exit.
+ * WebProcess/WebProcess.cpp:
+ (WebKit::callExit): Ditto.
+
2021-03-09 Ben Nham <[email protected]>
Adopt new NSURLSessionConfiguration SPI for connection cache configuration
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (274162 => 274163)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2021-03-09 19:24:05 UTC (rev 274162)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2021-03-09 19:57:50 UTC (rev 274163)
@@ -130,7 +130,12 @@
// global destructors or atexit handlers to be called from this thread while the main thread is busy
// doing its thing.
RELEASE_LOG_ERROR(IPC, "Exiting process early due to unacknowledged closed-connection");
+#if OS(WINDOWS)
+ // Calling _exit in non-main threads may cause a deadlock in WTF::Thread::ThreadHolder::~ThreadHolder.
+ TerminateProcess(GetCurrentProcess(), EXIT_FAILURE);
+#else
_exit(EXIT_FAILURE);
+#endif
});
}
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (274162 => 274163)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2021-03-09 19:24:05 UTC (rev 274162)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2021-03-09 19:57:50 UTC (rev 274163)
@@ -232,7 +232,12 @@
NO_RETURN static void callExit(IPC::Connection*)
{
+#if OS(WINDOWS)
+ // Calling _exit in non-main threads may cause a deadlock in WTF::Thread::ThreadHolder::~ThreadHolder.
+ TerminateProcess(GetCurrentProcess(), EXIT_SUCCESS);
+#else
_exit(EXIT_SUCCESS);
+#endif
}
WebProcess& WebProcess::singleton()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes