Closed Bug 1851497 Opened 2 years ago Closed 2 years ago

Windows 11 Mochitests with conditioned profile perma failing with Left over worker: https://s.0cf.io/sw.js?id=c859531b-3ae0-f3ad-0025-2175efd7e4ca (scope: https://s.0cf.io/

Categories

(Core :: DOM: Service Workers, defect, P2)

defect

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: NarcisB, Assigned: asuth)

References

Details

(Whiteboard: [stockwell disable-recommended])

Attachments

(1 file, 1 obsolete file)

Starting with this push, the Windows 11 Mochitests with conditioned profile are perma failing with Left over worker: https://s.0cf.io/sw.js?id=c859531b-3ae0-f3ad-0025-2175efd7e4ca (scope: https://s.0cf.io/

Log link: https://treeherder.mozilla.org/logviewer?job_id=427925350&repo=autoland&lineNumber=2643

Log snippet:

[task 2023-09-04T14:06:44.465Z] 14:06:44     INFO - TEST-PASS | dom/serviceworkers/test/test_abrupt_completion.html | Correct response text 
[task 2023-09-04T14:06:44.465Z] 14:06:44     INFO - add_task | Leaving testFetchHandler
[task 2023-09-04T14:06:44.465Z] 14:06:44     INFO - Buffered messages finished
[task 2023-09-04T14:06:44.466Z] 14:06:44     INFO - TEST-UNEXPECTED-FAIL | dom/serviceworkers/test/test_abrupt_completion.html | Left over worker: https://s.0cf.io/sw.js?id=c859531b-3ae0-f3ad-0025-2175efd7e4ca (scope: https://s.0cf.io/) 
[task 2023-09-04T14:06:44.466Z] 14:06:44     INFO -     SimpleTest.ok@SimpleTest/SimpleTest.js:424:16
[task 2023-09-04T14:06:44.466Z] 14:06:44     INFO -     afterCleanup@SimpleTest/SimpleTest.js:1481:20
[task 2023-09-04T14:06:44.466Z] 14:06:44     INFO -     async*executeCleanupFunction@SimpleTest/SimpleTest.js:1521:7
[task 2023-09-04T14:06:44.467Z] 14:06:44     INFO - GECKO(3816) | MEMORY STAT | vsize 2103691MB | vsizeMaxContiguous 87514148MB | residentFast 54MB | heapAllocated 8MB
[task 2023-09-04T14:06:44.467Z] 14:06:44    ERROR - TEST-UNEXPECTED-FAIL | /tests/dom/serviceworkers/test/test_abrupt_completion.html logged result after SimpleTest.finish(): Left over worker: https://s.0cf.io/sw.js?id=c859531b-3ae0-f3ad-0025-2175efd7e4ca (scope: https://s.0cf.io/)
[task 2023-09-04T14:06:44.468Z] 14:06:44     INFO - TEST-OK | dom/serviceworkers/test/test_abrupt_completion.html | took 1516ms

These permanent failures on Windows 11 with a conditioned profile (= profile gets upgraded once per day, and clones of it used for testing to identify issues with persistent data) started today after the latest conditioned profile had been created.

The mentioned host s.0cf.io is known for spreading unwanted and/or malicious software. It's not mentioned in the source code of mozilla-central. The changes between the push for which the previous conditioned profile got generated shows no related changes, and retriggers of successful runs hit this failure.

addons in the new conditioned profile - the same addons and version as for the previous conditioned profile:

formautofill@mozilla.org - 1.0.1
pictureinpicture@mozilla.org - 1.0.0
screenshots@mozilla.org - 39.0.1
webcompat-reporter@mozilla.org - 1.5.1
webcompat@mozilla.org - 118.0.0
default-theme@mozilla.org - 1.3
addons-search-detection@mozilla.com - 2.0.0
google@search.mozilla.org - 1.4
wikipedia@search.mozilla.org - 1.3
bing@search.mozilla.org - 1.6
ddg@search.mozilla.org - 1.4
firefox-compact-light@mozilla.org - 1.2
firefox-compact-dark@mozilla.org - 1.2
firefox-alpenglow@mozilla.org - 1.4
amazon@search.mozilla.org - 1.12

