eigenein / my-iot-rs

Yet another home automation (alpha)
https://eigenein.github.io/my-iot-rs/html
MIT License
32 stars 5 forks source link

[Core] Critical error in async loop, the message bus stops #136

Closed eigenein closed 3 years ago

eigenein commented 3 years ago
Aug 17 12:59:23 my-iot my-iot[23634]: [INFO] (2) my_iot::core::bus: [ReadNonLogged] guest_room_humidity_high::tado::469375::1::humidity::high = Rh(60.4)
Aug 17 12:59:23 my-iot my-iot[23634]: [INFO] (2) my_iot::core::bus: [ReadNonLogged] guest_room_humidity_low::tado::469375::1::humidity::high = Rh(60.4)
Aug 17 12:59:23 my-iot my-iot[23634]: [INFO] (8) _: Response succeeded.
Aug 17 12:59:23 my-iot my-iot[23634]: thread 'async-std/runtime' panicked at 'cannot call `Executor::enter()` if already inside an `Executor`', /usr/local/cargo/registry/src/g
Aug 17 12:59:23 my-iot my-iot[23634]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Probably related to the script:

[services.notify_guest_room_humidity]
type = "Rhai"
sensor_pattern = "guest_room_humidity_(low|high)::tado::469375::1::humidity::(low|high)"
script = '''
    fn on_message(message) {
        telegram.send_message(
            -1001349838037,
            "πŸ’¦ " + message.value.inner + "% влаТности Π² гостСвой ΠΊΠΎΠΌΠ½Π°Ρ‚Π΅ @eigenein",
            #{},
        );
    }
'''
eigenein commented 3 years ago

Perhaps, nested block_ons: https://github.com/Licenser/nested-executors/blob/master/src/main.rs

eigenein commented 3 years ago
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
   7: async_executor::Executor::enter
   8: async_std::task::executor::run::{{closure}}::{{closure}}
   9: async_std::task::executor::enter::{{closure}}
  10: std::thread::local::LocalKey<T>::try_with
  11: std::thread::local::LocalKey<T>::with
  12: async_std::task::executor::enter
  13: async_std::task::executor::run::{{closure}}
  14: std::thread::local::LocalKey<T>::try_with
  15: std::thread::local::LocalKey<T>::with
  16: async_std::task::executor::run
  17: async_std::task::builder::Builder::blocking::{{closure}}::{{closure}}
  18: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
  19: std::thread::local::LocalKey<T>::try_with
  20: std::thread::local::LocalKey<T>::with
  21: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
  22: async_std::task::builder::Builder::blocking::{{closure}}
  23: std::thread::local::LocalKey<T>::try_with
  24: std::thread::local::LocalKey<T>::with
  25: async_std::task::builder::Builder::blocking
  26: async_std::task::block_on::block_on
  27: my_iot::services::rhai::telegram::register_functions::{{closure}}
  28: <rhai::engine::Engine as rhai::fn_register::RegisterResultFn<FN,(rhai::fn_register::Mut<S>,T,U,V)>>::register_result_fn::{{closure}}
  29: rhai::engine::Engine::call_fn_raw
  30: rhai::engine::Engine::exec_fn_call
  31: rhai::engine::Engine::call_method
  32: rhai::engine::Engine::eval_dot_index_chain_helper
  33: rhai::engine::Engine::eval_dot_index_chain
  34: rhai::engine::Engine::eval_expr
  35: rhai::engine::Engine::eval_stmt
  36: rhai::engine::Engine::call_script_fn
  37: rhai::api::<impl rhai::engine::Engine>::call_fn_dynamic_raw
  38: rhai::api::<impl rhai::engine::Engine>::call_fn
  39: my_iot::services::rhai::Rhai::spawn::{{closure}}
  40: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  41: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll::{{closure}}
  42: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
  43: std::thread::local::LocalKey<T>::try_with
  44: std::thread::local::LocalKey<T>::with
  45: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
  46: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll
  47: async_task::raw::RawTask<F,R,S,T>::run
  48: async_task::task::Task<T>::run
  49: multitask::Ticker::tick
  50: async_executor::Executor::run::{{closure}}
  51: scoped_tls::ScopedKey<T>::set
  52: async_executor::Executor::enter
  53: async_executor::Executor::run
  54: async_std::task::executor::run_global::{{closure}}
  55: tokio::runtime::context::enter
  56: tokio::runtime::handle::Handle::enter
  57: tokio::runtime::Runtime::enter
  58: async_std::task::executor::enter::{{closure}}
  59: std::thread::local::LocalKey<T>::try_with
  60: std::thread::local::LocalKey<T>::with
  61: async_std::task::executor::enter
  62: async_std::task::executor::run_global
  63: async_std::rt::RUNTIME::{{closure}}::{{closure}}