Bug 110115

Summary: [WK2][Soup] Add platform specific stubs for NetworkProcess
Product: WebKit Reporter: Balazs Kelemen <kbalazs>
Component: WebKit2Assignee: Balazs Kelemen <kbalazs>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, ap, beidson, benjamin, buildbot, cdumez, cgarcia, commit-queue, danw, eflews.bot, gustavo, gyuyoung.kim, gyuyoung.kim, kenneth, laszlo.gombos, mrobinson, ossy, rakuco, rniwa, sergio, skyul, svillar, webkit.review.bot, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 108832, 118231, 118343    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
=patch for landing none

Balazs Kelemen
Reported 2013-02-18 06:56:25 PST
Mostly stubs.
Attachments
Patch (12.04 KB, patch)
2013-02-18 09:31 PST, Balazs Kelemen
no flags
Patch (15.08 KB, patch)
2013-06-30 20:06 PDT, Kwang Yul Seo
no flags
Patch (12.40 KB, patch)
2013-07-02 21:29 PDT, Kwang Yul Seo
no flags
Patch (11.95 KB, patch)
2013-07-03 08:26 PDT, Kwang Yul Seo
no flags
Patch (12.22 KB, patch)
2013-07-03 08:28 PDT, Kwang Yul Seo
no flags
Patch (14.06 KB, patch)
2013-07-06 22:34 PDT, Kwang Yul Seo
no flags
Patch (14.10 KB, patch)
2013-07-06 23:00 PDT, Kwang Yul Seo
no flags
Patch (10.44 KB, patch)
2013-07-25 16:45 PDT, Kwang Yul Seo
no flags
=patch for landing (15.13 KB, patch)
2013-10-10 06:48 PDT, Csaba Osztrogonác
no flags
Balazs Kelemen
Comment 1 2013-02-18 09:31:35 PST
Kwang Yul Seo
Comment 2 2013-06-30 20:06:53 PDT
Kwang Yul Seo
Comment 3 2013-06-30 20:10:05 PDT
(In reply to comment #2) I made three changes to the original patch: 1. Build fix for NetworkResourceLoadScheduler::platformInitializeMaximumHTTPConnectionCountPerHost as the return type is changed to void. 2. Add NetworkProcessGtk.cpp 3. Add stubs for two new platform methods: NetworkProcess::clearCacheForAllOrigins and NetworkProcess::platformTerminate.
Kwang Yul Seo
Comment 4 2013-07-02 21:29:46 PDT
Kwang Yul Seo
Comment 5 2013-07-02 21:30:37 PDT
(In reply to comment #4) Merged NetworkProcessGtk.cpp and NetworkProcessEfl.cpp into NetworkProcessSoup.cpp.
Sergio Villar Senin
Comment 6 2013-07-03 01:10:51 PDT
Comment on attachment 205966 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205966&action=review > Source/WebCore/ChangeLog:10 > + No new tests since it is not used yet and does not supposed to change behavior anyway. Nit: is not supposed > Source/WebCore/platform/network/NetworkStorageSession.h:61 > + bool isPrivateBrowsingSession() const { return m_isPrivate; } Why is this here? Looks like it does not have much to do with the patch, and it's something that should look the same in all platforms. > Source/WebCore/platform/network/NetworkStorageSession.h:77 > + bool m_isPrivate; Ditto. > Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp:38 > + , m_isPrivate(false) Ditto. > Source/WebKit2/NetworkProcess/soup/NetworkResourceLoadSchedulerSoup.cpp:36 > + m_maxRequestsInFlightPerHost = unlimitedConnectionCount; Why such a huge value? We're currently using 6. Increasing this number won't improve performance as many hosts will refuse to establish new connections.
Kwang Yul Seo
Comment 7 2013-07-03 01:45:16 PDT
(In reply to comment #6) > Why such a huge value? We're currently using 6. Increasing this number won't improve performance as many hosts will refuse to establish new connections. There is a comment in ResourceRequestSoup.cpp: unsigned initializeMaximumHTTPConnectionCountPerHost() { // Soup has its own queue control; it wants to have all requests // given to it, so that it is able to look ahead, and schedule // them in a good way. return 10000; } I will add the same comment here. BTW, where did you get the number 6?
Kwang Yul Seo
Comment 8 2013-07-03 01:58:54 PDT
(In reply to comment #6) > > Source/WebCore/platform/network/NetworkStorageSession.h:61 > > + bool isPrivateBrowsingSession() const { return m_isPrivate; } > > Why is this here? Looks like it does not have much to do with the patch, and it's something that should look the same in all platforms. isPrivateBrowsingSession() is required when NetworkProcess is enabled in WebPlatformStrategies.cpp. String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url) { #if ENABLE(NETWORK_PROCESS) if (WebProcess::shared().usesNetworkProcess()) { String result; if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0)) return String(); return result; } #endif Currently, only Mac port provides this method. To build WebKit Gtk or Efl port with NetworkProcess enabled, we need to add a dummy implementation of isPrivateBrowsingSession(). Instead of duplicating isPrivateBrowsingSession() method and m_isPrivate member variable, I will move the method out of PLATFORM(MAC) guard and make the body return false for non-Mac ports. That will make it clear that it is a dummy method. Actually supporting private browsing in NetworkProcess will be done later.
Sergio Villar Senin
Comment 9 2013-07-03 05:03:25 PDT
(In reply to comment #7) > (In reply to comment #6) > > Why such a huge value? We're currently using 6. Increasing this number won't improve performance as many hosts will refuse to establish new connections. > > There is a comment in ResourceRequestSoup.cpp: > > unsigned initializeMaximumHTTPConnectionCountPerHost() > { > // Soup has its own queue control; it wants to have all requests > // given to it, so that it is able to look ahead, and schedule > // them in a good way. > return 10000; > } > > I will add the same comment here. > > BTW, where did you get the number 6? Yeah you're right, I forgot that we set that kind of "unlimited" value for WebKit because we control that at libsoup level. Check ResourceHandleSoup which is the place where we create the SoupSession
Sergio Villar Senin
Comment 10 2013-07-03 05:05:22 PDT
(In reply to comment #8) > (In reply to comment #6) > > > Source/WebCore/platform/network/NetworkStorageSession.h:61 > > > + bool isPrivateBrowsingSession() const { return m_isPrivate; } > > > > Why is this here? Looks like it does not have much to do with the patch, and it's something that should look the same in all platforms. > > isPrivateBrowsingSession() is required when NetworkProcess is enabled in WebPlatformStrategies.cpp. > > String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url) > { > #if ENABLE(NETWORK_PROCESS) > if (WebProcess::shared().usesNetworkProcess()) { > String result; > if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0)) > return String(); > return result; > } > #endif Yeah I know, but as you can see that's common to all platforms so it makes no sense to add it only for soup. > Currently, only Mac port provides this method. To build WebKit Gtk or Efl port with NetworkProcess enabled, we need to add a dummy implementation of isPrivateBrowsingSession(). > > Instead of duplicating isPrivateBrowsingSession() method and m_isPrivate member variable, I will move the method out of PLATFORM(MAC) guard and make the body return false for non-Mac ports. That will make it clear that it is a dummy method. That's exactly what I was suggesting.
Kwang Yul Seo
Comment 11 2013-07-03 08:26:18 PDT
Kwang Yul Seo
Comment 12 2013-07-03 08:28:38 PDT
Brady Eidson
Comment 13 2013-07-04 18:10:44 PDT
Comment on attachment 206005 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=206005&action=review r- because of the WebCore change. > Source/WebCore/platform/network/NetworkStorageSession.h:-57 > + bool isPrivateBrowsingSession() const > + { > +#if PLATFORM(MAC) || USE(CFNETWORK) > + return m_isPrivate; > +#else > + return false; > +#endif > + } > + > #if PLATFORM(MAC) || USE(CFNETWORK) > // May be null, in which case a Foundation default should be used. > CFURLStorageSessionRef platformSession() { return m_platformSession.get(); } > RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const; > - bool isPrivateBrowsingSession() const { return m_isPrivate; } No. This is silly. Private browsing is a cross-platform concept that's been exposed to all of WebCore for years. It is going to be getting *more* important going forward, not less. It would be wise for every port to start handling it properly. And we can't change WebKit1-style clients (present or future) based on one platform's WK2-specific needs. If this behavior is truly required (for now?), make the storage session always have m_isPrivate == false in platform-specific code. > Source/WebKit2/NetworkProcess/soup/NetworkResourceLoadSchedulerSoup.cpp:41 > + // Soup has its own queue control; it wants to have all requests > + // given to it, so that it is able to look ahead, and schedule > + // them in a good way. > + // See also ResourceRequestSoup.cpp > + static const unsigned unlimitedConnectionCount = 10000; > + m_maxRequestsInFlightPerHost = unlimitedConnectionCount; I would recommend against this design decision. Even if the networking library handles per-host scheduling correctly (and I'm sure libsoup does), there's plenty of Web-platform specific knowledge that can help prioritization better than a networking library alone can do. There will be work in this area in the medium term that you won't get the benefit of if you go forward with the unlimited queue approach. Additionally, we've seen IPC race conditions related to synchronous XMLHTTPRequests where we've learned you can get into serious trouble endlessly servicing asynchronous requests while a WebProcess is waiting on a sync XHR.
Balazs Kelemen
Comment 14 2013-07-05 02:29:36 PDT
> > Source/WebKit2/NetworkProcess/soup/NetworkResourceLoadSchedulerSoup.cpp:41 > > + // Soup has its own queue control; it wants to have all requests > > + // given to it, so that it is able to look ahead, and schedule > > + // them in a good way. > > + // See also ResourceRequestSoup.cpp > > + static const unsigned unlimitedConnectionCount = 10000; > > + m_maxRequestsInFlightPerHost = unlimitedConnectionCount; > > I would recommend against this design decision. > > Even if the networking library handles per-host scheduling correctly (and I'm sure libsoup does), there's plenty of Web-platform specific knowledge that can help prioritization better than a networking library alone can do. > > There will be work in this area in the medium term that you won't get the benefit of if you go forward with the unlimited queue approach. > > Additionally, we've seen IPC race conditions related to synchronous XMLHTTPRequests where we've learned you can get into serious trouble endlessly servicing asynchronous requests while a WebProcess is waiting on a sync XHR. These are very valid points. I expect it is a complex problem to find the balance across libsoup and WebKit. Probably the best would be to manage this entirely in WebKit but I guess libsoup does not have an option to turn off it's scheduling heuristics. I think the unlimited queue approach can be ok for now (we also have this for WebKit1), just add a FIXME that it should be revisited.
Kwang Yul Seo
Comment 15 2013-07-05 21:37:36 PDT
(In reply to comment #13) > No. This is silly. > > Private browsing is a cross-platform concept that's been exposed to all of WebCore for years. It is going to be getting *more* important going forward, not less. It would be wise for every port to start handling it properly. > > And we can't change WebKit1-style clients (present or future) based on one platform's WK2-specific needs. > > If this behavior is truly required (for now?), make the storage session always have m_isPrivate == false in platform-specific code. I am wiling to support private browsing for libsoup. But because this patch simply adds platform specific stubs to support NetworkProcess, I will make the storage session always have m_isPrivate == false in platform-specific code for now. > I would recommend against this design decision. > > Even if the networking library handles per-host scheduling correctly (and I'm sure libsoup does), there's plenty of Web-platform specific knowledge that can help prioritization better than a networking library alone can do. > > There will be work in this area in the medium term that you won't get the benefit of if you go forward with the unlimited queue approach. > > Additionally, we've seen IPC race conditions related to synchronous XMLHTTPRequests where we've learned you can get into serious trouble endlessly servicing asynchronous requests while a WebProcess is waiting on a sync XHR. I agree. I will leave a FIXME comment as Balazs suggested and discuss this issue with libsoup maintainers.
Kwang Yul Seo
Comment 16 2013-07-06 22:34:15 PDT
EFL EWS Bot
Comment 17 2013-07-06 22:37:44 PDT
EFL EWS Bot
Comment 18 2013-07-06 22:38:38 PDT
Early Warning System Bot
Comment 19 2013-07-06 22:40:15 PDT
Early Warning System Bot
Comment 20 2013-07-06 22:41:05 PDT
Build Bot
Comment 21 2013-07-06 22:57:44 PDT
Kwang Yul Seo
Comment 22 2013-07-06 23:00:44 PDT
Kwang Yul Seo
Comment 23 2013-07-06 23:01:48 PDT
(In reply to comment #22) Build fix by reordering m_isPrivate.
Sergio Villar Senin
Comment 24 2013-07-08 01:04:44 PDT
Comment on attachment 206202 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=206202&action=review Looks much better now. > Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp:40 > + // FIXME: Support private browsing. Not sure we need this comment here, we already have the ASSERT_NOT_REACHED() y createPrivateBrowsingSession() which servers as a good reminder.
Kwang Yul Seo
Comment 25 2013-07-08 01:33:08 PDT
(In reply to comment #24) > Not sure we need this comment here, we already have the ASSERT_NOT_REACHED() y createPrivateBrowsingSession() which servers as a good reminder. Yeah, but ASSERT_NOT_REACHED() does not necessarily mean that we have a plan to implement this. So I think adding a FIXME comment here is okay.
Build Bot
Comment 26 2013-07-17 00:44:13 PDT
Kwang Yul Seo
Comment 27 2013-07-25 16:45:01 PDT
Kwang Yul Seo
Comment 28 2013-07-25 16:46:02 PDT
(In reply to comment #27) > Created an attachment (id=207494) [details] > Patch Updated the patch as soup now supports private browsing. (Bug 118657)
Csaba Osztrogonác
Comment 29 2013-09-26 08:16:07 PDT
(In reply to comment #28) > (In reply to comment #27) > > Created an attachment (id=207494) [details] [details] > > Patch > > Updated the patch as soup now supports private browsing. (Bug 118657) The patch is still up-to-date, could you review it please?
Carlos Garcia Campos
Comment 30 2013-10-01 01:04:20 PDT
Comment on attachment 207494 [details] Patch I guess you should also add the new files to the makefile.
Csaba Osztrogonác
Comment 31 2013-10-01 02:30:30 PDT
(In reply to comment #30) > (From update of attachment 207494 [details]) > I guess you should also add the new files to the makefile. Sure. The original plan was to add all needed file in one big patch in bug110139 and bug118231. But it's safe to add the new files in this patch, because they are NETWORK_PROCESS guarded. I'll add them.
Csaba Osztrogonác
Comment 32 2013-10-10 06:48:10 PDT
Created attachment 213880 [details] =patch for landing new files added to buildsystems, let's see the EWS check
WebKit Commit Bot
Comment 33 2013-10-10 14:45:47 PDT
Comment on attachment 213880 [details] =patch for landing Clearing flags on attachment: 213880 Committed r157254: <http://trac.webkit.org/changeset/157254>
WebKit Commit Bot
Comment 34 2013-10-10 14:45:53 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.