Closed Bug 1513865 Opened 2 years ago Closed 1 year ago

[socket-process] nsIPrefService.resetPrefs does not work

Categories

(Core :: Networking, defect, P2)

63 Branch
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dragana, Assigned: CuveeHsu)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

resetPref is only use on some xpcshell tests, therefore it was not made to work with  Preferences::EnsureSnapshot (before the socket process work Preferences::EnsureSnapshot is used only for the content process which do not run during xpcshell tests).
Can you give me a short explanation what needs to be done here to make resetPrefs work with the Socket process that will use gSharedMap.
Flags: needinfo?(kmaglione+bmo)

we can also turn off the socket process for this tests.

Sorry for the delay.

(In reply to Dragana Damjanovic [:dragana] from comment #1)

Can you give me a short explanation what needs to be done here to make
resetPrefs work with the Socket process that will use gSharedMap.

This is much easier said than done.

So, to be clear, this would not have correctly after child process startup even before shared preferences existed. It would have caused the preferences in the parent process to be reset, but not child processes, which means that parent and child processes would quickly become out of sync.

With shared preferences, the situation becomes a bit harder. There are some ways we could handle this, with varying degrees of brokenness, but all of them require leaking the shared map memory, since any string references which come from it are treated as permanent literals, and are not refcounted.

(In reply to Dragana Damjanovic [:dragana] from comment #2)

we can also turn off the socket process for this tests.

That's probably the best option. Any attempt to support resetting the pref service in a multi-process world is going to require a nontrivial amount of intricate code. And this function is only used by a few highly specific pref service unit tests, and should never be used elsewhere. Since those tests don't depend on the socket process at all (and don't even use the network), there's really no reason we should spend effort trying to make the socket process work with them.

Flags: needinfo?(kmaglione+bmo)

(In reply to Kris Maglione [:kmag] from comment #3)

Sorry for the delay.

(In reply to Dragana Damjanovic [:dragana] from comment #1)

Can you give me a short explanation what needs to be done here to make
resetPrefs work with the Socket process that will use gSharedMap.

This is much easier said than done.

So, to be clear, this would not have correctly after child process startup even before shared preferences existed. It would have caused the preferences in the parent process to be reset, but not child processes, which means that parent and child processes would quickly become out of sync.

With shared preferences, the situation becomes a bit harder. There are some ways we could handle this, with varying degrees of brokenness, but all of them require leaking the shared map memory, since any string references which come from it are treated as permanent literals, and are not refcounted.

(In reply to Dragana Damjanovic [:dragana] from comment #2)

we can also turn off the socket process for this tests.

That's probably the best option. Any attempt to support resetting the pref service in a multi-process world is going to require a nontrivial amount of intricate code. And this function is only used by a few highly specific pref service unit tests, and should never be used elsewhere. Since those tests don't depend on the socket process at all (and don't even use the network), there's really no reason we should spend effort trying to make the socket process work with them.

Thanks!!!

Fission Milestone: --- → M2
Assignee: nobody → dd.mozilla
Status: NEW → ASSIGNED
No longer blocks: socket-proc-webrtc

removed blocking on bug 1509472 based on my discussion with Dragana

Fission Milestone: M2 → M3

Junior, can you take this one?
(I will forward you some pointers per email)

Flags: needinfo?(juhsu)

Yes.

Assignee: dd.mozilla → juhsu
Flags: needinfo?(juhsu)

Since this work is no longer a part of Project Fission, can we remove it from the meta bug?
https://bugzilla.mozilla.org/show_bug.cgi?id=1451850

Fission Milestone: M3 → ---

bug 1546355 eases this work

Depends on: 1546355
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.