foundry: Possible deadlock introduced in `anvil >= 1.1.0`
Component
Anvil
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
No response
What version of Foundryup are you on?
No response
What command(s) is the bug in?
No response
Operating System
None
Describe the bug
We are using anvil for e2e tests. Most of the tests use an empty testnet (i.e. default anvil) but some rely on a forked network (i.e. --fork-url <URL>). Our forked e2e tests started failing with v1.1.0 but worked fine with v1.0.0. The tests using empty testnets don’t seem to be affected by the switch to the new version.
Unfortunately the errors always happen in CI but so far never when I ran the tests locally which makes debugging this more difficult. From what I can tell it seems like anvil can get stuck (perhaps a deadlock?) after receiving a evm_mine request (presumably only for forked setups).
This also looks like a race condition. When I ran anvil with RUST_LOG=debug which introduces some overhead due to excessive logging the issue happened less often.
Please see this PR for some more context of the investigation.
Given that this is probably a PITA to debug because reproducing this locally wasn’t possible so far I could use our CI to do a git bisect to hopefully find the culprit. Please let me know if this is necessary since this will be quite time consuming.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 33 (17 by maintainers)
oh I have an idea what this could be
I reran our flaky test suite and now it’s remarkably stable using nightly. It ran the test test suite ~100 times (across 5 CI jobs) and failed 3 times. Previously it failed every couple of runs.
@MartinquaXD Can you try adding
--no-storage-caching? I’ve been experiencing a similar issue (also e2e tests), and adding--no-storage-cachingworks for me. Obviously this is not ideal, but at least it would give the foundry team more pointers 😃The fix looks good. All our forked e2e tests ran 10 times without any errors. 🥳 Will this fix stay in nightly only or will there be a
v.1.1.1so we can switch back to the stable toolchain?@MartinquaXD be aware that latest nightlies are now on updated revm version and, while anvil logic was not changed, there’s possibility of regression due to migration. Please let us know should you see any, thank you! Cc @zerosnacks
fixed with #10471
we plan to cut v1.2.0 release candidate on Monday, we’re discussing if we should v1.1.1 too
Still looks like 03-19 is the culprit. All the 03-18 builds are working.
Yeah, can check the releases between, too.
Only http.
Not sure if this makes sense but the first release that consistently fails is this. It only only bumps a minor version of a dependency, though. The 2 versions with actual changes before that both work consistently (03-12, 03-14).
Seems like the change in that PR is only targeting
forgewhich I suspect is completely separate fromanvilso perhaps this also bumps some shared sub dependencies in the process which are the root cause here. 🤷♂hmm,
could you perhaps try to repro this with https://github.com/foundry-rs/foundry/commit/dc69097e7d355c991996068bef861354dc72cc55
and if unable to repro maybe with https://github.com/foundry-rs/foundry/commit/f474801c4ead0542f7d7bf6f6499fb3ebac3c6fe
which could be the culprit