The issue should be the AlternativeServices.txt file found in the profile folder root. It has these 2 additions in the new profile

line 239
https:ps.0cf.io:443:.:^partitionKey=%28https%2Cebay.com%29:3 0 19604 https:ps.0cf.io:443:ps.0cf.io:443::n:1693916739:h3:y:1693829595:n:^partitionKey=%28https%2Cebay.com%29:|n:y:

line 595
https:s.0cf.io:443:.:^partitionKey=%28https%2Cebay.com%29:3 0 19604 https:s.0cf.io:443:s.0cf.io:443::n:1693916831:h3:y:1693829595:n:^partitionKey=%28https%2Cebay.com%29:|n:y:

Files with the conditioned profiles ("Artifacts") tab:

Bug 1840135 touched the code related to AlternativeServices.txt but got backed out before it made it to central.

Any insight what's going on here?

Flags: needinfo?(nkulatova)
Flags: needinfo?(dkeeler)

I think what that's saying is when the profile visited ebay.com, it (ebay) included content from ps.0cf.io/s.0cf.io, and when it (the profile) connected to those sites, they a) installed a service worker and b) sent an Alt-Svc header (which is basically just "you can reach this service at this other location"). I don't think there's anything particularly sinister here, other than the online ad ecosystem being kinda scummy.

My sense is that test_abrupt_completion.html isn't sound with conditioned profiles, precisely because other sites could register serviceworkers that it would consider to be leftover.

Flags: needinfo?(dkeeler)
Flags: needinfo?(nkulatova)
Assignee: nobody → aryx.bugmail
Group: mozilla-employee-confidential
Status: NEW → ASSIGNED
Component: RelOps: Windows OS → DOM: Service Workers
Product: Infrastructure & Operations → Core

Because conditioned profiles retain profile data, a service worker installed
by an ebay.com page (but for a different host) got detected as unexpected
service worker by this test.

Flags: needinfo?(bugmail)
See Also: → 1776997

(I commented on the PR at https://phabricator.services.mozilla.com/D187656#6212009 about how this is actually the mochitest checks for leftover ServiceWorkers that's sad and test_abrupt_completion, although it has other problems, is not really involved in the problem, just the first test that gets run in the process.)

Flags: needinfo?(bugmail)
Severity: -- → S3
Priority: -- → P2

Hi, any chance something could be done about these failures? There are 618 total failures since this bug was filled and it's failing at a large rate: https://treeherder.mozilla.org/intermittent-failures/bugdetails?startday=2023-08-14&endday=2023-09-13&tree=trunk&failurehash=all&bug=1851497

Flags: needinfo?(bugmail)
Flags: needinfo?(aiunusov)

Yes, I'll put up a patch along the lines of what I said in comment 6. Taking the bug.

Assignee: aryx.bugmail → bugmail
Flags: needinfo?(bugmail)
Flags: needinfo?(aiunusov)

Thank you. Much appreciated.

Attachment #9351974 - Attachment is obsolete: true

The conditioned profile has picked up a new ServiceWorker due to a
change in the sites the profile is run against. We need to ignore this
in the SimpleTest.js automatic check that makes sure tests didn't fail
to clean up after themselves. (A test that fails to clean up after
itself is potentially broken in multiple ways.)

As shown in the log in comment 0 of the bug, the SW script ends up with
a cache-busting query parameter that looks like a UUID
(fake example: sw.js?ima-fake-uuid) that seems likely to be unstable
because it is either used to ensure the SW gets updated or because it's
a tracking parameter. So now we check for our list of expected SWs to
be prefixes of the actual scope we find.

Pushed by bugmail@asutherland.org: https://hg.mozilla.org/integration/autoland/rev/299706d11bb7 Expect the new SW in conditioned profiles. r=jmarshall
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: