RESOLVED FIXED 216041
Move NetworkProcessProxy ownership from WebProcessPool to WebsiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=216041
Summary Move NetworkProcessProxy ownership from WebProcessPool to WebsiteDataStore
Alex Christensen
Reported 2020-09-01 10:03:38 PDT
Move NetworkProcessProxy ownership from WebProcessPool to WebsiteDataStore
Attachments
Patch (275.88 KB, patch)
2020-09-01 10:04 PDT, Alex Christensen
no flags
Patch (307.57 KB, patch)
2020-09-14 12:15 PDT, Alex Christensen
no flags
Patch (302.16 KB, patch)
2020-09-15 13:23 PDT, Alex Christensen
no flags
Patch (306.82 KB, patch)
2020-09-19 14:21 PDT, Alex Christensen
no flags
Patch (308.09 KB, patch)
2020-09-19 16:34 PDT, Alex Christensen
no flags
Patch (314.94 KB, patch)
2020-09-21 12:36 PDT, Alex Christensen
no flags
Patch (317.50 KB, patch)
2020-09-21 14:59 PDT, Alex Christensen
ews-feeder: commit-queue-
Patch (317.50 KB, patch)
2020-09-21 15:13 PDT, Alex Christensen
no flags
Patch (320.22 KB, patch)
2020-09-21 18:53 PDT, Alex Christensen
no flags
Patch (320.47 KB, patch)
2020-09-21 18:54 PDT, Alex Christensen
ews-feeder: commit-queue-
Patch (322.17 KB, patch)
2020-09-21 19:51 PDT, Alex Christensen
no flags
Patch (331.97 KB, patch)
2020-09-21 23:42 PDT, Alex Christensen
ews-feeder: commit-queue-
Patch (332.22 KB, patch)
2020-09-21 23:56 PDT, Alex Christensen
no flags
Patch (336.14 KB, patch)
2020-09-22 09:21 PDT, Alex Christensen
no flags
Patch (343.93 KB, patch)
2020-09-22 10:44 PDT, Alex Christensen
no flags
Patch (344.32 KB, patch)
2020-09-22 23:01 PDT, Alex Christensen
no flags
Patch (334.52 KB, patch)
2020-09-23 00:19 PDT, Alex Christensen
no flags
Patch (349.54 KB, patch)
2020-09-23 10:58 PDT, Alex Christensen
no flags
Rebased patch (355.27 KB, patch)
2020-09-24 06:51 PDT, Carlos Garcia Campos
no flags
GLib API changes (13.50 KB, patch)
2020-09-24 06:52 PDT, Carlos Garcia Campos
no flags
Patch (344.62 KB, patch)
2020-09-24 10:53 PDT, Alex Christensen
ews-feeder: commit-queue-
Patch (344.66 KB, patch)
2020-09-24 11:00 PDT, Alex Christensen
ews-feeder: commit-queue-
Patch (344.88 KB, patch)
2020-09-24 11:11 PDT, Alex Christensen
ews-feeder: commit-queue-
Patch (344.88 KB, patch)
2020-09-24 11:17 PDT, Alex Christensen
no flags
Patch (344.80 KB, patch)
2020-09-24 11:38 PDT, Alex Christensen
no flags
Patch (358.11 KB, patch)
2020-09-24 16:06 PDT, Alex Christensen
beidson: review+
Rebased patch (355.55 KB, patch)
2020-09-29 03:47 PDT, Carlos Garcia Campos
no flags
Patch (359.34 KB, patch)
2020-09-29 11:02 PDT, Alex Christensen
ews-feeder: commit-queue-
Patch (359.85 KB, patch)
2020-09-29 11:17 PDT, Alex Christensen
no flags
Alex Christensen
Comment 1 2020-09-01 10:04:54 PDT
EWS Watchlist
Comment 2 2020-09-01 10:05:45 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Alex Christensen
Comment 3 2020-09-01 10:07:28 PDT
I'm separating this approach's attempts so the EWS bubbles load faster and to keep the two approaches separate from each other so I can see my progress. This first patch is just to see the EWS results. It is not done yet.
Radar WebKit Bug Importer
Comment 5 2020-09-08 10:04:12 PDT
Alex Christensen
Comment 6 2020-09-14 12:15:43 PDT
EWS Watchlist
Comment 7 2020-09-14 12:16:31 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Alex Christensen
Comment 8 2020-09-14 12:16:43 PDT
Not done yet. Uploading WIP to get a checkpoint on which tests still need work.
Alex Christensen
Comment 9 2020-09-15 13:23:25 PDT
Alex Christensen
Comment 10 2020-09-19 14:21:33 PDT
Alex Christensen
Comment 11 2020-09-19 16:34:05 PDT
Alex Christensen
Comment 12 2020-09-21 12:36:33 PDT
Alex Christensen
Comment 13 2020-09-21 14:59:59 PDT
Alex Christensen
Comment 14 2020-09-21 15:13:04 PDT
Alex Christensen
Comment 15 2020-09-21 18:53:21 PDT
Alex Christensen
Comment 16 2020-09-21 18:54:36 PDT
Alex Christensen
Comment 17 2020-09-21 19:51:40 PDT
Alex Christensen
Comment 18 2020-09-21 23:42:41 PDT
Alex Christensen
Comment 19 2020-09-21 23:56:20 PDT
Carlos Garcia Campos
Comment 20 2020-09-22 00:37:08 PDT
Comment on attachment 409350 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409350&action=review > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:195 > + if (m_sessionID.isEphemeral() || m_sessionID == PAL::SessionID::defaultSessionID()) > + m_networkProcess = NetworkProcessProxy::defaultNetworkProcess(); This is actually making the network process a singleton for the default session and the reason why tests are failing in GTK. I'll investigate more to see why they fail when reusing the same process.
Carlos Garcia Campos
Comment 21 2020-09-22 01:01:20 PDT
Comment on attachment 409350 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409350&action=review >> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:195 >> + m_networkProcess = NetworkProcessProxy::defaultNetworkProcess(); > > This is actually making the network process a singleton for the default session and the reason why tests are failing in GTK. I'll investigate more to see why they fail when reusing the same process. Every test case uses a new web context (process pool) to ensure a clean env. What happens now is that the first test case creates a website data store for the default session id, when the next test starts a new websitedata store is created for the default session id again, and the previous one is destroyed, since destroy happens after the create, we end up removing the newly created one, since we use the session id. I don't think we can share the network process for GLib API, it's ok to move the ownership to the data manager, but the process should be created and destroyed with the data store. I think we could share a process for ephemeral sessions, though.
Alex Christensen
Comment 22 2020-09-22 09:21:48 PDT
Alex Christensen
Comment 23 2020-09-22 10:44:57 PDT
Chris Dumez
Comment 24 2020-09-22 11:00:21 PDT
Comment on attachment 409378 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409378&action=review > Source/WebKit/ChangeLog:3 > + Move NetworkProcessProxy ownership from WebProcessPool to WebsiteDataStore Could the changelog explain why we're doing this? Why this is better than the current state? It is non-obvious to me at least.
Alex Christensen
Comment 25 2020-09-22 23:01:02 PDT
Alex Christensen
Comment 26 2020-09-23 00:19:46 PDT
Alex Christensen
Comment 27 2020-09-23 10:58:38 PDT
Alex Christensen
Comment 28 2020-09-23 14:41:47 PDT
*** Bug 203547 has been marked as a duplicate of this bug. ***
Carlos Garcia Campos
Comment 29 2020-09-24 06:23:08 PDT
Comment on attachment 409484 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409484&action=review > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:183 > - if (m_sessionID != PAL::SessionID::defaultSessionID()) { > - auto result = nonDefaultDataStores().add(m_sessionID, this); > - ASSERT_UNUSED(result, result.isNewEntry); > + auto result = allDataStores().add(m_sessionID, this); > + ASSERT_UNUSED(result, result.isNewEntry); This is a problem for GLib API too. In our API persistent data stores are always created with the default session ID, and are expected to be asociated with a web context (a process pool). So, you could have two default data stores each associated to a different context. Both are the default one, but the default for its network process. With this patch, creating a second data store will assert in debug. Note that we don't expose session IDs in our API on purpose. A possible solution would be to remove the concept of default session, and simply use a different session ID for each data store. After this patch the default session is not used that much, for soup we would just need to figure out how to implement the DNS resolver.
Carlos Garcia Campos
Comment 30 2020-09-24 06:51:27 PDT
Created attachment 409568 [details] Rebased patch This is the patch rebased on top of current trunk and patch attached to bug #216927.
Carlos Garcia Campos
Comment 31 2020-09-24 06:52:37 PDT
Created attachment 409569 [details] GLib API changes This patch contains the changes I added on top of the rebased patch just to make it easier to see them
Carlos Garcia Campos
Comment 32 2020-09-24 06:54:19 PDT
Comment on attachment 409569 [details] GLib API changes View in context: https://bugs.webkit.org/attachment.cgi?id=409569&action=review > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:163 > +#if PLATFORM(GTK) || PLATFORM(WPE) > + RELEASE_ASSERT_NOT_REACHED(); > +#endif I added this to catch code using the default data store with the GLib API. I think the inspector uses it and probably some other places, so a few tests might still fail. I'll check those.
Carlos Garcia Campos
Comment 33 2020-09-24 06:56:54 PDT
Ah, there's also the initial accept cookie policy, but I think we no longer need that, I'll check that too, but I think bug #216927 is the only one blocking this from the GLib API now.
Alex Christensen
Comment 34 2020-09-24 09:14:54 PDT
Wonderful! Thanks, Carlos!
Alex Christensen
Comment 35 2020-09-24 10:53:59 PDT
Alex Christensen
Comment 36 2020-09-24 11:00:37 PDT
Alex Christensen
Comment 37 2020-09-24 11:11:59 PDT
Alex Christensen
Comment 38 2020-09-24 11:17:44 PDT
Alex Christensen
Comment 39 2020-09-24 11:38:55 PDT
Alex Christensen
Comment 40 2020-09-24 16:06:30 PDT
Brady Eidson
Comment 41 2020-09-25 09:42:17 PDT
Comment on attachment 409631 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409631&action=review Too big to critically analyze every single change. Overall, seems fine. Yay tests. One specific review comment. > Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h:82 > - bool shouldEnableITPDatabase { false }; > + bool shouldEnableITPDatabase { true }; Why this change?
Alex Christensen
Comment 42 2020-09-25 12:32:55 PDT
Comment on attachment 409631 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409631&action=review >> Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h:82 >> + bool shouldEnableITPDatabase { true }; > > Why this change? This changed under me during my many rebases. I don't think this did any change because it is always set from elsewhere, but I'll not make this change. I'll also double check everything before landing to find any more there may be.
Alex Christensen
Comment 43 2020-09-25 16:54:01 PDT
Alex Christensen
Comment 44 2020-09-25 23:36:13 PDT
This caused some API tests to fail on the bots. Why they're so different than EWS, I may never know. { "Failed": [ { "output": "\n/Volumes/Data/slave/catalina-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:1543\nValue of: isRegistered\n Actual: false\nExpected: true\n\n", "name": "TestWebKitAPI.ResourceLoadStatistics.MigrateDataFromMissingTopFrameUniqueRedirectSameSiteStrictTableSchema" }, { "output": "\n/Volumes/Data/slave/catalina-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:1582\nExpected equality of these values:\n static_cast<int>([thirdPartyData count])\n Which is: 0\n 1\n\n\n/Volumes/Data/slave/catalina-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:1586\nExpected equality of these values:\n thirdParty.thirdPartyDomain\n Which is: \"\"\n @\"webkit.org\"\n Which is: \"webkit.org\"\n\n\n/Volumes/Data/slave/catalina-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:1591\nExpected equality of these values:\n firstParty.firstPartyDomain\n Which is: \"\"\n @\"apple.com\"\n Which is: \"apple.com\"\n\n", "name": "TestWebKitAPI.ResourceLoadStatistics.CanAccessDataSummaryWithNoProcessPool" }, { "output": "\n/Volumes/Data/slave/catalina-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:1453\nValue of: isRegistered\n Actual: false\nExpected: true\n\n", "name": "TestWebKitAPI.ResourceLoadStatistics.MigrateDataFromIncorrectCreateTableSchema" } ], "Timedout": [ { "output": "", "name": "TestWebKitAPI.ResourceLoadStatistics.ShouldNotGrandfatherOnStartup" }, { "output": "", "name": "TestWebKitAPI.ResourceLoadStatistics.GrandfatherCallback" }, { "output": "", "name": "TestWebKitAPI.ResourceLoadStatistics.ChildProcessesNotLaunched" }, { "output": "", "name": "TestWebKitAPI.ResourceLoadStatistics.GrandfatherCallbackDatabase" }, { "output": "", "name": "TestWebKitAPI.Fullscreen.WKViewDelegate" } ], "Skipped": [], "Crashed": [] }
Alex Christensen
Comment 45 2020-09-25 23:39:44 PDT
Reverted r267608 for reason: Caused API test failures Committed r267618: <https://trac.webkit.org/changeset/267618>
Carlos Garcia Campos
Comment 46 2020-09-26 00:26:13 PDT
Please, give me some time to check the layout test failures too before landing this again. See bug #217006
Carlos Garcia Campos
Comment 47 2020-09-28 00:56:16 PDT
Comment on attachment 409631 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409631&action=review > Tools/WebKitTestRunner/TestController.cpp:-3173 > - WKContextSetPrimaryWebsiteDataStore(context, defaultWebsiteDataStore()); This is the problem of layout tests for GTK and WPE. The WTR default data store is not set as web view data store either now, so when the web page is created the default data store s created and used for the page. I'll submit a rebased patch with the fix.
Carlos Garcia Campos
Comment 48 2020-09-29 03:47:36 PDT
Created attachment 409981 [details] Rebased patch Patch rebased and updated to fix GTK and WPE layout tests
Alex Christensen
Comment 49 2020-09-29 11:02:24 PDT
Alex Christensen
Comment 50 2020-09-29 11:17:25 PDT
Alex Christensen
Comment 51 2020-09-29 14:44:05 PDT
Alex Christensen
Comment 52 2020-10-05 16:46:44 PDT
Alex Christensen
Comment 53 2021-01-15 13:51:34 PST
Comment on attachment 410023 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=410023&action=review > Source/WebKit/NetworkProcess/NetworkProcess.cpp:-350 > - addIndexedDatabaseSession(sessionID, parameters.defaultDataStoreParameters.indexedDatabaseDirectory, parameters.defaultDataStoreParameters.indexedDatabaseDirectoryExtensionHandle); This is still needed. See https://bugs.webkit.org/show_bug.cgi?id=220666
Note You need to log in before you can comment on or make changes to this bug.