Closed Bug 1862705 Opened 3 years ago Closed 1 year ago

Crash in [@ mozilla::GlobalStyleSheetCache::LoadSheetFromSharedMemory]

Categories

(Core :: Layout, defect)

Unspecified
Android
defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox-esr115 --- unaffected
firefox119 --- unaffected
firefox120 --- unaffected
firefox121 --- wontfix
firefox122 --- wontfix
firefox123 --- wontfix
firefox124 --- affected

People

(Reporter: cpeterson, Unassigned)

Details

(Keywords: crash)

Crash Data

This might be a regression in 121. There are 45 crash reports from 2 installs of Firefox Android build ID 20231031093058.

Crash report: https://crash-stats.mozilla.org/report/index/c1f8dbe3-303c-4162-bbca-cde4c0231102

MOZ_CRASH Reason: MOZ_DIAGNOSTIC_ASSERT(false) (NS_SUCCEEDED(NS_NewURI(getter_AddRefs(uri), aURL)))

https://searchfox.org/mozilla-central/rev/11d085b63cf74b35737d9c036be80434883dd3f6/layout/style/GlobalStyleSheetCache.cpp#290

Top 10 frames of crashing thread:

0  libxul.so  mozilla::GlobalStyleSheetCache::LoadSheetFromSharedMemory  layout/style/GlobalStyleSheetCache.cpp:290
1  libxul.so  mozilla::GlobalStyleSheetCache::GlobalStyleSheetCache  layout/style/UserAgentStyleSheetList.h:23
1  libxul.so  mozilla::GlobalStyleSheetCache::Singleton  layout/style/GlobalStyleSheetCache.cpp:429
2  libxul.so  mozilla::dom::Document::FillStyleSetUserAndUASheets  dom/base/Document.cpp:3144
2  libxul.so  mozilla::dom::Document::FillStyleSet  dom/base/Document.cpp:3201
2  libxul.so  mozilla::dom::Document::CreatePresShell  dom/base/Document.cpp:6952
3  libxul.so  nsDocumentViewer::InitPresentationStuff  layout/base/nsDocumentViewer.cpp:702
4  libxul.so  nsDocumentViewer::InitInternal  layout/base/nsDocumentViewer.cpp:909
5  libxul.so  nsDocShell::SetupNewViewer  docshell/base/nsDocShell.cpp:8129
5  libxul.so  nsDocShell::Embed  docshell/base/nsDocShell.cpp:5603

The bug is linked to a topcrash signature, which matches the following criterion:

  • Top 10 AArch64 and ARM crashes on nightly

For more information, please visit BugBot documentation.

Keywords: topcrash
Flags: needinfo?(emilio)

So the only thing I can reasonably think about is a corrupted omnijar of sorts. It's just failing to parse a resource:// URI from our UA stylesheets.

Without the UA stylesheets we can't really continue. We could build them into the binary or something I guess, but...

Flags: needinfo?(emilio) → needinfo?(cpeterson)
Severity: -- → S3

Thanks for looking. Let's wait to see if these crashes continue or if they're from just a few users with corrupted installs. We have 104 crash reports from 8 Nightly installs so far, which is pretty low volume for a "top crash".

Flags: needinfo?(cpeterson)

(In reply to Chris Peterson [:cpeterson] from comment #3)

Thanks for looking. Let's wait to see if these crashes continue or if they're from just a few users with corrupted installs.

Looks like this continues to just be from a few presumably-corrupted installs. This past week we have 68 crashes, coming from only 3 installations, for example.

The pattern continues; the past week has 88 crashes, from 4 installs (60 of them from a single install).

cpeterson, what do you think we should do with this?

(In a perfect world we could detect this and toggle a redownload of omnijar or something, but that's probably nontrivial and not robust, and might re-break depending on the source of the corruption, e.g. flaky memory/disk. And maybe every update is effectively a redownload of omnijar anyway?)

Flags: needinfo?(cpeterson)

Is the omnijar unpacked at first run after install and updates?

Looks like we have crash reports from many different device models, so this is more than just a couple users with "bad hardware". I wonder why we never saw these GlobalStyleSheetCache::LoadSheetFromSharedMemory() crashes before version 121.0a1. The function name GlobalStyleSheetCache::LoadSheetFromSharedMemory has existed since 2019, so maybe there was an omnijar corruption regression in 121?

The earliest crash report is from build ID 20231122095244 (2023-11-22), followed by crashes from build IDs from every subsequent day: 2023-11-23, 2023-11-24, 2023-11-25, 2023-11-26, and then the reports start skipping a couple days. So if this is a code regression, there is a good chance it landed on 2023-11-20 or 2023-11-21. Someone should review the Gecko and Fenix commit logs for those dates.

Flags: needinfo?(cpeterson) → needinfo?(dholbert)

(In reply to Chris Peterson [:cpeterson] from comment #6)

Is the omnijar unpacked at first run after install and updates?

Per slack, sounds like this file isn't exactly unpacked, and it's under the control of Android, since it's part of the APK, I think. (which means we can't just redownload it on our own)

nalexander mentioned a known old-ish race condition with omnijar reading, but it's not clear if this hypothetical omnijar corruption might be connected to that or not.

if this is a code regression, there is a good chance it landed on 2023-11-20 or 2023-11-21. Someone should review the Gecko and Fenix commit logs for those dates.

I can't personally commit to being that "someone" and doing a thorough commit-log audit at the moment, but I did take a quick look. Here's the pushlog from 11/19 through 11/22, being a bit broader with the ends of the possible guilty-range (in part because I'm not 100% certain about how the hg.m.o pushlog-query-timezones match against build ID timzeone; I think hg.m.o URLs like the one below use UTC, whereas the build ID is probably PST):

https://hg.mozilla.org/mozilla-central/pushloghtml?startdate=2023-11-19&enddate=2023-11-23

I don't see anything obviously omnijar-related in there, but I do see one commit possibly related to the assert itself in there: bug 1863874, "Don't set the relevant global on stylesheets until sheet is complete" (commit here)

Emilio, is it conceivable that bug 1863874 could've made this LoadSheetFromSharedMemory assertion start firing somehow?

(I do see that we had to paper over a diffferent assertion failure as part of that bug, so I wonder if this one might have some tangential connection to an invariant that bug 1863874 tickled too.

Flags: needinfo?(dholbert) → needinfo?(emilio)

No, because UA sheets never have, never will have associated globals.

Flags: needinfo?(emilio)

(In reply to Daniel Holbert [:dholbert] from comment #7)

nalexander mentioned a known old-ish race condition with omnijar reading, but it's not clear if this hypothetical omnijar corruption might be connected to that or not.

That omnijar-reading issue is discussed in bug 1675823 comment 19 (and its dependencies), and bug 1639821 comment 97, among other places.

One shot-in-the-dark explanation for why-we-just-started-tripping-this-particular-assertion: maybe there was a subtle change in the contents of omni.ja (a change to size/ordering/included-files somewhere), caused by some benign commit in the pushlog, and that was sufficient to move these UA stylesheets "out of reach" in scenarios where we've got corruption?

Based on the topcrash criteria, the crash signature linked to this bug is not a topcrash signature anymore.

For more information, please visit BugBot documentation.

Keywords: topcrash

Closing because no crashes reported for 12 weeks.

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