Diff
Modified: trunk/Source/WebKit/ChangeLog (285114 => 285115)
--- trunk/Source/WebKit/ChangeLog 2021-11-01 17:14:17 UTC (rev 285114)
+++ trunk/Source/WebKit/ChangeLog 2021-11-01 17:45:35 UTC (rev 285115)
@@ -1,3 +1,25 @@
+2021-11-01 Sihui Liu <sihui_...@apple.com>
+
+ Increase responsiveness timeout for network process
+ https://bugs.webkit.org/show_bug.cgi?id=232505
+
+ Reviewed by Chris Dumez.
+
+ * UIProcess/AuxiliaryProcessProxy.cpp:
+ (WebKit::AuxiliaryProcessProxy::AuxiliaryProcessProxy):
+ * UIProcess/AuxiliaryProcessProxy.h:
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::NetworkProcessProxy):
+ (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
+ * UIProcess/ResponsivenessTimer.cpp:
+ (WebKit::ResponsivenessTimer::ResponsivenessTimer):
+ (WebKit::ResponsivenessTimer::timerFired):
+ (WebKit::ResponsivenessTimer::start):
+ (): Deleted.
+ * UIProcess/ResponsivenessTimer.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::getNetworkProcessConnection):
+
2021-11-01 Tim Horton <timothy_hor...@apple.com>
Add a testing preference to replay CG display lists manually
Modified: trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp (285114 => 285115)
--- trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp 2021-11-01 17:14:17 UTC (rev 285114)
+++ trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp 2021-11-01 17:45:35 UTC (rev 285115)
@@ -40,8 +40,8 @@
namespace WebKit {
-AuxiliaryProcessProxy::AuxiliaryProcessProxy(bool alwaysRunsAtBackgroundPriority)
- : m_responsivenessTimer(*this)
+AuxiliaryProcessProxy::AuxiliaryProcessProxy(bool alwaysRunsAtBackgroundPriority, Seconds responsivenessTimeout)
+ : m_responsivenessTimer(*this, responsivenessTimeout)
, m_alwaysRunsAtBackgroundPriority(alwaysRunsAtBackgroundPriority)
{
}
Modified: trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h (285114 => 285115)
--- trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h 2021-11-01 17:14:17 UTC (rev 285114)
+++ trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h 2021-11-01 17:45:35 UTC (rev 285115)
@@ -43,7 +43,7 @@
WTF_MAKE_NONCOPYABLE(AuxiliaryProcessProxy);
protected:
- explicit AuxiliaryProcessProxy(bool alwaysRunsAtBackgroundPriority = false);
+ AuxiliaryProcessProxy(bool alwaysRunsAtBackgroundPriority = false, Seconds responsivenessTimeout = ResponsivenessTimer::defaultResponsivenessTimeout);
public:
virtual ~AuxiliaryProcessProxy();
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (285114 => 285115)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2021-11-01 17:14:17 UTC (rev 285114)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2021-11-01 17:45:35 UTC (rev 285115)
@@ -86,6 +86,8 @@
namespace WebKit {
using namespace WebCore;
+static constexpr Seconds networkProcessResponsivenessTimeout = 6_s;
+
static HashSet<NetworkProcessProxy*>& networkProcessesSet()
{
ASSERT(RunLoop::isMain());
@@ -201,7 +203,7 @@
}
NetworkProcessProxy::NetworkProcessProxy()
- : AuxiliaryProcessProxy(anyProcessPoolAlwaysRunsAtBackgroundPriority())
+ : AuxiliaryProcessProxy(anyProcessPoolAlwaysRunsAtBackgroundPriority(), networkProcessResponsivenessTimeout)
#if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
, m_customProtocolManagerClient(makeUniqueRef<LegacyCustomProtocolManagerClient>())
, m_customProtocolManagerProxy(*this)
@@ -255,8 +257,7 @@
void NetworkProcessProxy::getNetworkProcessConnection(WebProcessProxy& webProcessProxy, Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply&& reply)
{
RELEASE_LOG(ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because a web process is requesting a connection", this);
- if (!isLaunching())
- startResponsivenessTimer(UseLazyStop::No);
+ startResponsivenessTimer(UseLazyStop::No);
sendWithAsyncReply(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess { webProcessProxy.coreProcessIdentifier(), webProcessProxy.sessionID() }, [this, weakThis = WeakPtr { *this }, reply = WTFMove(reply)](auto&& identifier, auto cookieAcceptPolicy) mutable {
if (!weakThis) {
RELEASE_LOG_ERROR(Process, "NetworkProcessProxy::getNetworkProcessConnection: NetworkProcessProxy deallocated during connection establishment");
Modified: trunk/Source/WebKit/UIProcess/ResponsivenessTimer.cpp (285114 => 285115)
--- trunk/Source/WebKit/UIProcess/ResponsivenessTimer.cpp 2021-11-01 17:14:17 UTC (rev 285114)
+++ trunk/Source/WebKit/UIProcess/ResponsivenessTimer.cpp 2021-11-01 17:45:35 UTC (rev 285115)
@@ -28,11 +28,10 @@
namespace WebKit {
-static const Seconds responsivenessTimeout { 3_s };
-
-ResponsivenessTimer::ResponsivenessTimer(ResponsivenessTimer::Client& client)
+ResponsivenessTimer::ResponsivenessTimer(ResponsivenessTimer::Client& client, Seconds responsivenessTimeout)
: m_client(client)
, m_timer(RunLoop::main(), this, &ResponsivenessTimer::timerFired)
+ , m_responsivenessTimeout(responsivenessTimeout)
{
}
@@ -72,7 +71,7 @@
if (!mayBecomeUnresponsive()) {
m_waitingForTimer = true;
- m_timer.startOneShot(responsivenessTimeout);
+ m_timer.startOneShot(m_responsivenessTimeout);
return;
}
@@ -97,10 +96,10 @@
//
// In most cases, stop is called before we get to schedule the second timer, saving us
// the scheduling of the timer entirely.
- m_restartFireTime = MonotonicTime::now() + responsivenessTimeout;
+ m_restartFireTime = MonotonicTime::now() + m_responsivenessTimeout;
} else {
m_restartFireTime = MonotonicTime();
- m_timer.startOneShot(responsivenessTimeout);
+ m_timer.startOneShot(m_responsivenessTimeout);
}
}
Modified: trunk/Source/WebKit/UIProcess/ResponsivenessTimer.h (285114 => 285115)
--- trunk/Source/WebKit/UIProcess/ResponsivenessTimer.h 2021-11-01 17:14:17 UTC (rev 285114)
+++ trunk/Source/WebKit/UIProcess/ResponsivenessTimer.h 2021-11-01 17:45:35 UTC (rev 285115)
@@ -47,7 +47,8 @@
virtual void deref() = 0;
};
- explicit ResponsivenessTimer(ResponsivenessTimer::Client&);
+ static constexpr Seconds defaultResponsivenessTimeout = 3_s;
+ ResponsivenessTimer(ResponsivenessTimer::Client&, Seconds responsivenessTimeout);
~ResponsivenessTimer();
void start();
@@ -87,6 +88,7 @@
bool m_isResponsive { true };
bool m_waitingForTimer { false };
bool m_useLazyStop { false };
+ Seconds m_responsivenessTimeout;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (285114 => 285115)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2021-11-01 17:14:17 UTC (rev 285114)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2021-11-01 17:45:35 UTC (rev 285115)
@@ -1567,33 +1567,14 @@
auto& networkProcessProxy = networkProcess();
networkProcessProxy.getNetworkProcessConnection(webProcessProxy, [weakThis = WeakPtr { *this }, networkProcessProxy = WeakPtr { networkProcessProxy }, webProcessProxy = WeakPtr { webProcessProxy }, reply = WTFMove(reply), shouldRetryOnFailure] (auto& connectionInfo) mutable {
if (UNLIKELY(!IPC::Connection::identifierIsValid(connectionInfo.identifier()))) {
- auto logError = [networkProcessProxy, webProcessProxy]() {
-#if OS(DARWIN)
- if (!os_variant_allows_internal_security_policies("com.apple.WebKit"))
- return;
-
- if (!webProcessProxy)
- return;
-
- int networkProcessIdentifier = 0;
- String networkProcessState = "Unknown"_s;
- if (networkProcessProxy) {
- networkProcessIdentifier = networkProcessProxy->processIdentifier();
- networkProcessState = networkProcessProxy->stateString();
- }
- RELEASE_LOG_ERROR(Process, "WebsiteDataStore::getNetworkProcessConnection: Failed to get connection - networkProcessProxy=%p, networkProcessIdentifier=%d, processState=%s, webProcessProxy=%p, webProcessIdentifier=%d", networkProcessProxy.get(), networkProcessIdentifier, networkProcessState.utf8().data(), webProcessProxy.get(), webProcessProxy->processIdentifier());
- RELEASE_ASSERT_NOT_REACHED();
-#endif
- };
-
if (shouldRetryOnFailure == ShouldRetryOnFailure::No || !webProcessProxy) {
- logError();
+ RELEASE_LOG_ERROR(Process, "getNetworkProcessConnection: Failed to get connection to network process, will reply invalid identifier ...");
reply({ });
return;
}
// Retry on the next RunLoop iteration because we may be inside the WebsiteDataStore destructor.
- RunLoop::main().dispatch([weakThis = WTFMove(weakThis), networkProcessProxy = WTFMove(networkProcessProxy), webProcessProxy = WTFMove(webProcessProxy), reply = WTFMove(reply), logError = WTFMove(logError)] () mutable {
+ RunLoop::main().dispatch([weakThis = WTFMove(weakThis), networkProcessProxy = WTFMove(networkProcessProxy), webProcessProxy = WTFMove(webProcessProxy), reply = WTFMove(reply)] () mutable {
if (RefPtr<WebsiteDataStore> strongThis = weakThis.get(); strongThis && webProcessProxy) {
// Terminate if it is the same network process.
if (networkProcessProxy && strongThis->m_networkProcess == networkProcessProxy.get())
@@ -1600,10 +1581,11 @@
strongThis->terminateNetworkProcess();
RELEASE_LOG_ERROR(Process, "getNetworkProcessConnection: Failed to get connection to network process, will retry ...");
strongThis->getNetworkProcessConnection(*webProcessProxy, WTFMove(reply), ShouldRetryOnFailure::No);
- } else {
- logError();
- reply({ });
+ return;
}
+
+ RELEASE_LOG_ERROR(Process, "getNetworkProcessConnection: Failed to get connection to network process, will reply invalid identifier ...");
+ reply({ });
});
return;
}