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

Cannot drop a runtime in a context where blocking is not allowed when initial consul in rust #65

Open
jiangxiaoqiang opened this issue Aug 28, 2021 · 1 comment

Comments

@jiangxiaoqiang
Copy link

I tried to regitstry my rust app into consul using consul rust, first I add dependencies in Cargo.toml:

consul = "0.4.2"

this is my rust code tried to registry app into consul look like:

#[launch]
fn rocket() -> _ {
    let config = Config::new_from_env().unwrap();


}

then I added the env config into .env file in the root of my project:

CONSUL_HTTP_ADDR=consul-1630121482-headless.reddwarf-pro.svc.cluster.local:8500
CONSUL_HTTP_TOKEN="a"

finnaly I start the app using cargo run, shows error like this:

thread 'main' 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.', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.10.1/src/runtime/blocking/shutdown.rs:51:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

what should I do fix this problem?

@jmgilman
Copy link

This issue is a little old - but the problem is this crate is synchronous and tokio is complaining that you're attempting to call a synchronous (blocking) piece of code in an asynchronous context.

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

No branches or pull requests

2 participants