Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version: 3.1.9
- Operating System: macOS
- Last Known Working Electron version: 2.0.18
Expected Behavior
Creating a Promise within a mksnapshot startup script is not allowed.
Actual Behavior
Creating a Promise is allowed because the version of mksnapshot released with Electron 3.x uses the mksnapshot binary inside of the ffmpeg folder in libchromiumcontent. The static library and ffmpeg have a different set of flags, and specifically the latter doesn't use v8_promise_internal_field_count=1, which is known to cause issues in Node (see nodejs/node#13242 and electron/libchromiumcontent#363).
Creating a snapshot without such flag causes Electron to segfault under certain circumstances (see below). This was being surfaced in Atom with the process randomly crashing when calling back into JavaScript after the event loop woke up.
To Reproduce
- Clone
electron-quick-start - Download
mksnapshotfrom Electron 3.1.9 - Generate an empty snapshot with
mksnapshot --startup_blob=snapshot_blob.bin - Run
v8_context_snapshot_generator --output_file="./v8_context_snapshot.bin" - Copy the generated
.binfiles intoElectron.app/Contents/Frameworks/Electron\ Framework.framework/Resources/snapshot_blob.bin - Run electron-quick-start via
npm start
Then, either:
- In the DevTools, run
require('domain').create() - Click anywhere in the page content
- 💥
Or:
- In the DevTools, run:
async_hooks = require('async_hooks'); hook = async_hooks.create({init: function() {}}) hook.enable()
- Click anywhere in the page content
- 💥
Additional Information
Please, note that this issue does not exist anymore on Electron 5, as the build system has been revamped and ffmpeg and the static library now share a much more similar set of flags.
As for Electron 3.x, I think ffmpeg (and therefore the mksnapshot binary that it generates) should be compiled with v8_promise_internal_field_count=1, as the static library does. Perhaps, we can use the mksnapshot binary that gets generated within static_library while building libchromiumcontent and not change ffmpeg's build parameters. @jkleinsc and I have already chatted about this and, either way, we think we can release a hotfix after packaging the proper mksnapshot binary.
Activity
Don't create a promise when preloading package settings in snapshot
Don't create a promise when preloading package settings in snapshot
as-cii commentedon May 30, 2019
This has been fixed as of Electron 3.1.10. Thanks! ✨