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

Error: thread 'tokio-runtime-worker' panicked at 'not currently running on the Tokio runtime.' #131

Closed
alebcay opened this issue Feb 2, 2021 · 9 comments

Comments

@alebcay
Copy link

alebcay commented Feb 2, 2021

I encountered this panic initially in GitHub Actions (someone else has ran into this and has filed lycheeverse/lychee-action#4), but I have been able to reproduce this error in my local environment myself (lychee 0.5.0), so I'm opening this issue here.

Here is the backtrace:

thread 'tokio-runtime-worker' panicked at 'not currently running on the Tokio runtime.', /Users/caleb/Library/Caches/Homebrew/cargo_cache/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/handle.rs:118:28
stack backtrace:
   0:        0x10ebd047e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3b6ed74a60c4de30
   1:        0x10ec06c0e - core::fmt::write::h72dd6ddbc116ef3c
   2:        0x10ebcf86a - std::io::Write::write_fmt::h033803ce14d847cc
   3:        0x10ebe4639 - std::panicking::default_hook::{{closure}}::h040276b51a1a4749
   4:        0x10ebe435e - std::panicking::default_hook::h2a43ed83163cecb9
   5:        0x10ebe4bca - std::panicking::rust_panic_with_hook::h15f3dba6c099e04e
   6:        0x10ebd0b35 - std::panicking::begin_panic_handler::{{closure}}::h33fb39231ad9a88d
   7:        0x10ebd05f8 - std::sys_common::backtrace::__rust_end_short_backtrace::hd5ec6f84e4df1d34
   8:        0x10ebe4743 - _rust_begin_unwind
   9:        0x10ec2518f - core::panicking::panic_fmt::h7889f3b8e7c118f7
  10:        0x10ec24c5a - core::option::expect_failed::h5fe3576924a3bde2
  11:        0x10ea80ed4 - tokio::runtime::handle::Handle::current::h89cdd643080c74fa
  12:        0x10e969927 - tokio::runtime::blocking::pool::spawn_blocking::h1a37cd83de30f186
  13:        0x10e979d28 - <hyper::client::connect::dns::GaiResolver as tower_service::Service<hyper::client::connect::dns::Name>>::call::h61e571d51b6de036
  14:        0x10e8bd8c3 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h69dc60019f0f2088
  15:        0x10e8c49d1 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hdd28a6be8b7b5042
  16:        0x10e8b89c1 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h29531a238642b647
  17:        0x10e8c5d5b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hf9e83dde27a4801c
  18:        0x10e8b7195 - <hyper::service::oneshot::Oneshot<S,Req> as core::future::future::Future>::poll::h6f7b6ee34c74f84a
  19:        0x10e9345e9 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h70474202a53b3651
  20:        0x10e934941 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::ha14d54d9ca61ad28
  21:        0x10e8ff195 - <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::h587492a7f2201d74
  22:        0x10e8931e8 - <hyper::common::lazy::Lazy<F,R> as core::future::future::Future>::poll::hb1a677b7f21c70e0
  23:        0x10e932f9c - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h1776ff857ff61130
  24:        0x10e923beb - <futures_util::future::future::flatten::Flatten<Fut,<Fut as core::future::future::Future>::Output> as core::future::future::Future>::poll::hde9bd31e7767b2a1
  25:        0x10e936163 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::he6181a9c8bf8decf
  26:        0x10e8ff4fa - <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::h59a74d989a93a7f6
  27:        0x10e912dfb - <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h4e7335b26450df9d
  28:        0x10e96c656 - <hyper::client::ResponseFuture as core::future::future::Future>::poll::h92cb2c7ab9f8ecd9
  29:        0x10e916d74 - <reqwest::async_impl::client::PendingRequest as core::future::future::Future>::poll::h5ecc6d3415cf3506
  30:        0x10e916c87 - <reqwest::async_impl::client::Pending as core::future::future::Future>::poll::hb8d12fd76e64dbc8
  31:        0x10e819afb - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::hf64ca53c51c6012c
  32:        0x10e82742d - <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::h06472600e0d834db
  33:        0x10e8181c9 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h588738c9b92b7f0f
  34:        0x10e827f34 - <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::h8c9611ad63cec342
  35:        0x10e82af0e - <futures_util::future::try_future::AndThen<Fut1,Fut2,F> as core::future::future::Future>::poll::h618b0c2ebb4e0f8a
  36:        0x10e818704 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h71d1b9106303bf37
  37:        0x10e82aece - <futures_util::future::try_future::MapOk<Fut,F> as core::future::future::Future>::poll::h8686e11037584f66
  38:        0x10e53cdd8 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h4159be52d6d7d02a
  39:        0x10e5a6806 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h9e44a18f075958ea
  40:        0x10e5fa9f2 - tokio::runtime::task::harness::Harness<T,S>::poll::hb87397d6c8ae81a1
  41:        0x10ea8876f - std::thread::local::LocalKey<T>::with::hc7b3d1d25d224e3a
  42:        0x10eaa46cf - tokio::runtime::thread_pool::worker::Context::run_task::h29d701a9af81405d
  43:        0x10eaa3c03 - tokio::runtime::thread_pool::worker::Context::run::h88f812f18928c39b
  44:        0x10ea8ac05 - tokio::macros::scoped_tls::ScopedKey<T>::set::ha079f29468eb40d4
  45:        0x10eaa336d - tokio::runtime::thread_pool::worker::run::hb4225ff6226cfa1a
  46:        0x10eaa0f2f - tokio::runtime::task::core::Core<T,S>::poll::habdfb8e2a0dc1545
  47:        0x10eaa8916 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hc521d0629d24b295
  48:        0x10ea864a5 - tokio::runtime::task::harness::Harness<T,S>::poll::h1255d0013f67039a
  49:        0x10ea9bc08 - tokio::runtime::blocking::pool::Inner::run::h48447d92da9b7811
  50:        0x10ea88119 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd03a52f4a358aca2
  51:        0x10eaad455 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h42e03a1e69101f0f
  52:        0x10ebebf4b - std::sys::unix::thread::Thread::new::thread_start::hed7aa7efa61a9b35
  53:     0x7fff2033e950 - __pthread_start

(This particular trace repeats over and over again, presumably once per problematic link check attempt.)

Lychee was built with Rust 1.49.0 and is running on macOS 11.1 Big Sur (Intel). I was using a GITHUB_TOKEN. Please let me know if you need any further information about my environment, etc.

@mre
Copy link
Member

mre commented Feb 2, 2021

Don't have much time to look into this right away, but maybe I can note down some pointers for investigation.

Could be related to rust-lang/cargo#7169 and https://users.rust-lang.org/t/problem-tokyo-0-3-thread-main-panicked-at-not-currently-running-on-the-tokio-runtime-solved/50336/6. Perhaps a combination of it.

How did you install lychee? You could try with cargo install --locked lychee and see if you can reproduce the error.

@alebcay
Copy link
Author

alebcay commented Feb 2, 2021

I will try that. I installed it with the Homebrew formula I drafted (#59 (comment)). Homebrew's default for install Rust packages does include the --locked flag, though. I also got the same error with the lycheeverse/lychee Docker image, though (in the CI environment).

I will reinstall via cargo on my local environment and attempt to reproduce the issue.

@alebcay
Copy link
Author

alebcay commented Feb 2, 2021

Reproduced what appears to be the same error after installing with cargo install --locked lychee.

thread 'tokio-runtime-worker' panicked at 'not currently running on a Tokio 0.2.x runtime.', /Users/caleb/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/handle.rs:118:28
stack backtrace:
   0:        0x1041e147e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3b6ed74a60c4de30
   1:        0x104217c0e - core::fmt::write::h72dd6ddbc116ef3c
   2:        0x1041e086a - std::io::Write::write_fmt::h033803ce14d847cc
   3:        0x1041f5639 - std::panicking::default_hook::{{closure}}::h040276b51a1a4749
   4:        0x1041f535e - std::panicking::default_hook::h2a43ed83163cecb9
   5:        0x1041f5bca - std::panicking::rust_panic_with_hook::h15f3dba6c099e04e
   6:        0x1041e1b35 - std::panicking::begin_panic_handler::{{closure}}::h33fb39231ad9a88d
   7:        0x1041e15f8 - std::sys_common::backtrace::__rust_end_short_backtrace::hd5ec6f84e4df1d34
   8:        0x1041f5743 - _rust_begin_unwind
   9:        0x1042374cf - core::panicking::panic_fmt::h7889f3b8e7c118f7
  10:        0x104236f9a - core::option::expect_failed::h5fe3576924a3bde2
  11:        0x104092434 - tokio::runtime::handle::Handle::current::h216706fcbcf63904
  12:        0x103f6d407 - tokio::runtime::blocking::pool::spawn_blocking::h2d146bcf79ecdf18
  13:        0x103f7c468 - <hyper::client::connect::dns::GaiResolver as tower_service::Service<hyper::client::connect::dns::Name>>::call::h1917ce428ac86be7
  14:        0x103ec6c7d - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hb2097738f721f61c
  15:        0x103eb8bc1 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h51696f8b25e59603
  16:        0x103ec9411 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::he5d63aa5655e29df
  17:        0x103ec104b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::ha4ee0b75e2c1ddf6
  18:        0x103ee3815 - <hyper::service::oneshot::Oneshot<S,Req> as core::future::future::Future>::poll::h810cd1161d70494b
  19:        0x103ee625b - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::ha2e8adb512c51b9d
  20:        0x103ee5a01 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h883f7705d5f71433
  21:        0x103f063e5 - <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::h25eaf1ecd3d26ed2
  22:        0x103e9b2c7 - <hyper::common::lazy::Lazy<F,R> as core::future::future::Future>::poll::h4e9bf91b2fef42b8
  23:        0x103f43987 - <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll::h3a7910910919877c
  24:        0x103ee4d20 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h53b48e09d6ab22b4
  25:        0x103f2a5eb - <futures_util::future::future::flatten::Flatten<Fut,<Fut as core::future::future::Future>::Output> as core::future::future::Future>::poll::h112f3ada62b4956d
  26:        0x103ee4ecf - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h68c02630116bd5bd
  27:        0x103f06a5a - <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::hd3640ac557a51af0
  28:        0x103f0f43e - <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h0da954f21a6d4025
  29:        0x103f6eb26 - <hyper::client::ResponseFuture as core::future::future::Future>::poll::haa0ac74ad4f63e0e
  30:        0x103f1d8d4 - <reqwest::async_impl::client::PendingRequest as core::future::future::Future>::poll::h63730e53253e6c12
  31:        0x103f1d7e7 - <reqwest::async_impl::client::Pending as core::future::future::Future>::poll::hb7a88c115a44324d
  32:        0x103e1923d - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::hed93742da36222e3
  33:        0x103e28fad - <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::h61c2757e6a613c50
  34:        0x103e18a69 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::ha6d40c3b5e89da23
  35:        0x103e29ae4 - <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::ha8e9b5c5078e85e3
  36:        0x103e2c71e - <futures_util::future::try_future::AndThen<Fut1,Fut2,F> as core::future::future::Future>::poll::hf2a7d032f8d8eab2
  37:        0x103e17986 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h0fd8e55b735fc89e
  38:        0x103e2c6be - <futures_util::future::try_future::MapOk<Fut,F> as core::future::future::Future>::poll::hfe9236d0094aac22
  39:        0x103c04798 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::he1e2349355930b69
  40:        0x103b3c6e7 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::haa126138ad13af97
  41:        0x103b5f00b - tokio::runtime::task::harness::poll_future::h060ab60627dc058d
  42:        0x103b61edb - tokio::runtime::task::harness::Harness<T,S>::poll::h960027449862b4d4
  43:        0x10409a13f - std::thread::local::LocalKey<T>::with::hbd8f0f9f89bc211b
  44:        0x1040b8ebf - tokio::runtime::thread_pool::worker::Context::run_task::h8b5d67cd7e8bfda7
  45:        0x1040b8093 - tokio::runtime::thread_pool::worker::Context::run::h913dffb5128b81cc
  46:        0x1040af133 - tokio::macros::scoped_tls::ScopedKey<T>::set::h6dd542d8bd47eed3
  47:        0x1040b7b9d - tokio::runtime::thread_pool::worker::run::haa29f637ddc08d7c
  48:        0x1040c2faf - tokio::runtime::task::core::CoreStage<T>::poll::hcf2070e4e5c6638c
  49:        0x1040bea2d - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h521c6231f6c4c98c
  50:        0x1040ba9b9 - tokio::runtime::task::harness::Harness<T,S>::poll::h6308f2f762d85e78
  51:        0x1040ad5eb - std::sys_common::backtrace::__rust_begin_short_backtrace::h168919c8884614da
  52:        0x10409fe85 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h3721ef77e6ac5d88
  53:        0x1041fcf4b - std::sys::unix::thread::Thread::new::thread_start::hed7aa7efa61a9b35
  54:     0x7fff2033e950 - __pthread_start

@mre
Copy link
Member

mre commented Feb 2, 2021

Don't have much time to look into this right away, but maybe I can note down some pointers for investigation.

Could be related to rust-lang/cargo#7169 and https://users.rust-lang.org/t/problem-tokyo-0-3-thread-main-panicked-at-not-currently-running-on-the-tokio-runtime-solved/50336/6. Perhaps a combination of it.

How did you install lychee? You could try with cargo install --locked lychee and see if you can reproduce the error.

@pawroman
Copy link
Member

pawroman commented Feb 8, 2021

This is weird because the stacktrace comes from Tokio 0.2.x, while we have 1.x. It would be good to oust the old version.

I have analyzed the dependencies and it seems that the only lib using old reqwest version (which uses Tokio 0.2.x) is check-if-email-exists.

There's an open PR to bump the reqwest version on that lib's repo which should get us rid of Tokio 0.2.x: reacherhq/check-if-email-exists#829

@mre
Copy link
Member

mre commented Feb 8, 2021

Good shot. In the hope of solving the problem I sent a PR: reacherhq/check-if-email-exists#869. 🤞

@mre
Copy link
Member

mre commented Feb 9, 2021

New release is currently blocked on async-email/async-smtp#36. Without that we can't bump the version of check-if-email-exists (because async-smtp is a dependency) and that means we cannot publish a new version of lychee. (git repos are not allowed as dependencies for binaries published on crates.io.)

That said, we could create a lychee development branch for now and use that as the source for the lychee action. 🤔 If that's worth the effort largely depends on how long it takes until the upstream changes are merged.

@mre
Copy link
Member

mre commented Feb 12, 2021

The lastest master branch contains a fix. If you like to give it a try, you can

cargo install https://github.com/lycheeverse/lychee

As soon as the upstream version gets released we'll switch back to crates.io and make a new release ourselves.

@mre
Copy link
Member

mre commented Feb 17, 2021

Gonna go ahead and close this. Should be fixed in master.

@mre mre closed this as completed Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants