You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had started working on the code I wrote involving prometheus sometime back. At that time the push function worked fine but now the code panics. The output of panic is:
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.', /Users/phoenix/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/shutdown.rs:49:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-11-14 08:42:05,631 TRACE [mio::sys::unix::kqueue] registering; token=Token(18446744073709551615); interests=Readable
2020-11-14 08:42:05,631 TRACE [mio::poll] registering with poller
2020-11-14 08:42:05,631 TRACE [reqwest::blocking::client] (ThreadId(12)) start runtime::block_on
Debugging
The last line made me figure out that rust-prometheus is using the blocking reqwest client. I was using the #[tokio::main] attribute to make the main() fn async. I believe using this and the blocking reqwest client causes this issue. Maybe the TRACE shows that is tries to use runtime::block_on which inside #[tokio::main] calls shutdown in tokio which has this panic line.
Would allowing the user to choose b/w blocking & non-blocking client solve this issue?
The text was updated successfully, but these errors were encountered:
Problem
I had started working on the code I wrote involving prometheus sometime back. At that time the push function worked fine but now the code panics. The output of panic is:
Debugging
The last line made me figure out that
rust-prometheus
is using the blocking reqwest client. I was using the#[tokio::main]
attribute to make themain()
fn async. I believe using this and the blocking reqwest client causes this issue. Maybe theTRACE
shows that is tries to useruntime::block_on
which inside#[tokio::main]
callsshutdown
in tokio which has this panic line.Would allowing the user to choose b/w blocking & non-blocking client solve this issue?
The text was updated successfully, but these errors were encountered: