Each browser window with the custom titlebar leaks ~20 GDI objects through the Windows App SDK title bar, until the process hits the GDI quota
Categories
(Core :: Widget: Win32, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox163 | --- | fixed |
People
(Reporter: florian, Assigned: florian)
References
(Regressed 1 open bug)
Details
Attachments
(1 external file)
On Windows 11, every browser window that uses the custom titlebar leaves about 20 GDI objects behind in the parent process when it is closed: about 10 memory DCs and 10 32-bpp DIB sections. nsWindow::SetCustomTitlebar calls WindowsUIUtils::SetIsTitlebarCollapsed(mWnd, true), which makes the Windows App SDK extend its title bar into the client area, and nsWindow::Destroy never undoes it. The objects survive DestroyWindow and memory minimization. They aren't created by Firefox code: hooks on the GDI syscalls of the parent's main thread, with native stacks, see none of them.
Windows allows 10,000 GDI objects per process. A session that opens about 500 windows reaches the limit, and the parent dies with exit code 0xE0464645 (a fail-fast, so no crash report). That is what happens to the aiwindow browser-chrome tests on the Windows 11 25H2 shippable repeat jobs: browser_smartwindow_switcher_telemetry.js and browser_sidebar_aiwindow.js are the tests running when the limit is reached.
On try, windows with the native titlebar or with widget.windows.windowsappsdk.enabled=false don't leak. Resetting the SDK title bar (SetIsTitlebarCollapsed(mWnd, false), i.e. ResetToDefault) before DestroyWindow brings the leak from 20 per window to 0. The patch does that in nsWindow::Destroy.
| Assignee | ||
Comment 1•4 days ago
|
||
Comment 3•3 days ago
|
||
Backed out for causing media related failures.
Backout link: https://hg.mozilla.org/integration/autoland/rev/01c9bd96fe07
Failure log: https://treeherder.mozilla.org/logviewer?job_id=609343102&repo=autoland&task=JylQs8dDRi6tIGSvUpllmQ.0&lineNumber=3112
Comment 5•3 days ago
|
||
| bugherder | ||
Comment 6•2 days ago
|
||
Is there a realistic scenario for users hitting this in the wild, or is it mainly something long test runs run into? For example, is the fail-fast crash in bug 2000475 this leak?
| Assignee | ||
Comment 7•2 days ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #6)
Is there a realistic scenario for users hitting this in the wild
It crashes when opening the ~500th browser window with tabs in the title bar. So maybe some users with very long sessions opening and closing multiple windows a day? It doesn't explain bug 2000475.
Description
•