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:
git clone https://github.com/trufflesuite/ganache-core.git
cd ganache-core
git checkout 8a4fb09c970d2ded061c1b1e1fd912cd7ae0229a
nvm use 14
npm ci
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:
git checkout c26ba24ebf24d1c09b328a76baf0cf43e82fba04
npm ci (if you are using npm 7.0.0-rc.0 you'll need to also run npm run postinstall)
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.
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:
git clone https://github.com/trufflesuite/ganache-core.gitcd ganache-coregit checkout 8a4fb09c970d2ded061c1b1e1fd912cd7ae0229anvm use 14npm cinpm test(you may have to run this many times until you trigger the segfault)You should see something like:
(The debug log isn't helpful)
I've somewhat "fixed" this in
ganache-coreby patchingkeccakso it never loads the native modules.To reproduce my workaround:
git checkout c26ba24ebf24d1c09b328a76baf0cf43e82fba04npm ci(if you are using npm 7.0.0-rc.0 you'll need to also runnpm run postinstall)npm test(run it as many times as you'd like; it doesn't crash anymore... I ran the tests for over an hour viawhile npm test; do :; donewithout 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-packageisn'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
nycfrom thetestcommand reduces the likelihood of the crash, however, it does still occur when running withmochaonly.