Closed Bug 1802541 Opened 1 year ago Closed 1 year ago

Throw exceptions when attempting to instantiate remote settings client in any non-main/parent process

Categories

(Firefox :: Remote Settings Client, defect, P3)

Desktop
All
defect

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox110 --- fixed

People

(Reporter: Gijs, Assigned: leplatrem)

References

Details

Attachments

(1 file)

We've had weird issues arise when people accidentally attempt to use RemoteSettings instances in child processes, the GPU process, or anywhere other than the main/parent process. We can't write to disk, we can be killed very easily, we can't rely on the same observer notifications - it's just painful through and through. If components need the information from remote settings in non-parent-process processes, they should do their own data sharing and updating etc. We should prevent this happening inside remote settings, though we may need to start by doing so on nightly only to avoid serious breakage.

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(mathieu)

Gijs, do you have an example snippet that detects which process it runs in? Or do you know a component that does a similar check?

Severity: -- → S2
Flags: needinfo?(mathieu) → needinfo?(gijskruitbosch+bugs)
Priority: -- → P3

(In reply to Mathieu Leplatre [:leplatrem] from comment #2)

Gijs, do you have an example snippet that detects which process it runs in? Or do you know a component that does a similar check?

Sure, something like this should work, I think:

if (
  Services.appinfo.processType !== Services.appinfo.PROCESS_TYPE_DEFAULT
) {
  throw new Error("Can't do the thingummywhatsit");
}

(PROCESS_TYPE_DEFAULT is the parent process - see https://searchfox.org/mozilla-central/rev/a0d4f8f112c5c792ae272bf6ce50763ddd23ffa2/xpcom/system/nsIXULRuntime.idl#216-229)

Does that help?

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(mathieu)
Assignee: nobody → mathieu
Status: NEW → ASSIGNED
Pushed by mleplatre@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ee59d072d5b5
Throw if Remote Settings client is instantiated in child process (r=Gijs)
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
Flags: needinfo?(mathieu)
See Also: → 1789401
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: