Closed Bug 1644466 Opened 5 years ago Closed 5 years ago

Convert dom.storage.next_gen from a VarCache pref to something else

Categories

(Core :: DOM: Core & HTML, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: Gankra, Assigned: Gankra)

References

Details

Attachments

(1 file, 1 obsolete file)

Assignee: nobody → a.beingessner

Hey janv, can we get a decision on this?

To refresh your memory:

  • This is one of the last two uses of VarCache in the codebase, a problematic and buggy utility we want to remove
  • Access to the pref is latched with a Mutex simulating the same basic functionality as AtStartup (afaict)
    • However you look at whether you're the parent or child process, the former using VarCache, the latter using GetBool
    • Based on the changelog this seems to be justified by making it usable on any thread, but if so this is a misunderstanding
      of the constraints of VarCache. It's not better at being accessed like that, it's just not going to stop you.
  • You were concerned that AtStartup could cause a deadlock if it needs to be initialized for this use
    • I did several full try pushes and found no obvious issues
    • kriswright contends that AtStartup should be initialized already once you reach this point (I agree, but am less certain)

So there's three options in my mind:

  • Land my patch to use AtStartup and see if anything breaks
  • Change the VarCache use to a GetBool, on the premise that the VarCache use would be broken in the same ways GetBool would be anyway
  • You propose a third, better, solution
Flags: needinfo?(jvarga)

(In reply to Alexis Beingessner [:Gankra] from comment #2)

  • Change the VarCache use to a GetBool, on the premise that the VarCache use would be broken in the same ways GetBool would be anyway

Let me check this option ...

Ok, thanks for the detailed explanation. I previously somehow missed that the primary goal is to get rid of the VarCache use.

I think it would be safer to do:

-   name: dom.storage.next_gen
    type: RelaxedAtomicBool
    value: value: @IS_EARLY_BETA_OR_EARLIER@
    mirror: always

NextGenLocalStorageEnabled can then stay as it is except that GetCurrentNextGenPrefValue call would be replaced with:
StaticPrefs::dom_storage_next_gen()

Again, a green try push doesn't guarantee that everything is ok. We had big problems with deadlocks in the past.

Does this sound good to you ?

Flags: needinfo?(jvarga)

This would be even better:

-   name: dom.storage.next_gen
    type: RelaxedAtomicBool
    value: value: @IS_EARLY_BETA_OR_EARLIER@
    mirror: always
    do_not_use_directly: true

The kinda hacky mutex latch is preserved to avoid concerns with AtStartup prefs having
potential to deadlock when used in this subsystem.

sorry for the delay, here's the suggested approach!

Pushed by abeingessner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0ae2d87b6e59 Convert dom.storage.next_gen into a StaticPref. r=janv
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
Attachment #9155748 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: