dapphub / dapptools

Dapp, Seth, Hevm, and more
https://dapp.tools
2.1k stars 325 forks source link

hevm: Segmentation fault when running tests with dapptools 0.48.0 and master #747

Closed naszam closed 3 years ago

naszam commented 3 years ago

When running tests with either the last dapptools version 0.48.0 or master (via duppgrade), I get the following using an alchemy rpc url:

Running 17 tests for src/DssSpell.t.sol:DssSpellTest
/nix/store/bknss8mgr3g292xlj73ncwxkjdn07cbm-dapp-0.34.0/libexec/dapp/dapp-test: line 59: 105432 Segmentation fault      (core dumped) hevm dapp-test --dapp-root="${DAPP_ROOT}" --json-file="${DAPP_JSON}" ${opts[@]}
make: *** [Makefile:6: test] Error 139

Switching to 0.46.0 works

d-xo commented 3 years ago

Thanks for the report! Can you give a link to a repo where we can reproduce this issue?

naszam commented 3 years ago

repo: https://github.com/makerdao/spells-mainnet/pull/179

brianmcmichael commented 3 years ago

For color, I'll add that this is transient. @naszam and another member of the team were getting consistent segfault errors, but I was using 0.48.0 against a local geth node and didn't get these errors against the same code. Perhaps there's something system-related going on here.

transmissions11 commented 3 years ago

i've seen segfaults opening the debugger sometimes, usually goes away after just trying again tho

transmissions11 commented 3 years ago

also pretty cool that y'all are using duppgrade hehe

kmbarry1 commented 3 years ago

I'm hitting this too, on the current master of dss-charter (1f309d80078e186504cd4150bd731714d226e39d): https://github.com/makerdao/dss-charter

Running 3 tests for src/test/ProxyManagerClipper-integration.t.sol:ProxyManagerClipperIntegrationTest
/nix/store/0g5glbq80jlqivddgv6hjqxyky93l6q7-dapp-0.34.0/libexec/dapp/dapp-test: line 56: 10207 Segmentation fault      (core dumped) hevm dapp-test --dapp-root="${DAPP_ROOT}" --json-file="${DAPP_JSON}" ${opts[@]}

(error is persistent for me...seems to be related to tests that make RPC calls...I'm using Alchemy as my node provider at the moment)

kmbarry1 commented 3 years ago

Update: repros if I use an Infura endpoint as well.

MrChico commented 3 years ago

This is likely a GHC bug. There shouldn't be any way a haskell can segfault unless you're doing some crazy unsafePerformIO, which we don't. The fact that it is mostly triggered with RPC calls and started happening recently makes me think that it might stem from this optimization https://github.com/dapphub/dapptools/commit/f9f5b509ffa40381764313bf5f892068a53174d7

MrChico commented 3 years ago

I made a branch revertopti, which in case it passes ci I would encourage you to try out and see if it solves these crashes https://github.com/dapphub/dapptools/compare/revertopti

naszam commented 3 years ago

Just tried using the branch revertopti and the path dapptools/src/dapp/bin/dapp and it seems to work with two different rpc urls (Tests PASS).

MrChico commented 3 years ago

great. Also for you @kmbarry1 ?

brianmcmichael commented 3 years ago

I tested revertopti also and can confirm that it doesn't appear to introduce any regression errors.

MrChico commented 3 years ago

Ok. Merged revertopti. Please reopen if the problem persists on master