Repository navigation
Closed
Labels
2-0-xblocked/upstream ❌Blocked on upstream; e.g. Chromium or Nodebug 🪲component/node-integrationplatform/macOS
Description
- Electron version: Anything over 1.7.8, until the latest 1.8.2-beta.1
- Node: 8.8.0
- Operating system: high sierra
Going over 1.7.8 seems to break Electron for one of our projects. It's hard to track down what's going on but here's the output:
❯ yarn run electron
yarn run v1.2.1
$ electron .dev/electron.js
/Users/drcmda/dev/stepdoctor/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron[41928]: ../../vendor/node/src/async-wrap.cc:399:void node::SetupHooks(const FunctionCallbackInfo<v8::Value> &): Assertion `env->async_hooks_init_function().IsEmpty()' failed.
1: node::Abort() [/Users/drcmda/dev/stepdoctor/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
2: node::Assert(char const* const (*) [4]) [/Users/drcmda/dev/stepdoctor/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
3: node::AsyncWrap::Initialize(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>) [/Users/drcmda/dev/stepdoctor/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
4: v8::internal::StrDup(char const*) [/Users/drcmda/dev/stepdoctor/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
5: v8::internal::compiler::BranchElimination::ControlPathConditions::operator==(v8::internal::compiler::BranchElimination::ControlPathConditions const&) const [/Users/drcmda/dev/stepdoctor/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
6: v8::internal::compiler::BranchElimination::ControlPathConditions::operator==(v8::internal::compiler::BranchElimination::ControlPathConditions const&) const [/Users/drcmda/dev/stepdoctor/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
7: 0x3eadf51843fd
8: 0x3eadf527777c
9: 0x3eadf523be1c
✨ Done in 0.40s.
It happens when we require a file that has async/await calls in it, but nothing's yet executed. But the moment we go back to 1.7.8 it starts working again.
Reacted by Ezra Pagel, Marc Garreau, Ev, Ben Gotow, deepak342, Katie Huffman, hungdv, debelop13, Benjamin Pasero, Rakka Rage and 5 more
Metadata
Metadata
Assignees
Labels
2-0-xblocked/upstream ❌Blocked on upstream; e.g. Chromium or Nodebug 🪲component/node-integrationplatform/macOS
Activity
felixrieseberg commentedon Oct 25, 2017
Are you able to provide a repro? It would really help us track this down!
drcmda commentedon Oct 26, 2017
@felixrieseberg
and somewhere in electron.js (the startup file, for instance in the electron-quick-start):
That's enough to shoot it down. No code is actually executed, it just fetches the class which happens to have some async/await stuff in it.
thdtjsdn commentedon Oct 27, 2017
I have the same symptoms.
1.7.8 - No problems.
1.7.9 - I have not tested it.
1.8.1 beta - same error
1.8.2 beta.1 - same error
E:\GitHub_B2LiNK\Development-Binary-Windows\Binary\Electron\electron.exe: c:\projects\electron\vendor\node\src\async-wrap.cc:399: Assertion `env->async_hooks_init_function().IsEmpty()' failed.
require( "exceljs" ) -> error
It happens on Windows, Mac, and Linux.
wolovim commentedon Nov 17, 2017
Any workarounds or useful leads discovered yet? Same issue here, with or without babel in the stack.
gozzoo commentedon Nov 28, 2017
It happens on Windows 7 too.
remss commentedon Dec 6, 2017
Same error on 1.8.2 beta.3
bengotow commentedon Dec 21, 2017
I'm getting this in Mailspring when running anything newer than 1.7.8. Unfortunately I'm really not sure how to track it down because the stack trace doesn't reference any specific JS code or file.
bengotow commentedon Dec 22, 2017
Ok folks - I've made some headway here. Using an empty Electron project, I'm able to reproduce this by requiring
awv3-node/serveras noted above. To find exactly what source is crashing Node, I:Module._loadlogging the filename it's about to load.require('awv3-node/server'). The devtools logs a bunch of paths and then hits the assertion failure in the stack trace, but LLDB prevents it from exiting so I can read the console.logs.The file crashing the app is
/Users/bengotow/Work/F376/Projects/Podtastic/node_modules/natives/index.js. It looks like it's doing some /hella/ sketchy stuff. In the package description, it basically says it's can and will break your app when Node changes: https://www.npmjs.com/package/natives. Lovely.Rather than figure out what in this (actually very small) package has broken, I think the goal should be to remove it and whatever dependencies are doing such sketch stuff in the first place. In the case of
awv3-node, here's the full require path to natives (reading down roughly):Stepping through the execution of https://github.com/isaacs/natives/blob/master/index.js, (I just edited the source on disk and added a
debuggerline), it looks like it callsrunInThisContexton sources within NodeJS itself. When it callsrunInThisContextwithnm.filename=async_hooks.js, it retrieves the function, but when it executes it on line 109, the assertion failure occurs and Node crashes.13 remaining items
bpasero commentedon Apr 6, 2018
As @MarshallOfSound found out, this actually can reproduce also in node.js by code such as:
require('natives').require('child_process')So now I am actually less sure about wether this should be fixed in Electron or if this should be forwarded to node.js team :-/
tehnorm commentedon Apr 6, 2018
As a point of clarification, in our experience the root cause of this issue is something that was depending on the natives package.
This package is deprecated and contains warnings of its use. Right from the
nativesREADME:So. Doesn't seem to be electron's issue. Heck, this isn't even a node issue. Packages depending on the
nativesmodule, which is now deprecated and one could even argue - not be used in the first place are the issue.Note:
gulp v3.9.1has this issue. The solution for us was to upgrade togulp 4.bpasero commentedon Apr 9, 2018
I am thinking this should be fixed in node.js. No normal JS code execution should trigger a native crash that cannot be handled. For that reason there are runtime exceptions in JS that can be used.
bpasero commentedon Apr 10, 2018
As a workaround (thanks to @Tyriar) we will probably ship with this code to prevent access to the
nativesmodule which seems to be the main driver of this crash:kikill95 commentedon Apr 20, 2018
I have this error with electron v. 2.0.0-beta.7 and beta.8 - works fine on macos and bad on windows
kikill95 commentedon May 1, 2018
Hello, everyone, I have found that the problem was really inside native module. For me, I've changed Unzip2 package with unzipper package and this started to work. Also, I had gulp 3.9.1. I used this in [email protected]. It was really hard to find where is the problem, because my app used module that used another module that used this Unzip2.
Maybe this will help someone, but a lot of things and work with xls/xlsx files are related to this unzip2 module. In my case I just changed unzip2 with unzipper and this started to work!
Fix failing specs *and* Electron crashing
jarrodek commentedon Aug 31, 2018
I have this issue when trying to use https://www.npmjs.com/package/unzip library:
codebytere commentedon Aug 28, 2019
Closing as the root of this issue is not clearly with Electron itself.
feat(Cocoon): Add process patching utilities to prevent extension cra…