Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog (151370 => 151371)
--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog 2013-06-10 09:31:30 UTC (rev 151370)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog 2013-06-10 09:43:00 UTC (rev 151371)
@@ -1,3 +1,36 @@
+2013-05-28 Lauro Neto <[email protected]>
+
+ [GTK] Connection issues in repeated WebProcess crash/reloads.
+ https://bugs.webkit.org/show_bug.cgi?id=115880
+
+ Reviewed by Anders Carlsson.
+
+ When stressing the WebProcess creation/destruction, WebKitGTK can
+ often run into socket issues like bad file descriptor errors or
+ polling a socket indefinitely.
+
+ Currently WebKitGTK has three places where a socket can be
+ closed.
+
+ - childFinishedFunction (in ProcessLauncherGtk.cpp)
+ - Connection::platformInvalidate (in ConnectionUnix.cpp)
+ - WorkQueue EventSource destruction (in WorkQueueGtk.cpp)
+
+ To avoid these race conditions, socket closing will be handled
+ by the event source callback in WorkQueueGtk.cpp.
+
+ * Platform/CoreIPC/unix/ConnectionUnix.cpp:
+ (CoreIPC::Connection::platformInvalidate): Do not close the socket
+ when the connection is invalidated, the socket event source is
+ unregistered in this method and the socket is closed when the
+ GSocket associated to the event source is destroyed.
+ * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
+ (WebKit::ProcessLauncher::launchProcess): Do not monitor child
+ process to close the connection on termination. This was needed in
+ the past when we used DGRAM sockets, we currently use always
+ connection oriented sockets, so that when the other end closes
+ the connection we are notified and the connection is invalidated.
+
2013-05-11 Andreas Kling <[email protected]>
When possible, terminate web processes immediately when closing their last page.
Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp (151370 => 151371)
--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp 2013-06-10 09:31:30 UTC (rev 151370)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp 2013-06-10 09:43:00 UTC (rev 151371)
@@ -133,8 +133,11 @@
void Connection::platformInvalidate()
{
+ // In GTK+ platform the socket is closed by the work queue.
+#if !PLATFORM(GTK)
if (m_socketDescriptor != -1)
while (close(m_socketDescriptor) == -1 && errno == EINTR) { }
+#endif
if (!m_isConnected)
return;
Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp (151370 => 151371)
--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp 2013-06-10 09:31:30 UTC (rev 151370)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp 2013-06-10 09:43:00 UTC (rev 151371)
@@ -62,14 +62,6 @@
close(socket);
}
-static void childFinishedFunction(GPid, gint status, gpointer userData)
-{
- if (WIFEXITED(status) && !WEXITSTATUS(status))
- return;
-
- close(GPOINTER_TO_INT(userData));
-}
-
void ProcessLauncher::launchProcess()
{
GPid pid = 0;
@@ -100,8 +92,7 @@
argv[3] = 0;
GOwnPtr<GError> error;
- int spawnFlags = G_SPAWN_LEAVE_DESCRIPTORS_OPEN | G_SPAWN_DO_NOT_REAP_CHILD;
- if (!g_spawn_async(0, argv, 0, static_cast<GSpawnFlags>(spawnFlags), childSetupFunction, GINT_TO_POINTER(sockets[1]), &pid, &error.outPtr())) {
+ if (!g_spawn_async(0, argv, 0, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, childSetupFunction, GINT_TO_POINTER(sockets[1]), &pid, &error.outPtr())) {
g_printerr("Unable to fork a new WebProcess: %s.\n", error->message);
ASSERT_NOT_REACHED();
}
@@ -109,10 +100,6 @@
close(sockets[0]);
m_processIdentifier = pid;
- // Monitor the child process, it calls waitpid to prevent the child process from becomming a zombie,
- // and it allows us to close the socket when the child process crashes.
- g_child_watch_add(m_processIdentifier, childFinishedFunction, GINT_TO_POINTER(sockets[1]));
-
// We've finished launching the process, message back to the main run loop.
RunLoop::main()->dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, m_processIdentifier, sockets[1]));
}