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

[Bug]: Unable To Use Heimdall From Asynchronous Contexts #71

Closed
2 tasks done
bonedaddy opened this issue Feb 26, 2023 · 5 comments · Fixed by #151
Closed
2 tasks done

[Bug]: Unable To Use Heimdall From Asynchronous Contexts #71

bonedaddy opened this issue Feb 26, 2023 · 5 comments · Fixed by #151
Assignees

Comments

@bonedaddy
Copy link

Component

Decompile Library

Version

master, revision 6e6f051e373f7c098ee55c3eab70acc24cb77fa8

Please check the following

  • This is not a duplicate issue
  • I have checked the wiki and tried troubleshooting the issue

Operating System

Linux

Command used to produce the issue

Using decode_calldata(tx.input.clone().encode_hex())

Describe the issue you are facing

Usage within an asynchronous context results in the following error

thread '<unnamed>' panicked at 'Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.', /home/solidity/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/blocking/shutdown.rs:51:21
@bonedaddy
Copy link
Author

Looks like the issue is due to the usage of blocking reqwest.

@Jon-Becker
Copy link
Owner

I'll take a look today

@Jon-Becker Jon-Becker self-assigned this Feb 26, 2023
@bonedaddy
Copy link
Author

bonedaddy commented Feb 27, 2023

@Jon-Becker unfortunately it doesn't look like a necessarily "simple" solution depending on what the desired solution is.

For my personal use case, simply changing the get_json_from_url function to usage of the async reqwest client was enough, but it required changing a large portion of the codebase to work with the new async function.

Changes are here if you are interested in taking a look https://github.com/bonedaddy/heimdall-rs/tree/feat/async

@Jon-Becker
Copy link
Owner

This looks to be minimal effort for a necessary solution. I'll handle this as soon as I have time <3

Thank you so much!

@bonedaddy
Copy link
Author

bonedaddy commented Sep 21, 2023

Actually I was able to find a work around by calling the decoding function like so:

tokio::task::spawn_blocking::<_, _>(move || {
                                        // decode
                                    }).await;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants