Bug 210313 - Use NetworkSessionCocoa::isolatedSession for all loads
Summary: Use NetworkSessionCocoa::isolatedSession for all loads
Status: RESOLVED DUPLICATE of bug 230750
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-09 18:52 PDT by Alex Christensen
Modified: 2021-09-28 16:45 PDT (History)
3 users (show)

See Also:


Attachments
Patch (20.35 KB, patch)
2020-04-09 18:55 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (20.47 KB, patch)
2020-04-17 13:49 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (49.66 KB, patch)
2020-04-21 17:37 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (40.05 KB, patch)
2020-04-22 12:30 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2020-04-09 18:52:22 PDT
Use NetworkSessionCocoa::isolatedSession for all loads
Comment 1 Alex Christensen 2020-04-09 18:55:28 PDT
Created attachment 396031 [details]
Patch
Comment 2 Alex Christensen 2020-04-09 18:55:30 PDT
<rdar://problem/59854450>
Comment 3 Alex Christensen 2020-04-17 13:49:27 PDT
Created attachment 396791 [details]
Patch
Comment 4 John Wilander 2020-04-17 15:08:27 PDT
Comment on attachment 396791 [details]
Patch

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

> Source/WebKit/NetworkProcess/NetworkProcess.cpp:2663
> +    completionHandler(true);

Is this something we can get rid of all together?

> Source/WebKit/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:79
> +    // ALSO: We should double check that removing an isolated session in NetworkSessionCocoa::isolatedSession with an active download doesn't stop that download.

Could isolatedSessions be told that they're being used for a download? If so, we need to think about abuse cases:
1. A website deliberately starts an infinite download only to keep its isolated session.
2. A website makes a set of redirects to start infinite downloads for isolated sessions in order to consume resources, potentially exhausting the available isolated sessions.

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1198
> +    auto firstParty = WebCore::RegistrableDomain(request.firstPartyForCookies());

We really should make request.firstPartyForCookies() return a RegistrableDomain. I believe that's the only way it's used. If not, we should have a lazy function to get the RegistrableDomain. This conversion is done too often.

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1204
> +    return isolatedSession(WebCore::StoredCredentialsPolicy::Use, WebCore::RegistrableDomain(url), NavigatingToAppBoundDomain::No);

Could this be the place to pass on info about being used for a download? I assume we need to consider scenarios where more than one download is ongoing and all of them must be completed before we discard the isolated session.
Comment 5 Alex Christensen 2020-04-20 16:05:39 PDT
(In reply to John Wilander from comment #4)
> Comment on attachment 396791 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=396791&action=review
> 
> > Source/WebKit/NetworkProcess/NetworkProcess.cpp:2663
> > +    completionHandler(true);
> 
> Is this something we can get rid of all together?
Yes.  I was just seeing what tests I need to work on with this last patch.

> > Source/WebKit/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:79
> > +    // ALSO: We should double check that removing an isolated session in NetworkSessionCocoa::isolatedSession with an active download doesn't stop that download.
> 
> Could isolatedSessions be told that they're being used for a download? If
> so, we need to think about abuse cases:
> 1. A website deliberately starts an infinite download only to keep its
> isolated session.
> 2. A website makes a set of redirects to start infinite downloads for
> isolated sessions in order to consume resources, potentially exhausting the
> available isolated sessions.
A download would only keep the NSURLSession alive, not the isolatedSession.  I don't think this is an issue.
Comment 6 Geoffrey Garen 2020-04-21 14:37:50 PDT
Are the EWS failures real?
Comment 7 Alex Christensen 2020-04-21 14:38:16 PDT
yes, I'm working on fixing them and finishing this right now.
Comment 8 Geoffrey Garen 2020-04-21 14:39:15 PDT
Also: Can you submit a PLT A/B test with this change?
Comment 9 Alex Christensen 2020-04-21 14:39:49 PDT
Yes, it will definitely need such perf analysis.
Comment 10 Alex Christensen 2020-04-21 17:37:28 PDT
Created attachment 397148 [details]
Patch
Comment 11 Alex Christensen 2020-04-21 17:37:49 PDT
Comment on attachment 397148 [details]
Patch

closer but still not there.
Comment 12 Alex Christensen 2020-04-22 12:30:36 PDT
Created attachment 397235 [details]
Patch
Comment 13 Alex Christensen 2021-09-28 16:45:29 PDT

*** This bug has been marked as a duplicate of bug 230750 ***