Closed Bug 1931110 Opened 1 year ago Closed 1 year ago

Update async flush behavior to flush the group profile, not the current profile

Categories

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

defect

Tracking

()

RESOLVED FIXED
135 Branch
Tracking Status
firefox135 --- fixed

People

(Reporter: jhirsch, Assigned: jhirsch)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidefe-profile-management])

Attachments

(1 file)

In the code review discussion for Bug 1918813, it was discovered that the "last writer wins" semantics may not be correctly implemented for updating the default profile for a group.

In the case where a selectable profile has received application focus and is trying to become the default for the profile group, it appears that SelectableProfileService.#attemptFlushProfileService() can fail:

  1. if the profiles.ini file has been updated since the selectable profile was launched, the call to nsToolkitProfileService.asyncFlush will fail, because that function throws if GetIsListOutdated returns true.
  2. as a backup, we then attempt to call nsToolkitProfileService.asyncFlushCurrentProfile , but the call to nsToolkitProfileService.asyncFlushCurrentProfile will fail, as the C++ function throws if mCurrent is null, and mCurrent is always null for a selectable profile.

I have a fix in mind here: we can adjust the null-check in nsToolkitProfileService.asyncFlush to skip the GetIsListOutdated check if we are in a selectable profile, and we can adjust the unnecessary write check in SelectableProfileService.#attemptFlushProfileService to bail out only if both the group toolkit profile's rootDir equals the current profile's rootDir, but also (new condition) that the file is not outdated--if the file is outdated, it's possible someone else updated profiles.ini but we haven't read in the latest contents. Pushing a patch now with these fixes added.

Assignee: nobody → jhirsch
Whiteboard: [fidefe-profile-management]

The severity field is not set for this bug.
:mossop, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(dtownsend)

Note that in the review :mossop suggested an alternative fix:

So this basically undoes bug 1915216 which means we start clobbering the profiles.ini file.

How about instead we change AsyncFlushCurrentProfile to AsyncFlushGroupProfile so it is checking mGroupProfile instead of mCurrentProfile?

Updating the bug title accordingly

Severity: -- → S2
Priority: -- → P1
Summary: Improve 'last writer wins' semantics for selectable profiles updating the group default → Update async flush behavior to flush the group profile, not the current profile
Flags: needinfo?(dtownsend)
Attachment #9437386 - Attachment description: Bug 1931110 - Improve 'last writer wins' semantics for selectable profiles updating the group default. r?mossop!,niklas! → Bug 1931110 - Update async flush behavior to flush the group profile, not the current profile. r?mossop!,niklas
Pushed by jhirsch@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/172d1320ab60 Update async flush behavior to flush the group profile, not the current profile. r=mossop
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: