From d2eb88560c6da7cdc5623506ec0ef989fe652737 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Feb 07 2017 06:53:19 +0000 Subject: Add patches to make Evolution usable again - rhbz#1418413 --- diff --git a/0001-Soup-Deadlock-in-NetworkProcess.patch b/0001-Soup-Deadlock-in-NetworkProcess.patch new file mode 100644 index 0000000..ef0d07e --- /dev/null +++ b/0001-Soup-Deadlock-in-NetworkProcess.patch @@ -0,0 +1,76 @@ +From 74718f6b381932474a6b9df5cbfa6c9e04d599d2 Mon Sep 17 00:00:00 2001 +From: "carlosgc@webkit.org" + +Date: Mon, 6 Feb 2017 18:00:52 +0000 +Subject: [PATCH] [Soup] Deadlock in NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=167876 + +Reviewed by Michael Catanzaro. + +WebKitSoupRequestInputStream uses a read lock. What is happening is that webkitSoupRequestInputStreamAddData +takes the lock, and it calls webkitSoupRequestInputStreamPendingReadAsyncComplete with the lock help. That +causes webkitSoupRequestInputStreamReadAsync to be called again to read the next chunk, but in the same run loop +operation. We don't really need the read lock because both webkitSoupRequestInputStreamAddData and +webkitSoupRequestInputStreamReadAsync shoudl always be called from the main thread. + +* WebProcess/soup/WebKitSoupRequestInputStream.cpp: +(webkitSoupRequestInputStreamReadAsync): Remove the read lock and assert if called from a secondary thread. +(webkitSoupRequestInputStreamAddData): Ditto. + +git-svn-id: http://svn.webkit.org/repository/webkit/trunk@211734 268f45cc-cd09-0410-ab3c-d52691b4dbfc +--- + .../WebProcess/soup/WebKitSoupRequestInputStream.cpp | 11 ++++------- + 2 files changed, 21 insertions(+), 7 deletions(-) + +diff --git a/Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp b/Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp +index a3cdc8d..78d9761 100644 +--- a/Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp ++++ b/Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp +@@ -20,8 +20,7 @@ + #include "config.h" + #include "WebKitSoupRequestInputStream.h" + +-#include +-#include ++#include + #include + #include + +@@ -45,7 +44,6 @@ struct _WebKitSoupRequestInputStreamPrivate { + + GUniquePtr error; + +- Lock readLock; + std::unique_ptr pendingAsyncRead; + }; + +@@ -85,11 +83,10 @@ static bool webkitSoupRequestInputStreamIsWaitingForData(WebKitSoupRequestInputS + + static void webkitSoupRequestInputStreamReadAsync(GInputStream* inputStream, void* buffer, gsize count, int /*priority*/, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer userData) + { ++ ASSERT(isMainThread()); + WebKitSoupRequestInputStream* stream = WEBKIT_SOUP_REQUEST_INPUT_STREAM(inputStream); + GRefPtr task = adoptGRef(g_task_new(stream, cancellable, callback, userData)); + +- LockHolder locker(stream->priv->readLock); +- + if (!webkitSoupRequestInputStreamHasDataToRead(stream) && !webkitSoupRequestInputStreamIsWaitingForData(stream)) { + g_task_return_int(task.get(), 0); + return; +@@ -149,11 +146,11 @@ GInputStream* webkitSoupRequestInputStreamNew(uint64_t contentLength) + + void webkitSoupRequestInputStreamAddData(WebKitSoupRequestInputStream* stream, const void* data, size_t dataLength) + { ++ ASSERT(isMainThread()); ++ + if (webkitSoupRequestInputStreamFinished(stream)) + return; + +- LockHolder locker(stream->priv->readLock); +- + if (dataLength) { + // Truncate the dataLength to the contentLength if it's known. + if (stream->priv->contentLength && stream->priv->bytesReceived + dataLength > stream->priv->contentLength) +-- +2.9.3 + diff --git a/0001-Soup-Long-resources-loaded-by-custom-protocols-somet.patch b/0001-Soup-Long-resources-loaded-by-custom-protocols-somet.patch new file mode 100644 index 0000000..197ec0b --- /dev/null +++ b/0001-Soup-Long-resources-loaded-by-custom-protocols-somet.patch @@ -0,0 +1,86 @@ +From b5dfae56bcc197d04f3bdfdbe7e0aadd470ca43a Mon Sep 17 00:00:00 2001 +From: "carlosgc@webkit.org" + +Date: Tue, 7 Feb 2017 06:12:53 +0000 +Subject: [PATCH] [Soup] Long resources loaded by custom protocols sometimes + never finish loading https://bugs.webkit.org/show_bug.cgi?id=167890 + +Reviewed by Michael Catanzaro. + +It's another bug that has appeared in WebKitSoupRequestInputStream after moving the custom protocols handling to +the main thread. The problem is that webkitSoupRequestInputStreamPendingReadAsyncComplete invalidates +pendingAsyncRead after calling webkitSoupRequestInputStreamReadAsyncResultComplete, but in some cases +webkitSoupRequestInputStreamReadAsyncResultComplete completes the task in the same run loop iteration. In that +case webkitSoupRequestInputStreamReadAsync is called again creating a new AsyncReadData that is destroyed right +after webkitSoupRequestInputStreamReadAsyncResultComplete returns. + +* WebProcess/soup/WebKitSoupRequestInputStream.cpp: +(AsyncReadData::AsyncReadData): Use an rvalue reference for the task. +(webkitSoupRequestInputStreamPendingReadAsyncComplete): Use WTFMove to ensure pendingAsyncRead is cleared before +webkitSoupRequestInputStreamReadAsyncResultComplete is called, and continue processing pending requests if there +are new ones after webkitSoupRequestInputStreamReadAsyncResultComplete. +(webkitSoupRequestInputStreamReadAsync): Use WTFMove to transfer the task to AsyncReadData. +(webkitSoupRequestInputStreamDidFailWithError): Use WTFMove to ensure pendingAsyncRead is cleared. + +git-svn-id: http://svn.webkit.org/repository/webkit/trunk@211773 268f45cc-cd09-0410-ab3c-d52691b4dbfc +--- + .../soup/WebKitSoupRequestInputStream.cpp | 21 +++++++++------------ + 2 files changed, 31 insertions(+), 12 deletions(-) + +diff --git a/Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp b/Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp +index 78d9761..25b6c07 100644 +--- a/Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp ++++ b/Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp +@@ -25,8 +25,8 @@ + #include + + struct AsyncReadData { +- AsyncReadData(GTask* task, void* buffer, gsize count) +- : task(task) ++ AsyncReadData(GRefPtr&& task, void* buffer, gsize count) ++ : task(WTFMove(task)) + , buffer(buffer) + , count(count) + { +@@ -63,12 +63,10 @@ static void webkitSoupRequestInputStreamReadAsyncResultComplete(GTask* task, voi + + static void webkitSoupRequestInputStreamPendingReadAsyncComplete(WebKitSoupRequestInputStream* stream) + { +- if (!stream->priv->pendingAsyncRead) +- return; +- +- AsyncReadData* data = stream->priv->pendingAsyncRead.get(); +- webkitSoupRequestInputStreamReadAsyncResultComplete(data->task.get(), data->buffer, data->count); +- stream->priv->pendingAsyncRead = nullptr; ++ while (stream->priv->pendingAsyncRead) { ++ auto data = WTFMove(stream->priv->pendingAsyncRead); ++ webkitSoupRequestInputStreamReadAsyncResultComplete(data->task.get(), data->buffer, data->count); ++ } + } + + static bool webkitSoupRequestInputStreamHasDataToRead(WebKitSoupRequestInputStream* stream) +@@ -102,7 +100,7 @@ static void webkitSoupRequestInputStreamReadAsync(GInputStream* inputStream, voi + return; + } + +- stream->priv->pendingAsyncRead = std::make_unique(task.get(), buffer, count); ++ stream->priv->pendingAsyncRead = std::make_unique(WTFMove(task), buffer, count); + } + + static gssize webkitSoupRequestInputStreamReadFinish(GInputStream* inputStream, GAsyncResult* result, GError** error) +@@ -171,10 +169,9 @@ void webkitSoupRequestInputStreamAddData(WebKitSoupRequestInputStream* stream, c + void webkitSoupRequestInputStreamDidFailWithError(WebKitSoupRequestInputStream* stream, const WebCore::ResourceError& resourceError) + { + GUniquePtr error(g_error_new(g_quark_from_string(resourceError.domain().utf8().data()), resourceError.errorCode(), "%s", resourceError.localizedDescription().utf8().data())); +- if (stream->priv->pendingAsyncRead) { +- AsyncReadData* data = stream->priv->pendingAsyncRead.get(); ++ if (auto data = WTFMove(stream->priv->pendingAsyncRead)) + g_task_return_error(data->task.get(), error.release()); +- } else { ++ else { + stream->priv->contentLength = stream->priv->bytesReceived; + stream->priv->error = WTFMove(error); + } +-- +2.9.3 + diff --git a/webkitgtk4.spec b/webkitgtk4.spec index 5cb4982..b5ac3ab 100644 --- a/webkitgtk4.spec +++ b/webkitgtk4.spec @@ -7,7 +7,7 @@ Name: webkitgtk4 Version: 2.15.4 -Release: 3%{?dist} +Release: 4%{?dist} Summary: GTK+ Web content engine library License: LGPLv2 @@ -23,6 +23,10 @@ Patch1: fedora-crypto-policy.patch # https://bugs.webkit.org/show_bug.cgi?id=167643 # https://bugs.webkit.org/show_bug.cgi?id=167785 Patch2: gcc7.patch +# https://bugs.webkit.org/show_bug.cgi?id=167876 +Patch3: 0001-Soup-Deadlock-in-NetworkProcess.patch +# https://bugs.webkit.org/show_bug.cgi?id=167890 +Patch4: 0001-Soup-Long-resources-loaded-by-custom-protocols-somet.patch BuildRequires: at-spi2-core-devel BuildRequires: bison @@ -257,6 +261,9 @@ make %{?_smp_mflags} -C %{_target_platform} %{_datadir}/gtk-doc/html/webkitdomgtk-4.0/ %changelog +* Tue Feb 07 2017 Tomas Popela - 2.15.4-4 +- Add patches to make Evolution usable again - rhbz#1418413 + * Thu Feb 02 2017 Tomas Popela - 2.15.4-3 - Push gcc7 fixes, only buildable with gcc-7.0.1-0.5.fc26 and higher