Bug 208541 - Running a single layout test makes 28 WebProcessPools (and launches 6 Network processes)
Summary: Running a single layout test makes 28 WebProcessPools (and launches 6 Network...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on: 208546 208610 208619
Blocks:
  Show dependency treegraph
 
Reported: 2020-03-03 15:43 PST by Simon Fraser (smfr)
Modified: 2020-03-05 15:55 PST (History)
10 users (show)

See Also:


Attachments
Patch (9.92 KB, patch)
2020-03-05 10:38 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (10.45 KB, patch)
2020-03-05 13:50 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2020-03-03 15:43:35 PST
run-webkit-tests --debug fast/scrolling/programmatic-scroll-to-zero-zero.html

with:

diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp
index 432950d9269fc17023273dcf1c8bb3a18fbc4551..a32c8d14061b3c8e0f72ca0481b03e01361ac5c0 100644
--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp
+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp
@@ -157,6 +157,7 @@ NetworkProcess::NetworkProcess(AuxiliaryProcessInitializationParameters&& parame
 #endif
     , m_messagePortChannelRegistry(createMessagePortChannelRegistry(*this))
 {
+    WTFLogAlways("NetworkProcess %p NetworkProcess", this);
     NetworkProcessPlatformStrategies::initialize();
 
     addSupplement<AuthenticationManager>();
@@ -186,6 +187,8 @@ NetworkProcess::NetworkProcess(AuxiliaryProcessInitializationParameters&& parame
 
 NetworkProcess::~NetworkProcess()
 {
+    WTFLogAlways("NetworkProcess %p ~NetworkProcess", this);
+
     for (auto& callbacks : m_cacheStorageParametersCallbacks.values()) {
         for (auto& callback : callbacks)
             callback(String { });
diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp
index eabc897bb3e6435b0e6868b5d36e52f5adaaef54..f74ad13b93f4355f4da35437ce923b9cf4d19d35 100644
--- a/Source/WebKit/UIProcess/WebProcessPool.cpp
+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp
@@ -250,6 +250,7 @@ WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration& configuration)
     , m_backForwardCache(makeUniqueRef<WebBackForwardCache>(*this))
     , m_webProcessCache(makeUniqueRef<WebProcessCache>(*this))
 {
+    WTFLogAlways("WebProcessPool %p WebProcessPool", this);
     static std::once_flag onceFlag;
     std::call_once(onceFlag, [] {
         WTF::setProcessPrivileges(allPrivileges());
@@ -304,6 +305,8 @@ WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration& configuration)
 
 WebProcessPool::~WebProcessPool()
 {
+    WTFLogAlways("WebProcessPool %p ~WebProcessPool", this);
+
     m_webProcessCache->clear();
 
     bool removed = processPools().removeFirst(this);

results in:

WebProcessPool 0x132808208 WebProcessPool
WebProcessPool 0x14a00a008 WebProcessPool
NetworkProcess 0x11691eba0 NetworkProcess
WebProcessPool 0x14a00a008 ~WebProcessPool
WebProcessPool 0x13286ee08 WebProcessPool
Program ended with exit code: 0NetworkProcess 0x11302fba0 NetworkProcess
WebProcessPool 0x13286ee08 ~WebProcessPool
WebProcessPool 0x13286ee08 WebProcessPool
Program ended with exit code: 0NetworkProcess 0x114d20ba0 NetworkProcess
WebProcessPool 0x13286ee08 ~WebProcessPool
WebProcessPool 0x13286ee08 WebProcessPool
Program ended with exit code: 0NetworkProcess 0x119365ba0 NetworkProcess
WebProcessPool 0x13286ee08 ~WebProcessPool
WebProcessPool 0x13300e208 WebProcessPool
WebProcessPool 0x13300e208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x132808208 WebProcessPool
WebProcessPool 0x14a00a008 WebProcessPool
NetworkProcess 0x11691eba0 NetworkProcess
WebProcessPool 0x14a00a008 ~WebProcessPool
WebProcessPool 0x13286ee08 WebProcessPool
Program ended with exit code: 0NetworkProcess 0x11302fba0 NetworkProcess
WebProcessPool 0x13286ee08 ~WebProcessPool
WebProcessPool 0x13286ee08 WebProcessPool
Program ended with exit code: 0NetworkProcess 0x114d20ba0 NetworkProcess
WebProcessPool 0x13286ee08 ~WebProcessPool
WebProcessPool 0x13286ee08 WebProcessPool
Program ended with exit code: 0NetworkProcess 0x119365ba0 NetworkProcess
WebProcessPool 0x13286ee08 ~WebProcessPool
WebProcessPool 0x13300e208 WebProcessPool
WebProcessPool 0x13300e208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
WebProcessPool 0x134008208 WebProcessPool
WebProcessPool 0x134008208 ~WebProcessPool
Program ended with exit code: 0NetworkProcess 0x11348fba0 NetworkProcess
Element 0x118d7b940 setScrollTop 20 (currently 0)
Element 0x118d7b940 setScrollTop 0 (currently 20)
Element 0x118d7b940 setScrollTop 0 (currently 100)
Content-Type: text/plain
layer at (0,0) size 785x2016
  RenderView at (0,0) size 785x600
layer at (0,0) size 785x2016
  RenderBlock {HTML} at (0,0) size 785x2016
    RenderBody {BODY} at (8,8) size 769x2000
      RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#008000]
#EOF
#EOF
#EOF
LEAK: 1 WebProcessPool
LEAK: 1 WebPageProxy
Program ended with exit code: 0Program ended with exit code: 1Program ended with exit code: 0Program ended with exit code: 0
Comment 1 Simon Fraser (smfr) 2020-03-03 15:51:37 PST
Some of the call sites:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 30.1
    frame #0: 0x0000000107cc1835 WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x0000000132808208, configuration=0x000000012f808188) at WebProcessPool.cpp:255:5
    frame #1: 0x0000000107cc04ed WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x0000000132808208, configuration=0x000000012f808188) at WebProcessPool.cpp:252:1
    frame #2: 0x0000000107cc0456 WebKit`WebKit::WebProcessPool::create(configuration=0x000000012f808188) at WebProcessPool.cpp:179:26
    frame #3: 0x00000001080d8714 WebKit`WebKit::WebsiteDataStore::processPools(this=0x000000012ef3e3a8, count=18446744073709551615, ensureAPoolExists=true) const at WebsiteDataStore.cpp:1910:28
  * frame #4: 0x00000001080dabe8 WebKit`WebKit::WebsiteDataStore::removeData(this=0x000000012ef3e3a8, dataTypes={ size = 1 }, modifiedSince=(m_value = -Inf), completionHandler=0x00007ffeefbfed50)>&&) at WebsiteDataStore.cpp:707:34
    frame #5: 0x0000000107ee3a8f WebKit`::WKWebsiteDataStoreRemoveAllIndexedDatabases(dataStoreRef=0x000000012ef3e3a0, context=0x00007ffeefbfedb8, callback=(WebKitTestRunner`WTR::StorageVoidCallback(void*) at TestController.cpp:3208)) at WKWebsiteDataStoreRef.cpp:627:35
    frame #6: 0x0000000100036d7f WebKitTestRunner`WTR::TestController::clearIndexedDatabases(this=0x00007ffeefbff3b8) at TestController.cpp:3217:5
    frame #7: 0x00000001000363ec WebKitTestRunner`WTR::TestController::resetStateToConsistentValues(this=0x00007ffeefbff3b8, options=0x00007ffeefbfef90, resetStage=BeforeTest) at TestController.cpp:1017:5
    frame #8: 0x0000000100035e64 WebKitTestRunner`WTR::TestController::ensureViewSupportsOptionsForTest(this=0x00007ffeefbff3b8, test=0x00000001484ec000) at TestController.cpp:819:10
...

    frame #0: 0x0000000107cc1835 WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x000000012f046808, configuration=0x000000012ef4d898) at WebProcessPool.cpp:255:5
    frame #1: 0x0000000107cc04ed WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x000000012f046808, configuration=0x000000012ef4d898) at WebProcessPool.cpp:252:1
    frame #2: 0x0000000107cc0456 WebKit`WebKit::WebProcessPool::create(configuration=0x000000012ef4d898) at WebProcessPool.cpp:179:26
    frame #3: 0x00000001080d8714 WebKit`WebKit::WebsiteDataStore::processPools(this=0x000000012ef3e3a8, count=18446744073709551615, ensureAPoolExists=true) const at WebsiteDataStore.cpp:1910:28
    frame #4: 0x00000001080e8c71 WebKit`WebKit::WebsiteDataStore::resetQuota(this=0x000000012ef3e3a8, completionHandler=0x00007ffeefbfed68)>&&) at WebsiteDataStore.cpp:2235:30
    frame #5: 0x0000000107ee3f4b WebKit`::WKWebsiteDataStoreResetQuota(dataStoreRef=0x000000012ef3e3a0, context=0x00007ffeefbfedb8, callback=(WebKitTestRunner`WTR::StorageVoidCallback(void*) at TestController.cpp:3208)) at WKWebsiteDataStoreRef.cpp:712:35
  * frame #6: 0x0000000100036f8f WebKitTestRunner`WTR::TestController::resetQuota(this=0x00007ffeefbff3b8) at TestController.cpp:3242:5
    frame #7: 0x000000010003641c WebKitTestRunner`WTR::TestController::resetStateToConsistentValues(this=0x00007ffeefbff3b8, options=0x00007ffeefbfef90, resetStage=BeforeTest) at TestController.cpp:1023:5
    frame #8: 0x0000000100035e64 WebKitTestRunner`WTR::TestController::ensureViewSupportsOptionsForTest(this=0x00007ffeefbff3b8, test=0x00000001484ec000) at TestController.cpp:819:10
...

  * frame #0: 0x0000000107cc1835 WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x000000014880fe08, configuration=0x0000000132726158) at WebProcessPool.cpp:255:5
    frame #1: 0x0000000107cc04ed WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x000000014880fe08, configuration=0x0000000132726158) at WebProcessPool.cpp:252:1
    frame #2: 0x0000000107cc0456 WebKit`WebKit::WebProcessPool::create(configuration=0x0000000132726158) at WebProcessPool.cpp:179:26
    frame #3: 0x00000001080d8714 WebKit`WebKit::WebsiteDataStore::processPools(this=0x000000012ef3e3a8, count=18446744073709551615, ensureAPoolExists=true) const at WebsiteDataStore.cpp:1910:28
    frame #4: 0x00000001080dc0a1 WebKit`WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses(this=0x000000012ef3e3a8, callback=0x00007ffeefbfed38)>&&) at WebsiteDataStore.cpp:2100:34
    frame #5: 0x0000000107ee30dc WebKit`::WKWebsiteDataStoreStatisticsResetToConsistentState(dataStoreRef=0x000000012ef3e3a0, context=0x00007ffeefbfedb0, completionHandler=(WebKitTestRunner`WTR::resourceStatisticsVoidResultCallback(void*) at TestController.cpp:3344)) at WKWebsiteDataStoreRef.cpp:589:11
    frame #6: 0x00000001000377ef WebKitTestRunner`WTR::TestController::statisticsResetToConsistentState(this=0x00007ffeefbff3b8) at TestController.cpp:3698:5
    frame #7: 0x000000010003687b WebKitTestRunner`WTR::TestController::resetStateToConsistentValues(this=0x00007ffeefbff3b8, options=0x00007ffeefbfef90, resetStage=BeforeTest) at TestController.cpp:1118:5
    frame #8: 0x0000000100035e64 WebKitTestRunner`WTR::TestController::ensureViewSupportsOptionsForTest(this=0x00007ffeefbff3b8, test=0x00000001484ec000) at TestController.cpp:819:10
...

  * frame #0: 0x0000000107cc1835 WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x0000000136819008, configuration=0x0000000132321a38) at WebProcessPool.cpp:255:5
    frame #1: 0x0000000107cc04ed WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x0000000136819008, configuration=0x0000000132321a38) at WebProcessPool.cpp:252:1
    frame #2: 0x0000000107cc0456 WebKit`WebKit::WebProcessPool::create(configuration=0x0000000132321a38) at WebProcessPool.cpp:179:26
    frame #3: 0x00000001080d8714 WebKit`WebKit::WebsiteDataStore::processPools(this=0x000000012ef3e3a8, count=18446744073709551615, ensureAPoolExists=true) const at WebsiteDataStore.cpp:1910:28
    frame #4: 0x00000001080e6cb1 WebKit`WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources(this=0x000000012ef3e3a8, completionHandler=0x00007ffeefbfed20)>&&) at WebsiteDataStore.cpp:1872:30
    frame #5: 0x0000000107ee3123 WebKit`::WKWebsiteDataStoreStatisticsResetToConsistentState(dataStoreRef=0x000000012ef3e3a0, context=0x00007ffeefbfedb0, completionHandler=(WebKitTestRunner`WTR::resourceStatisticsVoidResultCallback(void*) at TestController.cpp:3344)) at WKWebsiteDataStoreRef.cpp:590:11
    frame #6: 0x00000001000377ef WebKitTestRunner`WTR::TestController::statisticsResetToConsistentState(this=0x00007ffeefbff3b8) at TestController.cpp:3698:5
    frame #7: 0x000000010003687b WebKitTestRunner`WTR::TestController::resetStateToConsistentValues(this=0x00007ffeefbff3b8, options=0x00007ffeefbfef90, resetStage=BeforeTest) at TestController.cpp:1118:5
    frame #8: 0x0000000100035e64 WebKitTestRunner`WTR::TestController::ensureViewSupportsOptionsForTest(this=0x00007ffeefbff3b8, test=0x00000001484ec000) at TestController.cpp:819:10
...

  * frame #0: 0x0000000107cc1835 WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x0000000134036608, configuration=0x0000000132676d98) at WebProcessPool.cpp:255:5
    frame #1: 0x0000000107cc04ed WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x0000000134036608, configuration=0x0000000132676d98) at WebProcessPool.cpp:252:1
    frame #2: 0x0000000107cc0456 WebKit`WebKit::WebProcessPool::create(configuration=0x0000000132676d98) at WebProcessPool.cpp:179:26
    frame #3: 0x00000001080d8714 WebKit`WebKit::WebsiteDataStore::processPools(this=0x000000012ef3e3a8, count=18446744073709551615, ensureAPoolExists=true) const at WebsiteDataStore.cpp:1910:28
    frame #4: 0x00000001080e53b1 WebKit`WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting(this=0x000000012ef3e3a8, completionHandler=0x00007ffeefbfed08)>&&) at WebsiteDataStore.cpp:1752:30
    frame #5: 0x0000000107ee3176 WebKit`::WKWebsiteDataStoreStatisticsResetToConsistentState(dataStoreRef=0x000000012ef3e3a0, context=0x00007ffeefbfedb0, completionHandler=(WebKitTestRunner`WTR::resourceStatisticsVoidResultCallback(void*) at TestController.cpp:3344)) at WKWebsiteDataStoreRef.cpp:591:11
    frame #6: 0x00000001000377ef WebKitTestRunner`WTR::TestController::statisticsResetToConsistentState(this=0x00007ffeefbff3b8) at TestController.cpp:3698:5
    frame #7: 0x000000010003687b WebKitTestRunner`WTR::TestController::resetStateToConsistentValues(this=0x00007ffeefbff3b8, options=0x00007ffeefbfef90, resetStage=BeforeTest) at TestController.cpp:1118:5
    frame #8: 0x0000000100035e64 WebKitTestRunner`WTR::TestController::ensureViewSupportsOptionsForTest(this=0x00007ffeefbff3b8, test=0x00000001484ec000) at TestController.cpp:819:10
...


    frame #0: 0x0000000107cc1835 WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x000000013700ee08, configuration=0x000000013241a358) at WebProcessPool.cpp:255:5
    frame #1: 0x0000000107cc04ed WebKit`WebKit::WebProcessPool::WebProcessPool(this=0x000000013700ee08, configuration=0x000000013241a358) at WebProcessPool.cpp:252:1
    frame #2: 0x0000000107cc0456 WebKit`WebKit::WebProcessPool::create(configuration=0x000000013241a358) at WebProcessPool.cpp:179:26
    frame #3: 0x00000001080d8714 WebKit`WebKit::WebsiteDataStore::processPools(this=0x000000012ef3e3a8, count=18446744073709551615, ensureAPoolExists=true) const at WebsiteDataStore.cpp:1910:28
  * frame #4: 0x00000001080e62a9 WebKit`WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(this=0x000000012ef3e3a8, enabled=false, onlyOnSitesWithoutUserInteraction=false, completionHandler=0x00007ffeefbfecd8)>&&) at WebsiteDataStore.cpp:1828:30
    frame #5: 0x0000000107ee3233 WebKit`::WKWebsiteDataStoreStatisticsResetToConsistentState(dataStoreRef=0x000000012ef3e3a0, context=0x00007ffeefbfedb0, completionHandler=(WebKitTestRunner`WTR::resourceStatisticsVoidResultCallback(void*) at TestController.cpp:3344)) at WKWebsiteDataStoreRef.cpp:593:11
    frame #6: 0x00000001000377ef WebKitTestRunner`WTR::TestController::statisticsResetToConsistentState(this=0x00007ffeefbff3b8) at TestController.cpp:3698:5
    frame #7: 0x000000010003687b WebKitTestRunner`WTR::TestController::resetStateToConsistentValues(this=0x00007ffeefbff3b8, options=0x00007ffeefbfef90, resetStage=BeforeTest) at TestController.cpp:1118:5
    frame #8: 0x0000000100035e64 WebKitTestRunner`WTR::TestController::ensureViewSupportsOptionsForTest(this=0x00007ffeefbff3b8, test=0x00000001484ec000) at TestController.cpp:819:10
...


Basically all these:

    store.clearResourceLoadStatisticsInWebProcesses([callbackAggregator = callbackAggregator.copyRef()] { });
    store.resetCacheMaxAgeCapForPrevalentResources([callbackAggregator = callbackAggregator.copyRef()] { });
    store.resetCrossSiteLoadsWithLinkDecorationForTesting([callbackAggregator = callbackAggregator.copyRef()] { });
    store.setResourceLoadStatisticsShouldDowngradeReferrerForTesting(true, [callbackAggregator = callbackAggregator.copyRef()] { });
    store.setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(false, false, [callbackAggregator = callbackAggregator.copyRef()] { });
    store.setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(false, [callbackAggregator = callbackAggregator.copyRef()] { });
    store.resetParametersToDefaultValues([callbackAggregator = callbackAggregator.copyRef()] { });
    store.scheduleClearInMemoryAndPersistent(WebKit::ShouldGrandfatherStatistics::No, [callbackAggregator = callbackAggregator.copyRef()] { });
    store.setUseITPDatabase(false, [callbackAggregator = callbackAggregator.copyRef()] { });
Comment 2 Simon Fraser (smfr) 2020-03-03 15:54:26 PST
Network processes are being launched via:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 30.1
  * frame #0: 0x0000000107f46ee5 WebKit`WebKit::NetworkProcessProxy::NetworkProcessProxy(this=0x0000000136ed4280, processPool=0x000000013480bc08) at NetworkProcessProxy.cpp:93:5
    frame #1: 0x0000000107f4712d WebKit`WebKit::NetworkProcessProxy::NetworkProcessProxy(this=0x0000000136ed4280, processPool=0x000000013480bc08) at NetworkProcessProxy.cpp:92:1
    frame #2: 0x0000000107d0863d WebKit`std::__1::__unique_if<WebKit::NetworkProcessProxy>::__unique_single std::__1::make_unique<WebKit::NetworkProcessProxy, WebKit::WebProcessPool&>(__args=0x000000013480bc08) at memory:3131:32
    frame #3: 0x0000000107cc5f5f WebKit`decltype(args=0x000000013480bc08) WTF::makeUnique<WebKit::NetworkProcessProxy, WebKit::WebProcessPool&>(WebKit::WebProcessPool&) at StdLibExtras.h:483:12
    frame #4: 0x0000000107cc4c87 WebKit`WebKit::WebProcessPool::ensureNetworkProcess(this=0x000000013480bc08, withWebsiteDataStore=0x0000000137c07708) at WebProcessPool.cpp:494:27
    frame #5: 0x00000001080dace2 WebKit`WebKit::WebsiteDataStore::removeData(this=0x0000000137c07708, dataTypes={ size = 1 }, modifiedSince=(m_value = -Inf), completionHandler=0x00007ffeefbfed50)>&&) at WebsiteDataStore.cpp:715:30
    frame #6: 0x0000000107ee3a8f WebKit`::WKWebsiteDataStoreRemoveAllIndexedDatabases(dataStoreRef=0x0000000137c07700, context=0x00007ffeefbfedb8, callback=(WebKitTestRunner`WTR::StorageVoidCallback(void*) at TestController.cpp:3208)) at WKWebsiteDataStoreRef.cpp:627:35
    frame #7: 0x0000000100036d7f WebKitTestRunner`WTR::TestController::clearIndexedDatabases(this=0x00007ffeefbff3b8) at TestController.cpp:3217:5
    frame #8: 0x00000001000363ec WebKitTestRunner`WTR::TestController::resetStateToConsistentValues(this=0x00007ffeefbff3b8, options=0x00007ffeefbfef90, resetStage=BeforeTest) at TestController.cpp:1017:5
    frame #9: 0x0000000100035e64 WebKitTestRunner`WTR::TestController::ensureViewSupportsOptionsForTest(this=0x00007ffeefbff3b8, test=0x0000000136eec000) at
...


and 

  * frame #0: 0x0000000107f46ee5 WebKit`WebKit::NetworkProcessProxy::NetworkProcessProxy(this=0x0000000136ece780, processPool=0x000000013480bc08) at NetworkProcessProxy.cpp:93:5
    frame #1: 0x0000000107f4712d WebKit`WebKit::NetworkProcessProxy::NetworkProcessProxy(this=0x0000000136ece780, processPool=0x000000013480bc08) at NetworkProcessProxy.cpp:92:1
    frame #2: 0x0000000107d0863d WebKit`std::__1::__unique_if<WebKit::NetworkProcessProxy>::__unique_single std::__1::make_unique<WebKit::NetworkProcessProxy, WebKit::WebProcessPool&>(__args=0x000000013480bc08) at memory:3131:32
    frame #3: 0x0000000107cc5f5f WebKit`decltype(args=0x000000013480bc08) WTF::makeUnique<WebKit::NetworkProcessProxy, WebKit::WebProcessPool&>(WebKit::WebProcessPool&) at StdLibExtras.h:483:12
    frame #4: 0x0000000107cc4c87 WebKit`WebKit::WebProcessPool::ensureNetworkProcess(this=0x000000013480bc08, withWebsiteDataStore=0x0000000137c07708) at WebProcessPool.cpp:494:27
    frame #5: 0x00000001080dace2 WebKit`WebKit::WebsiteDataStore::removeData(this=0x0000000137c07708, dataTypes={ size = 1 }, modifiedSince=(m_value = -Inf), completionHandler=0x00007ffeefbfed40)>&&) at WebsiteDataStore.cpp:715:30
    frame #6: 0x0000000107ee3b4f WebKit`::WKWebsiteDataStoreRemoveLocalStorage(dataStoreRef=0x0000000137c07700, context=0x00007ffeefbfedb8, callback=(WebKitTestRunner`WTR::StorageVoidCallback(void*) at TestController.cpp:3208)) at WKWebsiteDataStoreRef.cpp:636:35
    frame #7: 0x0000000100036def WebKitTestRunner`WTR::TestController::clearLocalStorage(this=0x00007ffeefbff3b8) at TestController.cpp:3224:5
    frame #8: 0x00000001000363f8 WebKitTestRunner`WTR::TestController::resetStateToConsistentValues(this=0x00007ffeefbff3b8, options=0x00007ffeefbfef90, resetStage=BeforeTest) at TestController.cpp:1018:5
    frame #9: 0x0000000100035e64 WebKitTestRunner`WTR::TestController::ensureViewSupportsOptionsForTest(this=0x00007ffeefbff3b8, test=0x0000000136eec000) at TestController.cpp:819:10
...
Comment 3 Radar WebKit Bug Importer 2020-03-03 16:25:33 PST
<rdar://problem/60018602>
Comment 4 Jonathan Bedard 2020-03-04 07:46:21 PST
Do we have a regression point for this? I know we've had issues with this sort of thing in the past, but we fixed them. Given how bad this is, it strikes me a relatively recent regression.
Comment 5 Chris Dumez 2020-03-05 08:17:49 PST
I have landed 3 patches (dependency bugs) that should help a lot. Let's gather fresh numbers to see where we stand now and determine if more work is needed.
Comment 6 Chris Dumez 2020-03-05 08:46:08 PST
(In reply to Chris Dumez from comment #5)
> I have landed 3 patches (dependency bugs) that should help a lot. Let's
> gather fresh numbers to see where we stand now and determine if more work is
> needed.

Latest numbers: 5 process pools created and 5 network process proxies. It is better but not ideal.
Comment 7 Chris Dumez 2020-03-05 08:52:36 PST
(In reply to Chris Dumez from comment #6)
> (In reply to Chris Dumez from comment #5)
> > I have landed 3 patches (dependency bugs) that should help a lot. Let's
> > gather fresh numbers to see where we stand now and determine if more work is
> > needed.
> 
> Latest numbers: 5 process pools created and 5 network process proxies. It is
> better but not ideal.

Remaining construction sites:
1   0x11176380b WebKit::NetworkProcessProxy::NetworkProcessProxy(WebKit::WebProcessPool&)
2   0x1116cac89 WebKit::WebProcessPool::ensureNetworkProcess(WebKit::WebsiteDataStore*)
3   0x1117ba6b1 WebKit::WebsiteDataStore::removeData(WTF::OptionSet<WebKit::WebsiteDataType>, WTF::WallTime, WTF::Function<void ()>&&)
4   0x111752a01 WKWebsiteDataStoreRemoveAllIndexedDatabases
5   0x10f448d76 WTR::TestController::clearIndexedDatabases()
6   0x10f448964 WTR::TestController::resetStateToConsistentValues(WTR::TestOptions const&, WTR::TestController::ResetStage)
7   0x10f448683 WTR::TestController::ensureViewSupportsOptionsForTest(WTR::TestInvocation const&)
8   0x10f44c374 WTR::TestController::configureViewForTest(WTR::TestInvocation const&)
9   0x10f45d543 WTR::TestInvocation::invoke()
10  0x10f44cce7 WTR::TestController::runTest(char const*)
11  0x10f44d0bc WTR::TestController::runTestingServerLoop()
12  0x10f4454a9 WTR::TestController::TestController(int, char const**)
13  0x10f432d7d main
14  0x7fff71c9ec61 start

1   0x11176380b WebKit::NetworkProcessProxy::NetworkProcessProxy(WebKit::WebProcessPool&)
2   0x1116cac89 WebKit::WebProcessPool::ensureNetworkProcess(WebKit::WebsiteDataStore*)
3   0x1117ba6b1 WebKit::WebsiteDataStore::removeData(WTF::OptionSet<WebKit::WebsiteDataType>, WTF::WallTime, WTF::Function<void ()>&&)
4   0x111752a72 WKWebsiteDataStoreRemoveLocalStorage
5   0x10f448dcd WTR::TestController::clearLocalStorage()
6   0x10f44896c WTR::TestController::resetStateToConsistentValues(WTR::TestOptions const&, WTR::TestController::ResetStage)
7   0x10f448683 WTR::TestController::ensureViewSupportsOptionsForTest(WTR::TestInvocation const&)
8   0x10f44c374 WTR::TestController::configureViewForTest(WTR::TestInvocation const&)
9   0x10f45d543 WTR::TestInvocation::invoke()
10  0x10f44cce7 WTR::TestController::runTest(char const*)
11  0x10f44d0bc WTR::TestController::runTestingServerLoop()
12  0x10f4454a9 WTR::TestController::TestController(int, char const**)
13  0x10f432d7d main
14  0x7fff71c9ec61 start

1   0x11176380b WebKit::NetworkProcessProxy::NetworkProcessProxy(WebKit::WebProcessPool&)
2   0x1116cac89 WebKit::WebProcessPool::ensureNetworkProcess(WebKit::WebsiteDataStore*)
3   0x1117ba6b1 WebKit::WebsiteDataStore::removeData(WTF::OptionSet<WebKit::WebsiteDataType>, WTF::WallTime, WTF::Function<void ()>&&)
4   0x111752ae3 WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations
5   0x10f448e54 WTR::TestController::clearServiceWorkerRegistrations()
6   0x10f448974 WTR::TestController::resetStateToConsistentValues(WTR::TestOptions const&, WTR::TestController::ResetStage)
7   0x10f448683 WTR::TestController::ensureViewSupportsOptionsForTest(WTR::TestInvocation const&)
8   0x10f44c374 WTR::TestController::configureViewForTest(WTR::TestInvocation const&)
9   0x10f45d543 WTR::TestInvocation::invoke()
10  0x10f44cce7 WTR::TestController::runTest(char const*)
11  0x10f44d0bc WTR::TestController::runTestingServerLoop()
12  0x10f4454a9 WTR::TestController::TestController(int, char const**)
13  0x10f432d7d main
14  0x7fff71c9ec61 start

1   0x11176380b WebKit::NetworkProcessProxy::NetworkProcessProxy(WebKit::WebProcessPool&)
2   0x1116cac89 WebKit::WebProcessPool::ensureNetworkProcess(WebKit::WebsiteDataStore*)
3   0x1117ba6b1 WebKit::WebsiteDataStore::removeData(WTF::OptionSet<WebKit::WebsiteDataType>, WTF::WallTime, WTF::Function<void ()>&&)
4   0x111752752 WKWebsiteDataStoreRemoveAllFetchCaches
5   0x10f448ea2 WTR::TestController::clearDOMCaches()
6   0x10f44897c WTR::TestController::resetStateToConsistentValues(WTR::TestOptions const&, WTR::TestController::ResetStage)
7   0x10f448683 WTR::TestController::ensureViewSupportsOptionsForTest(WTR::TestInvocation const&)
8   0x10f44c374 WTR::TestController::configureViewForTest(WTR::TestInvocation const&)
9   0x10f45d543 WTR::TestInvocation::invoke()
10  0x10f44cce7 WTR::TestController::runTest(char const*)
11  0x10f44d0bc WTR::TestController::runTestingServerLoop()
12  0x10f4454a9 WTR::TestController::TestController(int, char const**)
13  0x10f432d7d main
14  0x7fff71c9ec61 start

1   0x11176380b WebKit::NetworkProcessProxy::NetworkProcessProxy(WebKit::WebProcessPool&)
2   0x1116cac89 WebKit::WebProcessPool::ensureNetworkProcess(WebKit::WebsiteDataStore*)
3   0x1116cc6a6 WebKit::WebProcessPool::initializeNewWebProcess(WebKit::WebProcessProxy&, WebKit::WebsiteDataStore*, WebKit::WebProcessProxy::IsPrewarmed)
4   0x1116cd38e WebKit::WebProcessPool::createNewWebProcess(WebKit::WebsiteDataStore*, WebKit::WebProcessProxy::IsPrewarmed)
5   0x11169b3b7 WebKit::WebProcessPool::processForRegistrableDomain(WebKit::WebsiteDataStore&, WebKit::WebPageProxy*, WebCore::RegistrableDomain const&)
6   0x11169ae3d WebKit::WebPageProxy::launchProcess(WebCore::RegistrableDomain const&, WebKit::WebPageProxy::ProcessLaunchReason)
7   0x11169ef07 WebKit::WebPageProxy::loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object*)
8   0x11171e196 WKPageLoadURL
9   0x10f448c87 WTR::TestController::resetStateToConsistentValues(WTR::TestOptions const&, WTR::TestController::ResetStage)
10  0x10f448683 WTR::TestController::ensureViewSupportsOptionsForTest(WTR::TestInvocation const&)
11  0x10f44c374 WTR::TestController::configureViewForTest(WTR::TestInvocation const&)
12  0x10f45d543 WTR::TestInvocation::invoke()
13  0x10f44cce7 WTR::TestController::runTest(char const*)
14  0x10f44d0bc WTR::TestController::runTestingServerLoop()
15  0x10f4454a9 WTR::TestController::TestController(int, char const**)
16  0x10f432d7d main

----

They all seem legit. They need a running network process in order to go remove things on disk (and the last one is for actually running the test). We could optimize this by either:
1. Have the WebProcessPool keep around its temporary process pool for a while (e.g. one event loop iteration) so that it would get reused.
or
2. Reset the WebsiteDataStore state *after* we've constructed the WKWebView

2) Would likely be ideal in terms of how many pools / network processes would get created.
Comment 8 Chris Dumez 2020-03-05 09:38:11 PST
Ok, I think this is a regression from delayed process launch. By the time we call all those methods on the WebsiteDataStore, we actually have already created a WebPageProxy / WebProcessPool but it is not associated with the WebsiteDataStore yet. I am looking into fixing this.
Comment 9 Chris Dumez 2020-03-05 10:38:11 PST
Created attachment 392596 [details]
Patch
Comment 10 Chris Dumez 2020-03-05 10:40:31 PST
(In reply to Chris Dumez from comment #9)
> Created attachment 392596 [details]
> Patch

With this patch, 1 process pool / 1 network process.
Comment 11 youenn fablet 2020-03-05 13:19:47 PST
Comment on attachment 392596 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=392596&action=review

> Source/WebKit/UIProcess/WebProcessPool.cpp:1162
> +        m_dummyProcessProxies.remove(process->sessionID());

We are doing a double search here.

> Source/WebKit/UIProcess/WebProcessPool.h:628
> +    HashMap<PAL::SessionID, WebProcessProxy*> m_dummyProcessProxies; // Lightweight WebProcessProxy objects without backing process.

Could use WeakPtr.
Comment 12 Chris Dumez 2020-03-05 13:50:12 PST
Created attachment 392620 [details]
Patch
Comment 13 Chris Dumez 2020-03-05 15:55:36 PST
Comment on attachment 392620 [details]
Patch

Clearing flags on attachment: 392620

Committed r257953: <https://trac.webkit.org/changeset/257953>
Comment 14 Chris Dumez 2020-03-05 15:55:38 PST
All reviewed patches have been landed.  Closing bug.