Skip to content

Package sometimes causes segfaults on Node v14 #19

@davidmurdoch

Description

@davidmurdoch

I'm sorry my reproduction steps are so horrible... but I just haven't been able to figure out how to reliably trigger the error.

To reproduce:

  1. git clone https://github.com/trufflesuite/ganache-core.git
  2. cd ganache-core
  3. git checkout 8a4fb09c970d2ded061c1b1e1fd912cd7ae0229a
  4. nvm use 14
  5. npm ci
  6. npm test (you may have to run this many times until you trigger the segfault)

You should see something like:

Segmentation fault (core dumped)
npm ERR! code 139
npm ERR! path /home/david/work/ganache-core
npm ERR! command failed
npm ERR! command sh -c mocha --check-leaks --recursive "./test/local"

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/david/.npm/_logs/2020-10-07T15_21_43_948Z-debug.log

(The debug log isn't helpful)

I've somewhat "fixed" this in ganache-core by patching keccak so it never loads the native modules.

To reproduce my workaround:

  1. git checkout c26ba24ebf24d1c09b328a76baf0cf43e82fba04
  2. npm ci (if you are using npm 7.0.0-rc.0 you'll need to also run npm run postinstall)
  3. npm test (run it as many times as you'd like; it doesn't crash anymore... I ran the tests for over an hour via while npm test; do :; done without a crash)

Here is the patch, if you're curious: https://github.com/trufflesuite/ganache-core/blob/c26ba24ebf24d1c09b328a76baf0cf43e82fba04/patches/keccak%2B3.0.1.patch#L1-L11

The biggest issue with my workaround is that patch-package isn't safe to use in published npm modules. :-(

I've also opened this issue in ethereum-cryptography because I figured it might be faster/easier to update that package to do something like const keccak = require("keccack/js"); (untested) than it would be to figure out the fix in this package's native code.

Note: removing nyc from the test command reduces the likelihood of the crash, however, it does still occur when running with mocha only.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions