electron: Crash when node-ffi is required
Hi,
I’m trying to use node-ffi as dependency in the electron, but the require(‘ffi’) leads to crash. Please note I’m using v2 branch of node-ffi, as it has support for iojs 3.x and this is the branch from which the new version should be released in npm very soon. The v2 branch can be required (after successful build of course) without any issues in iojs 2.x, iojs 3.x, node 0.12.x, but it fails in electron. I’ve noticed you are using a fork of node and there are some changes in it, so I’ve tried using older electron version - 0.29.1.The ffi module is successfully required with it, so I’ve checked the differences in your node’s fork - the only one I see is this commit - could you share more details about it and could it cause the problem?
I’ve tried my app with electron 0.31.0 and 0.31.1, but without success. You can find a sample application that reproduces the issue here. After cloning it, just run installAndStart script with target and architecture paramters, for example:
./installAndStart.sh 0.31.0 x64
And the modules will be rebuild with correct headers. At the end the electron should start, but it just crashes.
I’ve tried rebuilding your node’s fork without the latest commit, but I’m not sure how to produce dll from it in order to replace it in my electron’s installation.
Could you check what’s causing this crash? I would have contacted node-ffi’s authors, but their version is working fine with real iojs, it looks like the latest commit in your iojs’s fork is causing the issue.
Thanks in advance for your help!
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 2
- Comments: 24 (14 by maintainers)
@rosen-vladimirov
Oh, I have missed it before. I can reproduce it too, it’s probably a bug of Electron.
We do need this commit for embedded blink allocator in node’s buffer. Because iojs reimplements node buffer in v0.3, and it starts to manage the memory of buffer, which conflicts with Blink’s behavior. It will cause electron to crash if we remove this commit.
Instead of rebuilding and replace the node library for electron-prebuilt v0.31, I suggest you to build the whole electron, because there is extra build-related work on the node library(e.g. change the path of libnode on OS X). The following steps are:
./script/bootstrap -d
./script/build -c D