Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix EthersDB deadlock #1089

Merged
merged 3 commits into from
Feb 21, 2024
Merged

Conversation

DoTheBestToGetTheBest
Copy link
Contributor

@DoTheBestToGetTheBest DoTheBestToGetTheBest commented Feb 14, 2024

related with #1056

actually removing the way we use futures::executor::block_on with tokio async

we're using now Handle::block_on instead of (futures::executor::block_on) so we can have futures executed in same context of tokio runtime and we can then avoid deadlocks

@rakita do you suggest me i allow unused crates to fix clippy error ?

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rakita rakita merged commit 0055d58 into bluealloy:main Feb 21, 2024
24 of 25 checks passed
@github-actions github-actions bot mentioned this pull request Feb 21, 2024
@rakita rakita mentioned this pull request Feb 21, 2024
@pawurb
Copy link
Contributor

pawurb commented Feb 21, 2024

Hi. I'm just starting to use this project. I was going through examples and this change seems to be breaking https://github.com/bluealloy/revm/blob/main/examples/fork_ref_transact.rs with following backtrace:

.cargo/git/checkouts/revm-bf744d8ffabcbad9/5736d1f/crates/revm/src/db/ethersdb.rs:27:18:
Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:72:14
   2: tokio::runtime::context::runtime::enter_runtime
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/context/runtime.rs:68:5
   3: tokio::runtime::handle::Handle::block_on
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/handle.rs:309:9
   4: revm::db::ethersdb::EthersDB<M>::new
             at /Users/pablo/.cargo/git/checkouts/revm-bf744d8ffabcbad9/5736d1f/crates/revm/src/db/ethersdb.rs:26:40
   5: fork_ref_transact::main::{{closure}}
             at ./src/main.rs:49:24
   6: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/park.rs:281:63
   7: tokio::runtime::coop::with_budget
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/coop.rs:107:5
   8: tokio::runtime::coop::budget
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/coop.rs:73:5
   9: tokio::runtime::park::CachedParkThread::block_on
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/park.rs:281:31
  10: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/context/blocking.rs:66:9
  11: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/scheduler/multi_thread/mod.rs:87:13
  12: tokio::runtime::context::runtime::enter_runtime
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/context/runtime.rs:65:16
  13: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
  14: tokio::runtime::runtime::Runtime::block_on
             at /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/runtime.rs:350:45
  15: fork_ref_transact::main
             at ./src/main.rs:106:5
  16: core::ops::function::FnOnce::call_once
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/ops/function.rs:250:5

rakita added a commit that referenced this pull request Feb 21, 2024
rakita added a commit that referenced this pull request Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants