Closed Bug 2025314 Opened 16 days ago Closed 13 days ago

asyncFlushCurrentProfile assumes all toolkit profiles have different store identifiers and overwrites the wrong profile if this isn't the case

Categories

(Toolkit :: Startup and Profile System, defect, P1)

Firefox 150
Desktop
Windows 11
defect

Tracking

()

RESOLVED FIXED
151 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox149 --- unaffected
firefox150 + fixed
firefox151 --- fixed

People

(Reporter: alice0775, Assigned: mossop, NeedInfo)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: nightly-community, regression)

Attachments

(2 files)

Firefox launches using a profile other than the one selected with firefox -p.

Steps to reproduce:

  1. Prerequisite: There are many profiles.
  2. Start nightly Firefox -p to launch Profile selector and choose a profile, then Start Nightly.
  3. Open about:support and check profile folder

Actual results:
Firefox launches using a profile other than the one selected.
And profiles.ini is broken.

Expected results:
Firefox should launch using the selected profile.

It happened again.

Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---

Here is an example of a profiles.ini file (number of profiles is > 50)

[Profile1]
Name=profilename111
IsRelative=1
Path=Profiles/blablabla.profilename111

[Profile2]
Name=profilename222
IsRelative=1
Path=Profiles/blablabla.profilename222

... ...
  1. Run firefox -p, select the profile profilename222, and start and close the browser.
  2. Run firefox -p, select the profile profilename111, and start and close the browser.

As a result, the path for profilename222 is unexpectedly overwritten as follows:

[Profile1]
Name=profilename111
IsRelative=1
Path=Profiles/blablabla.profilename111

[Profile2]
Name=profilename222
IsRelative=1
Path=Profiles/blablabla.profilename111

... ...

[Tracking Requested - why for this release]: Profile system will be broken after launch browser with different profiles.

Regression window:
https://hg-edge.mozilla.org/integration/autoland/pushloghtml?fromchange=97386e6e20491aa6291afc8a6f5d4ee69bcdbef5&tochange=7bada62955268708db3bb09358944ee65c072f13

Keywords: regression
Regressed by: 2022782

:mossop, since you are the author of the regressor, bug 2022782, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(dtownsend)
Status: REOPENED → NEW

Bug 2022782 only really changed the path when you've used selectable profiles previously so I assume that is the case here.

(In reply to Alice0775 White from comment #3)

[Profile1]
Name=profilename111
IsRelative=1
Path=Profiles/blablabla.profilename111

[Profile2]
Name=profilename222
IsRelative=1
Path=Profiles/blablabla.profilename222

Was there no StoreID property for these?

For both profiles please run the following two snippets in the browser console and let me know what they return:

SelectableProfileService.storeID

await SelectableProfileService.getAllProfiles().then(p => p.map(p => p.path))

Severity: -- → S2
Flags: needinfo?(dtownsend) → needinfo?(alice0775)
Priority: -- → P1

profile1:

21:43:50.926 SelectableProfileService.storeID
21:43:50.966 "2e42c58b"
21:44:24.933 await SelectableProfileService.getAllProfiles().then(p => p.map(p => p.path))
21:44:25.054
Array []
​
length: 0
​
<prototype>: Array []
​
<global>: SystemGlobal { crypto: Crypto, indexedDB: IDBFactory, locks: LockManager, … }

profile2:

21:45:25.566 SelectableProfileService.storeID
21:45:25.642 "2e42c58b" 
21:45:36.558 await SelectableProfileService.getAllProfiles().then(p => p.map(p => p.path))
21:45:36.754
Array []
​
length: 0
​
<prototype>: Array []
​
<global>: SystemGlobal { crypto: Crypto, indexedDB: IDBFactory, locks: LockManager, … }
Flags: needinfo?(alice0775)

What are the values of browser.profiles.created and browser.profiles.enabled in about:config in both cases?

Flags: needinfo?(alice0775)

pofile1:

browser.profiles.created true
browser.profiles.enabled true

profile2:

browser.profiles.created true
browser.profiles.enabled true
Flags: needinfo?(alice0775)

Ok this is somewhat related to bug 1991913. Somehow both of those profiles are assigned to the same store ID which should never happen, and on top of that the store doesn't contain any profiles leaving things in a bit of a broken state. I can see why bug 2022782 has made this start behaving more strangely.

Blocks: 1991913

I suspect the presence of duplicate storeIDs is due to the following:
“Copying the profile folder using a file manager, renaming that folder using the file manager, and then registering it with the Profile Manager.”

This approach hadn’t caused any issues until now, but the problem may have surfaced after the changes made in bug 2022782.

Summary: The profile system in 150.0a1 has been broken for the past couple of weeks. → asyncFlushCurrentProfile assumes all toolkit profiles have different store identifiers and overwrites the wrong profile if this isn't the case

We currently attempt to flush whenever a browser window is activated. In the
most common case this doesn't actually change the profile, it is just switching
between windows of the same profile. The only time we do still need to flush in
this case is if another instance has updated profiles.ini in the meantime.

Additionally this makes asyncFlushCurrentProfile safer by making it fail if more
than one profile has the same store ID or path if we are falling back to paths.

Assignee: nobody → dtownsend
Status: NEW → ASSIGNED

Set release status flags based on info from the regressing bug 2022782

See Also: → 2026226
Status: ASSIGNED → RESOLVED
Closed: 16 days ago13 days ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch

The patch landed in nightly and beta is affected.
:mossop, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(dtownsend)

Yes we would want to uplift but I want to give this a couple of days bake time on Nightly first.

Alice are you able to verify that this fixes the issue for you in the next nightly?

Flags: needinfo?(alice0775)

STR For testing:

  1. I delete Profile Groups folder and installs.ini and profiles.ini file.
  2. And I registered two profiles that contain a prefs.js file with the same toolkit.profiles.storeID value.

Results:
Even if I use latest Nightly151.0a1 (20260326095454), the issue is reproduced.


I followed the same steps as in Step 1 above.
And removed toolkit.profiles.storeID from the prefs.js file for each profile, and then re-registered them.

After doing so, the issue no longer occurred.

Flags: needinfo?(alice0775)

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: In an edge case users of the old profile management system may lose access to some of their profiles is they have manually modified their profiles.ini file.
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: The code changes are well exercised by tests and this has been baking on nightly for nearly two weeks
  • String changes made/needed?: None
  • Is Android affected?: no
Attachment #9566928 - Flags: approval-mozilla-beta?

We currently attempt to flush whenever a browser window is activated. In the
most common case this doesn't actually change the profile, it is just switching
between windows of the same profile. The only time we do still need to flush in
this case is if another instance has updated profiles.ini in the meantime.

Additionally this makes asyncFlushCurrentProfile safer by making it fail if more
than one profile has the same store ID or path if we are falling back to paths.

Original Revision: https://phabricator.services.mozilla.com/D289780

Attachment #9566928 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: