Closed Bug 1728332 Opened 3 years ago Closed 2 years ago

[Experiment] Pinned tabs of the same domain are initially loaded in separate Shared Web Content processes

Categories

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

Desktop
All
defect

Tracking

()

VERIFIED FIXED
100 Branch
Fission Milestone Future
Tracking Status
firefox-esr78 --- disabled
firefox-esr91 --- disabled
firefox91 --- disabled
firefox92 --- wontfix
firefox93 --- wontfix
firefox94 --- wontfix
firefox100 --- verified

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 and pin all of them.
  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. Observe the process list as the tabs are loading.

[Expected result]:

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

[Actual result]:

  • macOS & Linux: The tabs with the same domain are initially loaded in separate Shared Web Content processes before being split in 4 processes.
  • Windows: All tabs are loaded in separate Shared Web Content processes and after all are loaded they transition to being split into 4 processes.

[Notes]:

  • 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

Upon further investigation, it seems this behavior is present in the 2nd branch of the experiment (process-count-1) as well. Initially all tabs are loaded in Shared Web Content processes and then they are slowly migrated into a single process.

Summary: [Experiment] [process-count-4] Pinned tabs of the same domain are initially loaded in separate Shared Web Content processes → [Experiment] Pinned tabs of the same domain are initially loaded in separate Shared Web Content processes

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: → 1728331
See Also: → 1728909

Tracking for Fission MVP.

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

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

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

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

Hi Nika, I assume this is still a valid thing? Are you still planning to work on this? Thanks!

Flags: needinfo?(nika)

Yeah, I believe this is still valid though I haven't been actively working on it.

The rough sketch of the problem here is that the API which session restore uses to create new tabs doesn't know the URI that is going to be restored into each tab up-front, so when it is initially created it loads an initial about:blank which has a null principal and is allocated into one of the shared web content processes. Immediately after this load is complete, it then navigates to the actual webpage, which requires a process switch.

This specifically impacts pinned tabs because when the tab is being added, it is only considered to be added lazily if it is not pinned (https://searchfox.org/mozilla-central/rev/d4d7611ee4dd0003b492b865bc5988a4e6afc985/browser/base/content/tabbrowser.js#2986-2987), so the browser is added eagerly instead, and no URI is provided to addTrustedTab (https://searchfox.org/mozilla-central/rev/d4d7611ee4dd0003b492b865bc5988a4e6afc985/browser/base/content/tabbrowser.js#2989-2998). This can probably be handled by calculating the predicted remote type in this method & passing it to addTrustedTab as preferredRemoteType.

I threw together a quick patch for this which should work, but haven't tested it yet.

Flags: needinfo?(nika)

This should mostly avoid the issue where newly created pinned tabs when
restoring a session are first created in the shared web process, and
migrated into the correct process upon navigating. I also added
remoteType prediction to the undoCloseTab and duplicateTab codepaths
to avoid unnecessary process changes there as well.

Pushed by nlayzell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/30fa07c96caa
Predict remote type when inserting restored tabs, r=Gijs

Backed out for causing mochitest failures on browser_tabs_in_urlbar.js

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | browser/components/sessionstore/test/browser_tabs_in_urlbar.js | Should have found all the tabs - 1 == 0 - JS frame :: chrome://mochitests/content/browser/browser/components/sessionstore/test/browser_tabs_in_urlbar.js :: test_unrestored_tabs_listed :: line 134
Flags: needinfo?(nika)
Attachment #9267923 - Attachment description: Bug 1728332 - Predict remote type when inserting restored tabs, r=gijs → Bug 1728332 - Part 1: Predict remote type when inserting restored tabs, r=gijs

Before this change, there was raciness in this test due to the queries
to insert the opened tabs into the moz_openpages_temp table occuring at
the same time as the queries to read from that table in other
components. This patch makes the test initialize the DB connection
earlier, and ensure that no statements are still pending when running to
hopefully avoid potential races caused by the async nature of the
database connection.

Depends on D141146

Pushed by nlayzell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/675c85528602
Part 1: Predict remote type when inserting restored tabs, r=Gijs
https://hg.mozilla.org/integration/autoland/rev/4d74198886c2
Part 2: Avoid raciness in sqlite interactions in browser_tabs_in_urlbar.js, r=adw
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
Regressions: 1761618
Flags: qe-verify+
Regressions: 1766951

I managed to reproduce this issue following the STR from the Description on a 2021-08-31 Nightly build on Win10 64-bits. Confirmed as fixed on Firefox 100.0(20220428192727) and Nightly 101.0a1(20220501190841) on Win10 64-bits, Ubuntu 20.04 and macOS 10.15.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: