Open Bug 1728331 Opened 1 year ago Updated 8 months ago

[Experiment] [process-count-4] Same domain tabs are loaded in the same process when reloaded in bulk

Categories

(Core :: DOM: Content Processes, defect, P3)

Desktop
All
defect

Tracking

()

Fission Milestone Future
Tracking Status
firefox-esr78 --- disabled
firefox-esr91 --- disabled
firefox91 --- disabled
firefox92 --- wontfix
firefox93 --- fix-optional
firefox94 --- fix-optional

People

(Reporter: cmuresan, Assigned: nika)

References

Details

Attachments

(2 files)

[Affected versions]:

  • Firefox Nightly 93.0a1 - Build ID: 20210830162701

[Affected Platforms]:

  • Windows 10
  • macOS 10.15.7
  • Linux MX 4.19

[Prerequisites]:

  • Have the following prefs set on a new profile:
    • dom.ipc.processCount.webIsolated set to 4.
    • fission.autostart set to true.

[Steps to reproduce]:

  1. Open 10 webpages from the same domain (eg. facebook, google, wikipedia) each in a new tab.
  2. Open the about:processes page in a new tab.
  3. Restart the browser using the Multiprocess Browser Console (ctrl/cmd+shift+j followed by ctrl/cmd+alt/option+r).
  4. Right click the about:processes tab and choose the "Select all Tabs" option.
  5. Right click the same tab and select the "Reload Tabs" option.
  6. Wait for all tabs to load and observe the process list.

[Expected result]:

  • The tabs with the same domain are split into 4 processes.

[Actual result]:

  • The tabs with the same domain are all in the same process.

[Notes]:

  • The issue is also reproducible when selecting multiple tabs and reloading them simultaneously, but in this case they can end up in two processes.
  • The issue is also reproducible if the tabs are unloaded via Session Restore.
  • The issue is NOT reproducible if the tabs are loaded one at a time.
  • The issue is NOT reproducible if the tabs are opened at the same time from a Bookmark folder or from the Synced Tabs sidebar.
  • Attached a screen recording of the issue: link.
Severity: -- → S3

Took a second to look into this. I believe this is caused because we always choose not to create a new process for a remote type if an existing process doesn't have any tabs loaded in it. This is done here: https://searchfox.org/mozilla-central/rev/ad2ffab089e4e0c0fe99a1a046ab2b1c45546bdb/dom/base/ProcessSelector.jsm#49-53. With normal tab opening we would create the browser in each new process synchronously, due to the blocking process launch, but for navigation process switches with Fission, we create it async, and there's a short time period during the process switch where we have the new process launched, but it doesn't have any tabs technically loaded in it yet. During this time if we do another process switching navigation, we'll end up re-using the same process, as we don't see the process as having any tabs loaded in it.

If we want to avoid this behaviour, we'll need to track pending navigations into a content process in addition to existing tabs, and handle them here.

This bug will only affect users if we decide to increase the process count to greater than 1 process (bug 1727158), depending on the results of this experiment.

Blocks: 1727158
See Also: → 1728332

Tracking for Fission MVP.

Tentatively assigning to Nika because she knows the details of this bug.

Assignee: nobody → nika
Fission Milestone: ? → MVP
Priority: -- → P3
Whiteboard: fission-soft-blocker

We'd like to fix this bug, but it doesn't need to block Fission MVP.

Fission Milestone: MVP → Future
Whiteboard: fission-soft-blocker

The changes I currently have posted in bug 1731792 should also fix this issue.

(In reply to Nika Layzell [:nika] (ni? for response) from comment #5)

The changes I currently have posted in bug 1731792 should also fix this issue.

Hi Nika, in bug 1731792 there are still two patches ready to land, do we know if this bug here is already fixed?

In case this bug is still valid instead, were you still planning to look into this?

Flags: needinfo?(nika)

This patch replaces the previous process selection infrastructure with a
new setup implemented entirely in C++, which should more accurately
track the set of processes in use, and should encourage re-use of the
existing content process when navigating by not counting the current
tab.

This approach intentionally allows for process switching to another
process during navigation if there is uneven load between processes to
encourage balanced process use.

I think this may also fix some of the session restore issues with many
tabs using the same process, rather than being spread over 4, as we now
track a tab earlier in its lifecycle before the BrowserParent instance
is created.

This attribute is not used in Gecko, but exists for use by other
applications. Specifically, the APP_TYPE_EDITOR type is given permission
to load privileged images as tested by browser_docshell_type_editor.js.
Before these changes, that test passed because the docshell was loaded
in a different process, so the cache was empty when each load occurred,
but after my changes the process ends up being re-used, so the image
cache bypasses this check.

This changes the image cache key to also include the app type
information so that it will be compared before re-using the entry.

The patch in that bug which landed didn't fix this issue, only the other 2 patches which bounced due to a devtools failure actually fixed this bug.

It appears that the devtools team did some work fixing an intermittent issue around this in bug 1733272, so it may be worth rebasing those patches and seeing if they're landable now.

Flags: needinfo?(nika)

I've moved the patches over to this bug, so that they're not on a closed bug anymore.

Pushed by nlayzell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e9242af1224d
Part 1: Avoid cycling between processes when navigating within a tab, r=smaug
https://hg.mozilla.org/integration/autoland/rev/b6649f0253c5
Part 2: Respect AppType in ImageCacheKey, r=emilio

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:nika, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.

Flags: needinfo?(nika)
Flags: needinfo?(emilio)
Flags: needinfo?(emilio)

These are fairly low-importance patches with confusing test failures which I haven't had the time to investigate yet.

Flags: needinfo?(nika)
You need to log in before you can comment on or make changes to this bug.