Closed Bug 2053962 Opened 2 months ago Closed 1 month ago

Crash in [@ mozilla::Preferences::BackupPrefFile]

Categories

(Core :: Preferences: Backend, defect)

x86
All
defect

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- wontfix
firefox-esr153 --- fixed
firefox153 --- wontfix
firefox154 --- fixed
firefox155 --- fixed

People

(Reporter: release-mgmt-account-bot, Assigned: jstutte)

References

(Blocks 1 open bug)

Details

(Keywords: crash)

Crash Data

Attachments

(3 files)

Crash report: https://crash-stats.mozilla.org/report/index/bb2c9fa7-6978-41a4-a34d-6fe580260703

MOZ_CRASH Reason: MozPromise::ThenValue created from 'BackupPrefFile' destroyed without being either disconnected, resolved, or rejected (dispatchRv: not dispatched)

Top 10 frames of crashing thread:

0  xul.dll  MOZ_Crash  mfbt/Assertions.h:402
0  xul.dll  mozilla::MozPromise<bool, nsresult, 0>::ThenValueBase::AssertIsDead  xpcom/threads/MozPromise.h:541
1  xul.dll  mozilla::MozPromise<bool, nsresult, 0>::AssertIsDead  xpcom/threads/MozPromise.h:1267
2  xul.dll  mozilla::MozPromise<bool, nsresult, 0>::~MozPromise  xpcom/threads/MozPromise.h:1315
3  xul.dll  mozilla::MozPromise<bool, nsresult, 0>::Private::~Private  xpcom/threads/MozPromise.h:255
4  xul.dll  mozilla::MozPromiseRefcountable::Release  xpcom/threads/MozPromise.h:150
4  xul.dll  mozilla::RefPtrTraits<mozilla::MozPromise<bool, nsresult, 0> >::Release  mfbt/RefPtr.h:48
4  xul.dll  RefPtr<mozilla::MozPromise<bool, nsresult, 0> >::ConstRemovingRefPtrTraits<mozilla::MozPromise<bool, nsresult, 0> >::Release  mfbt/RefPtr.h:406
4  xul.dll  RefPtr<mozilla::MozPromise<bool, nsresult, 0> >::~RefPtr  mfbt/RefPtr.h:79
4  xul.dll  mozilla::Preferences::BackupPrefFile  modules/libpref/Preferences.cpp:5093

By querying Nightly crashes reported within the last 2 months, here are some insights about the signature:

  • First crash report: 2026-05-05
  • Process type: Parent
  • Is startup crash: No
  • Has user comments: No
  • Is null crash: Yes - 1 out of 10 crashes happened on null or near null memory address
Component: General → Preferences: Backend

BackupPrefFile writes go through PreferencesImpl::WritePrefFile, which coalesces
all writes through a single sPendingWriteData slot destined for the profile
prefs.js. A backup targets a different file with a filtered pref set and carries
a MozPromise. When the slot was already occupied, the backup took the coalescing
early-return, dropping its MozPromiseHolder without settling it and leaving its
filtered data in the slot. Give writes that carry a promise holder their own
PWRunnable with their own data so they never touch the shared slot.

Assignee: nobody → jstutte
Status: NEW → ASSIGNED

There is an r+ patch which didn't land and no activity in this bug for 1 week.
:jstutte, 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 BugBot documentation.

Flags: needinfo?(jstutte)
Flags: needinfo?(gstoll)
Pushed by jstutte@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/58d973b24a3b https://hg.mozilla.org/integration/autoland/rev/fa8e9db1acdd Dispatch async backup pref writes as standalone writes instead of sharing the sPendingWriteData slot. r=gstoll
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch

Greg, do you think we should uplift this to beta? I am a bit worried that this might not be the only possible consequence of that race and we may save wrong prefs or some such.

Flags: needinfo?(jstutte)

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

For more information, please visit BugBot documentation.

Flags: needinfo?(jstutte)

Yeah, I think it would probably be a good idea to uplift this as it could lead to data loss. Let me know if you'd like me to do that or if you'd rather handle it, thanks!

Flags: needinfo?(gstoll)

I'll handle it.

IIUC this has been introduced in Fx125, so all versions but ESR 115 are affected. I'll propose an uplift to ESR 153, too.

BackupPrefFile writes go through PreferencesImpl::WritePrefFile, which coalesces
all writes through a single sPendingWriteData slot destined for the profile
prefs.js. A backup targets a different file with a filtered pref set and carries
a MozPromise. When the slot was already occupied, the backup took the coalescing
early-return, dropping its MozPromiseHolder without settling it and leaving its
filtered data in the slot. Give writes that carry a promise holder their own
PWRunnable with their own data so they never touch the shared slot.

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

Attachment #9616166 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: Preference backups may not work as expected, resulting in potential data loss (only for the backups, but still).
    Note: There seems to be no UI in Fenix to reach this code, so we can probably do without uplifting it there.
  • 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 fix is a bit more than a on-liner, but straight forward and existing tests continue to pass + a new one.
  • String changes made/needed?: None
  • Is Android affected?: no

firefox-esr153 Uplift Approval Request

  • User impact if declined/Reason for urgency: Preference backups may not work as expected, resulting in potential data loss (only for the backups, but still).
    Note: There seems to be no UI in Fenix to reach this code, so we can probably do without uplifting it there.
  • 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 fix is a bit more than a on-liner, but straight forward and existing tests continue to pass + a new one.
  • String changes made/needed?: None
  • Is Android affected?: no
Attachment #9616804 - Flags: approval-mozilla-esr153?

BackupPrefFile writes go through PreferencesImpl::WritePrefFile, which coalesces
all writes through a single sPendingWriteData slot destined for the profile
prefs.js. A backup targets a different file with a filtered pref set and carries
a MozPromise. When the slot was already occupied, the backup took the coalescing
early-return, dropping its MozPromiseHolder without settling it and leaving its
filtered data in the slot. Give writes that carry a promise holder their own
PWRunnable with their own data so they never touch the shared slot.

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

Attachment #9616166 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9616804 - Flags: approval-mozilla-esr153? → approval-mozilla-esr153+
QA Whiteboard: [qa-triage-done-c155/b154]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: