TEST-UNEXPECTED-FAIL | testing/enterprise/test_felt_browser_access_connector.py BrowserAccessConnector.test_browser_access_connector_default_on | AssertionError
Categories
(Core :: Preferences: Backend, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr153 | --- | unaffected |
| firefox159 | --- | unaffected |
| firefox160 | --- | unaffected |
| firefox161 | --- | fixed |
People
(Reporter: gerard-majax, Assigned: gerard-majax)
References
(Blocks 2 open bugs, Regression)
Details
(Keywords: regression)
Attachments
(2 external files)
Since today's enterprise-main merge against upstream main merge, we discovered a regression on one of our tests.
According to Claude's analysis, this is related to pref snapshot handling, and the triggering point is related to the removal of the socket process:
Root cause
Once the parent process has built its shared pref snapshot, a pref from that snapshot can't be removed from it. Deleting it (deleteBranch, or clearUserPref on a pref that only has a user value) instead leaves an empty placeholder of type None in the parent's pref table, so the old snapshot value stays hidden.
Setting a default on that pref again finds the placeholder. Pref::SetDefaultValue then requires the stored type to match the new one exactly, and None never matches, so it returns NS_ERROR_UNEXPECTED. Setting a user value doesn't have this problem, because Pref::SetUserValue already adopts the new type.
The AccessConnector test hits exactly this:
1. The policy is applied at startup, before any child process exists. It sets a default for browser.ipProtection.mode, which has no default in any prefs file.
2. The first child process launches and the snapshot is built, now including mode = 3.
3. Disabling the policy makes PoliciesHelpers.restorePreferenceState() call deleteBranch, because there was no original default to restore. The pref becomes a placeholder.
4. Re-enabling calls setIntPref on the default branch, which fails.
Why it went undetected
All of these have to be true at once, and until this merge they almost never were:
- The pref must be in the snapshot. The snapshot is built when the first child process launches. Until bug 2077172, the socket process launched very early at startup, so the snapshot held little beyond the prefs files. Prefs set later stayed in the ordinary table, and deleting them really removed them. With the socket process gone, the first child launches later, after the console policies have run, so policy-set prefs end up in the snapshot.
- The pref must have no default in the prefs files. Otherwise restorePreferenceState writes the original default back and never calls deleteBranch.
- The default must be set again in the same session. Few things set defaults at runtime: mainly enterprise policies and Nimbus. Removing and re-adding a policy in one session is rare, and the upstream policy tests don't do it.
- The failure is quiet. pref_SetPref only prints a debug-build warning, "Rejected attempt to change type of pref … from none to int". In JS the policy engine catches the exception and logs it. All you notice is a pref that's missing.
That's also why only default_on fails: it's the only test where the policy is on before the first child launches and is then removed and re-added. default_off starts with the pref unset, so it's never in the snapshot.
STR:
- On today's merge from
https://github.com/mozilla/enterprise-firefox/tree/enterprise-mainwithout the workaround applied in https://github.com/mozilla/enterprise-firefox-try/commit/6d119e0bc4769f0a3e8c00a93e010f4b52f9ad8e - build with
--enable-enterpriseflag mach marionette-test testing/enterprise/test_felt_browser_access_connector.py
Expected:
Test passes
Actual:
Test fails on asserting value of a pref
| Assignee | ||
Updated•15 days ago
|
| Assignee | ||
Updated•15 days ago
|
| Assignee | ||
Comment 1•15 days ago
|
||
Looking at the code, I am a bit doubtful of that analysis, and I'd rather suspect a bug around PoliciesHelpers
| Assignee | ||
Updated•15 days ago
|
| Assignee | ||
Comment 2•15 days ago
|
||
try of the test proposed by claude: https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=112763
| Assignee | ||
Comment 3•15 days ago
|
||
| Assignee | ||
Comment 4•15 days ago
•
|
||
Bug may have been introduced by bug 1960948, only revealed by the change of behavior recently in bug 2077172
Comment 5•15 days ago
|
||
:leggert, since you are the author of the regressor, bug 2077172, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Comment 6•14 days ago
|
||
Could someone point me at the CI artifacts of the failure? The AI analysis and the indicated bugs seem somewhat unbelievable.
| Assignee | ||
Comment 7•14 days ago
|
||
(In reply to Lars Eggert [:lars] from comment #6)
Could someone point me at the CI artifacts of the failure? The AI analysis and the indicated bugs seem somewhat unbelievable.
yes, I'm far from being convinced myself ...
| Assignee | ||
Comment 8•14 days ago
|
||
(In reply to Lars Eggert [:lars] from comment #6)
Could someone point me at the CI artifacts of the failure? The AI analysis and the indicated bugs seem somewhat unbelievable.
test failures are at https://treeherder.mozilla.org/jobs?repo=enterprise-firefox-try&revision=9ce8f0099dd663ff565efa592fb55cc1b000b856&searchStr=marionette-enterprise,
if you try to repro locally, there's https://github.com/mozilla/enterprise-firefox/commit/6d119e0bc4769f0a3e8c00a93e010f4b52f9ad8e to revert, which I landed as a workaround but may in fact be the correct fix, because I'm doubtful of the analysis provided earlier
You should be able to get builds from https://treeherder.mozilla.org/jobs?repo=enterprise-firefox-try&revision=9ce8f0099dd663ff565efa592fb55cc1b000b856&searchStr=enterprise%2Cbuild (make sure not to pick thunderbird)
Comment 9•13 days ago
|
||
I think your diagnosis that the socket process removal exposed an existing libpref bug is correct, and your test/fix look basically OK. Some review comments from when I had Claude look into it here:
Review of the libpref fix (dad78e68be41) and its test (930bfc4095a6). These come from reading the code; I have not confirmed them with tests yet.
Correctness
- Locked placeholder. The new
IsTypeNone()branch sets the type before theIsLocked()check.Pref::FromWrappercopies the locked/sanitized/sticky flags from the shared map, andClearBranchandClearUseronly reset the type. So: lock a pref, launch a child,deleteBranchit,setIntPrefon the default branch. That returnsNS_OKand leaves a pref of type Int with no value:getPrefTypesaysPREF_INT,getIntPrefthrows. Before the patch the call returnedNS_ERROR_UNEXPECTED. - Type change on static prefs. A deleted static pref is always in the shared map, so it can now be re-added with a different type than its C++ mirror.
UpdateMirrorthen asserts in debug builds and keeps a stale mirror in release builds. I haven't checked whether deleting a static pref already reaches that assert without the patch. - Stale stickiness. The placeholder keeps
mIsSticky, andSetDefaultValueonly ever sets it, never clears it. A default re-added without stickiness still behaves as sticky. - Comment too narrow. The new comment says a typeless entry always shadows a deleted shared pref.
ClearBranchandClearUseralso leave typeless entries for sanitized prefs that are not in the shared map, so their behaviour changes too.
Test
- No child-side check. The test checks only the parent. The content process has its own typeless mask entry (
SetPreference); asendCommandreading the pref in the child would check that it sees the re-added default. - Edge cases not covered. Nothing tests re-adding with a different type, or the locked and sticky cases above.
- No cleanup. The pref set by the test is never removed.
Design
- Duplicate type setting.
pref_SetPrefalready sets the type on a newly created entry; the new branch duplicates that for the default case. - Fix it where the placeholder is made. Only the type is reset when the placeholder is created; the other flags survive. Resetting the entry to a clean state at the three
SetType(PrefType::None)sites (ClearBranch,ClearUser, contentSetPreference) would address 1 and 3 together.
1, 3 and 9 seem the most important to me; 5 is cheap to add.
Updated•13 days ago
|
| Assignee | ||
Comment 10•13 days ago
|
||
Updated•13 days ago
|
| Assignee | ||
Comment 11•13 days ago
|
||
Deleting a pref that is in the shared pref map leaves a typeless entry
in the parent to mask it, which SetDefaultValue() rejected for any type.
Comment 12•13 days ago
|
||
Comment 13•13 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/d4271380fde9
https://hg.mozilla.org/mozilla-central/rev/12668eeed8d1
Updated•11 days ago
|
Updated•5 days ago
|
Description
•