Open Bug 2024675 Opened 5 months ago Updated 3 months ago

Intermittent leakcheck large nsGlobalWindowInner | browser/components/aiwindow/ui/test/browser/browser.toml

Categories

(Core :: Machine Learning: Frontend, defect)

defect

Tracking

()

Tracking Status
firefox-esr140 --- unaffected
firefox149 --- unaffected
firefox150 --- affected
firefox151 --- affected

People

(Reporter: intermittent-bug-filer, Unassigned)

References

(Regression)

Details

(Keywords: intermittent-failure, regression, test-verify-fail, Whiteboard: [stockwell unknown])

Attachments

(1 obsolete file)

Filed by: asilaghi [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=554572290&repo=autoland&task=K8qXtzROSguPOAd1mSgv9Q.0
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/K8qXtzROSguPOAd1mSgv9Q/runs/0/artifacts/public/logs/live_backing.log
Reftest URL: https://hg.mozilla.org/mozilla-central/raw-file/default/layout/tools/reftest/reftest-analyzer.xhtml#logurl=https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/K8qXtzROSguPOAd1mSgv9Q/runs/0/artifacts/public/logs/live_backing.log&only_show_unexpected=1


[task 2026-03-19T14:53:14.904+00:00] 14:53:14     INFO - TEST-INFO | leakcheck | tab leaked 2 xpc::CompartmentPrivate
[task 2026-03-19T14:53:14.910+00:00] 14:53:14     INFO - TEST-UNEXPECTED-FAIL | leakcheck large nsGlobalWindowInner | browser/components/aiwindow/ui/test/browser/browser.toml
[task 2026-03-19T14:53:14.910+00:00] 14:53:14     INFO - leakcheck | Processing leak log file /tmp/tmp8tx75xfn.mozrunner/runtests_leaks_forkserver_pid6910.log
[task 2026-03-19T14:53:14.910+00:00] 14:53:14     INFO - TEST-PASS | leakcheck | forkserver no leaks detected!
Summary: Intermittent TV leakcheck large nsGlobalWindowInner | browser/components/aiwindow/ui/test/browser/browser.toml → Intermittent leakcheck large nsGlobalWindowInner | browser/components/aiwindow/ui/test/browser/browser.toml
Duplicate of this bug: 2024751
Keywords: regression
Regressed by: 2023911

:npodgurski, since you are the author of the regressor, bug 2023911, could you take a look?

For more information, please visit BugBot documentation.

Flags: needinfo?(npodgurski)

Hi, I'm not too familiar with this process - digging a bit I suspect it may be related to the changes made in bug 2023911 to file firefox/browser/components/aiwindow/ui/test/browser/browser_smartwindow_telemetry.js - Maybe there's a window or tab in one of those tests that wasn't fully cleaned up. I have a few open patches already https://phabricator.services.mozilla.com/D289293 https://phabricator.services.mozilla.com/D288707 that target this file so I could look to resolve it there. Although I'm unable to reproduce that exact error/log locally

Flags: needinfo?(npodgurski)

(In reply to npodgurski from comment #4)

Hi, I'm not too familiar with this process - digging a bit I suspect it may be related to the changes made in bug 2023911 to file firefox/browser/components/aiwindow/ui/test/browser/browser_smartwindow_telemetry.js - Maybe there's a window or tab in one of those tests that wasn't fully cleaned up. I have a few open patches already https://phabricator.services.mozilla.com/D289293 https://phabricator.services.mozilla.com/D288707 that target this file so I could look to resolve it there. Although I'm unable to reproduce that exact error/log locally

Have you tried a debug build? Leak checking only runs in debug builds.

Flags: needinfo?(npodgurski)
See Also: → 1984528

Bug 1984528 is another symptom of massive leakiness in this directory.

bug 2025711 also looks related.

See Also: → 2025711

Set release status flags based on info from the regressing bug 2023911

Component: DOM: Core & HTML → Machine Learning: Frontend

Have you tried a debug build? Leak checking only runs in debug builds.

Yes, even on debug builds I am unable to reproduce this on the latest nightly

Flags: needinfo?(npodgurski)

(In reply to Andrew McCreight [:mccr8] from comment #7)

Bug 1984528 is another symptom of massive leakiness in this directory.

Was again in my bugmail, so I spent a few tokens and here is what AI says about this bug (apparently a tests-only problem). I do not know any of this code, so leaving this here:

The root cause is that several tests in this file open AI windows without stubbing openAIEngine.build. When a chat message is submitted, submitChatMessage calls #fetchAIResponse as fire-and-forget (no await) [1]. Inside that flow, #addConversationTitle [2] fires off another un-awaited openAIEngine.build("title_generation", ...). In test environments without RemoteSettings data for that feature, the engine build promise hangs indefinitely. The pending promise's closure captures this (the AIWindow element), which prevents the content window's nsGlobalWindowInner from being GC'd.

The stubEngineNetworkBoundaries helper [3] exists specifically to fix this — it stubs openAIEngine.build so non-chat features resolve immediately. Its JSDoc even calls out #addConversationTitle by name. However, neither the three tests added by the regressor nor the older withServer helper [4] use it. withServer only stubs getFxAccountToken and sets up a mock HTTP server, leaving openAIEngine.build unstubbed.

Before the regressor, the test file had 8 tests opening AI windows (5 with no engine stubbing, 3 via withServer). The regressor added 3 more windows, making the intermittent race between "engine build hangs" and "leak checker runs GC" more likely to trigger.

The fix would be to switch the tests that use withServer (or nothing) to stubEngineNetworkBoundaries instead, which was designed for exactly this purpose.

[1] https://searchfox.org/firefox-main/rev/a5b4b687e31a4b9b5a27b602fdfa97aff2d941ca/browser/components/aiwindow/ui/components/ai-window/ai-window.mjs#1082
[2] https://searchfox.org/firefox-main/rev/a5b4b687e31a4b9b5a27b602fdfa97aff2d941ca/browser/components/aiwindow/ui/components/ai-window/ai-window.mjs#1227
[3] https://searchfox.org/firefox-main/rev/a5b4b687e31a4b9b5a27b602fdfa97aff2d941ca/browser/components/aiwindow/ui/test/browser/head.js#194
[4] https://searchfox.org/firefox-main/rev/a5b4b687e31a4b9b5a27b602fdfa97aff2d941ca/browser/components/aiwindow/ui/test/browser/head.js#980

See Also: → 1859188
Depends on: 2031648
Blocks: 2030904

withServer used to leave openAIEngine.build unstubbed, so background
async chains kicked off by submitChatMessage (notably #addConversationTitle
-> openAIEngine.build("title_generation", ...)) would hang indefinitely
in test environments without RemoteSettings data, pinning the AIWindow's
content nsGlobalWindowInner past CC/GC.

Fold withServer into stubEngineNetworkBoundaries (with "chat" passthrough)
so callers get the same network-boundary stubbing without changing shape,
and plumb the resulting buildStub through the withServer task callback so
existing tests that wanted to inspect openAIEngine.build calls can do so
through the helper's stub instead of installing their own sb.spy (which
would collide with the stub the helper now installs).

Assignee: nobody → ryanvm
Status: NEW → ASSIGNED
Attachment #9576020 - Attachment is obsolete: true
Assignee: ryanvm → nobody
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: