[cross-posting to stability]
TL;DR
We now leverage the Windows Error Reporting service to capture crashes
that elude our regular crash reporting machinery. nightly's crash rate
will go up in the coming days but just because we now know about those
crashes; so don't worry it's a good thing!
Longer version:
I discovered a way to leverage the API used to interact with the Windows
Error Reporting (WER) [1] service to intercept crashes that were eluding
our exception handler. This includes many forms of OOM crashes, issues
that badly corrupted the stack or heap, weird DLL injections and even
__fastfail() [2] crashes.
The implementation involves deploying a DLL with WER-specific hooks that
are called when Firefox crashes. We leverage the hooks to capture a
minidump of the crashed process, generate a minimal set of crash
annotations and launch the crash reporter client to notify the user.
This currently only supports parent process crashes. I'll add child
process interception in the coming weeks, progress can be tracked at bug
1682507 [3].
If you're curious you can find the various bits of the implementation
(in Rust) in bug 1682509 [4], bug 1682514 [5], bug 1682511 [6] and bug
1682516 [7]. Beware that it's doing hacky-wacky Windows things to
achieve its goal; don't expect elegant stuff :-P
Interestingly it seems that we're the first to be able to intercept
__fastfail() crashes. Looking for info on the topic I found posts,
tweets and even bugs on Chromium's tracker that unanimously mentioned it
couldn't be done. My guess is that Microsoft changed how the system
works since the last time someone tried.
Gabriele
[1]
https://docs.microsoft.com/en-us/windows/win32/api/_wer/
[2]
https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail
[3] Use the Windows Error Reporting API to generate minidumps for
crashes which cannot be caught using Breakpad
https://bugzilla.mozilla.org/show_bug.cgi?id=1682507
[4] Write a WER runtime exception module capable of writing out minidumps
https://bugzilla.mozilla.org/show_bug.cgi?id=1682509
[5] Register the WER runtime exception module at runtime
https://bugzilla.mozilla.org/show_bug.cgi?id=1682514
[6] Record the WER runtime exception module in the Windows registry
https://bugzilla.mozilla.org/show_bug.cgi?id=1682511
[7] Make the WER runtime exception module launch the crash reporter
client when the browser crashes
https://bugzilla.mozilla.org/show_bug.cgi?id=1682516