Repository navigation
fix: don't allocate crash keys inside the v8 oom callback - #52723
Merged
MarshallOfSound merged 6 commits intoAug 9, 2026
Conversation
V8OOMErrorCallback records five electron.v8-oom.* crash keys through electron::crash_keys::SetCrashKey, which grows two std::deques and builds std::strings - allocation inside V8's out-of-memory handler, which can also fire on a V8 worker thread. In crash reports this shows up as the process dying inside SetCrashKey instead of at OOM_CRASH(), losing the OOM signature the keys were meant to record. Use statically registered fixed-storage crash_reporter::CrashKeyStrings and format the heap stats into a stack buffer with base::strings::SafeSPrintf, so nothing on the OOM path allocates. Co-authored-by: Shelley Vohr <[email protected]>
V8OOMErrorCallback recorded its electron.v8-oom.* keys through electron::crash_keys::SetCrashKey, whose registry grows two std::deques and is written from whichever thread reports the OOM, so a V8 worker thread races the main thread inside SetCrashKey. The renderer's near-heap-limit callback writes the same key names through the same registry from every isolate that registers it, so the race is cross-thread even without the OOM callback, and fixed keys added only to the OOM path would duplicate its annotations. Give the whole electron.v8-oom.* set one owner (statically registered crash_reporter::CrashKeyString storage in shell/common/v8_oom_diagnostics) shared by both callbacks, with an atomic first claim: the first isolate to hit an OOM records its diagnostics and later isolates return without writing, so concurrent OOMs cannot interleave and worker diagnostics are kept. The SetCrashKey path is removed from both call sites. Co-authored-by: Shelley Vohr <[email protected]>
Co-authored-by: Shelley Vohr <[email protected]>
Co-authored-by: Shelley Vohr <[email protected]>
Co-authored-by: Shelley Vohr <[email protected]>
Co-authored-by: Shelley Vohr <[email protected]>
3 tasks done
MarshallOfSound
approved these changes
Aug 9, 2026
MarshallOfSound
deleted the
trop/42-x-y-bp-fix-don-t-allocate-crash-keys-inside-the-v8-oom-callback-1786244714124
branch
August 9, 2026 08:09
|
Release Notes Persisted
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #52591
See that PR for details.
Notes: Fixed an issue where a JavaScript out-of-memory crash could be reported from inside the crash-key handler instead of at the out-of-memory site.