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

There is bug with crate dark-light #2833

Open
4 tasks done
Decodetalkers opened this issue Mar 9, 2025 · 3 comments
Open
4 tasks done

There is bug with crate dark-light #2833

Decodetalkers opened this issue Mar 9, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@Decodetalkers
Copy link
Contributor

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

The dark-light crate is a bug

On linux, the crate need async-std to run zbus to get the theme, but seems it not control what platform zbus is on. If I have already a zbus , and let it run on tokio, it will panic

To show it , I create a branch:

Decodetalkers@99b5b92

What is the expected behavior?

thread 'main' panicked at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/abstractions/executor.rs:189:27:
there is no reactor running, must be called from the context of a Tokio 1.x runtime

Version

master

Operating System

Linux

Do you have any log output?

Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.21s
     Running `/home/cht/git/iced/target/debug/checkbox`

thread 'main' panicked at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/abstractions/executor.rs:189:27:
there is no reactor running, must be called from the context of a Tokio 1.x runtime
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:692:5
   1: core::panicking::panic_fmt
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/panicking.rs:75:14
   2: core::panicking::panic_display
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panicking.rs:261:5
   3: tokio::runtime::scheduler::Handle::current::panic_cold_display
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic.rs:100:13
   4: tokio::runtime::scheduler::Handle::current
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/scheduler/mod.rs:108:27
   5: tokio::runtime::handle::Handle::current
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/handle.rs:141:20
   6: tokio::runtime::blocking::pool::spawn_blocking
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/blocking/pool.rs:184:14
   7: tokio::task::blocking::spawn_blocking
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/task/blocking.rs:207:9
   8: zbus::abstractions::executor::Task<T>::spawn_blocking
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/abstractions/executor.rs:189:27
   9: zbus::address::transport::Transport::connect::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/address/transport/mod.rs:112:30
  10: zbus::address::Address::connect::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/address/mod.rs:59:34
  11: zbus::connection::builder::Builder::target_connect::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/connection/builder.rs:496:41
  12: zbus::connection::builder::Builder::connect::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/connection/builder.rs:423:78
  13: zbus::connection::builder::Builder::build_::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/connection/builder.rs:354:50
  14: zbus::abstractions::executor::Executor::run::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/abstractions/executor.rs:122:20
  15: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:124:9
  16: zbus::connection::builder::Builder::build::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/connection/builder.rs:340:74
  17: zbus::connection::Connection::session::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zbus-5.5.0/src/connection/mod.rs:1195:37
  18: ashpd::proxy::Proxy::connection::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ashpd-0.10.2/src/proxy.rs:40:51
  19: ashpd::proxy::Proxy::new::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ashpd-0.10.2/src/proxy.rs:66:45
  20: ashpd::proxy::Proxy::new_desktop::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ashpd-0.10.2/src/proxy.rs:105:65
  21: ashpd::desktop::settings::Settings::new::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ashpd-0.10.2/src/desktop/settings.rs:179:75
  22: dark_light::platforms::freedesktop::detect::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dark-light-2.0.0/src/platforms/freedesktop.rs:12:14
  23: <async_std::future::timeout::TimeoutFuture<F> as core::future::future::Future>::poll
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/future/timeout.rs:64:15
  24: async_std::future::timeout::timeout::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/future/timeout.rs:36:32
  25: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/builder.rs:199:17
  26: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/task_locals_wrapper.rs:60:13
  27: std::thread::local::LocalKey<T>::try_with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:308:12
  28: std::thread::local::LocalKey<T>::with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:9
  29: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/task_locals_wrapper.rs:55:9
  30: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/builder.rs:197:13
  31: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/future.rs:454:33
  32: async_executor::State::run::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-executor-1.13.1/src/lib.rs:748:32
  33: async_executor::Executor::run::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-executor-1.13.1/src/lib.rs:344:34
  34: async_executor::LocalExecutor::run::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-executor-1.13.1/src/lib.rs:648:34
  35: async_io::driver::block_on::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-io-2.4.0/src/driver.rs:199:37
  36: std::thread::local::LocalKey<T>::try_with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:308:12
  37: std::thread::local::LocalKey<T>::with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:9
  38: async_io::driver::block_on
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-io-2.4.0/src/driver.rs:175:5
  39: async_global_executor::reactor::block_on::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-global-executor-2.4.1/src/reactor.rs:3:18
  40: async_global_executor::reactor::block_on
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-global-executor-2.4.1/src/reactor.rs:12:5
  41: async_global_executor::executor::block_on::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-global-executor-2.4.1/src/executor.rs:26:36
  42: std::thread::local::LocalKey<T>::try_with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:308:12
  43: std::thread::local::LocalKey<T>::with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:9
  44: async_global_executor::executor::block_on
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-global-executor-2.4.1/src/executor.rs:26:5
  45: async_std::task::builder::Builder::blocking::{{closure}}::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/builder.rs:171:25
  46: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/task_locals_wrapper.rs:60:13
  47: std::thread::local::LocalKey<T>::try_with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:308:12
  48: std::thread::local::LocalKey<T>::with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:9
  49: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/task_locals_wrapper.rs:55:9
  50: async_std::task::builder::Builder::blocking::{{closure}}
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/builder.rs:168:17
  51: std::thread::local::LocalKey<T>::try_with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:308:12
  52: std::thread::local::LocalKey<T>::with
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:9
  53: async_std::task::builder::Builder::blocking
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/builder.rs:161:9
  54: async_std::task::block_on::block_on
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-std-1.13.0/src/task/block_on.rs:33:5
  55: dark_light::platforms::freedesktop::detect
             at /home/cht/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dark-light-2.0.0/src/platforms/freedesktop.rs:10:5
  56: <iced_core::theme::Theme as core::default::Default>::default::DEFAULT::{{closure}}
             at /home/cht/git/iced/core/src/theme.rs:172:23
  57: core::ops::function::FnOnce::call_once
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  58: core::ops::function::FnOnce::call_once
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  59: std::sync::lazy_lock::LazyLock<T,F>::force::{{closure}}
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/lazy_lock.rs:213:25
  60: std::sync::poison::once::Once::call_once::{{closure}}
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/poison/once.rs:158:41
  61: std::sys::sync::once::futex::Once::call
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/sys/sync/once/futex.rs:176:21
  62: std::sync::poison::once::Once::call_once
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/poison/once.rs:158:9
  63: std::sync::lazy_lock::LazyLock<T,F>::force
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/lazy_lock.rs:209:9
  64: <std::sync::lazy_lock::LazyLock<T,F> as core::ops::deref::Deref>::deref
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/lazy_lock.rs:312:9
  65: <iced_core::theme::Theme as core::default::Default>::default
             at /home/cht/git/iced/core/src/theme.rs:182:13
  66: checkbox::Example::theme
             at ./src/main.rs:43:9
  67: core::ops::function::Fn::call
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:79:5
  68: iced::application::Application<P>::theme::{{closure}}
             at /home/cht/git/iced/src/application.rs:345:70
  69: <iced::program::with_theme::WithTheme<P,F> as iced::program::Program>::theme
             at /home/cht/git/iced/src/program.rs:363:13
  70: <iced::program::Program::run_with::Instance<P,I> as iced_winit::program::Program>::theme
             at /home/cht/git/iced/src/program.rs:152:17
  71: iced_winit::program::state::State<P>::new
             at /home/cht/git/iced/winit/src/program/state.rs:55:21
  72: iced_winit::program::window_manager::WindowManager<P,C>::insert
             at /home/cht/git/iced/winit/src/program/window_manager.rs:54:21
  73: iced_winit::program::run_instance::{{closure}}
             at /home/cht/git/iced/winit/src/program.rs:678:30
  74: iced_winit::program::run::Runner<Message,F>::process_event
             at /home/cht/git/iced/winit/src/program.rs:354:28
  75: iced_winit::program::run::Runner<Message,F>::process_event
             at /home/cht/git/iced/winit/src/program.rs:478:33
  76: <iced_winit::program::run::Runner<Message,F> as winit::application::ApplicationHandler<iced_runtime::Action<Message>>>::user_event
             at /home/cht/git/iced/winit/src/program.rs:302:13
  77: winit::event_loop::dispatch_event_for_app
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/event_loop.rs:644:36
  78: winit::event_loop::EventLoop<T>::run_app::{{closure}}
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/event_loop.rs:265:49
  79: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
  80: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
  81: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::single_iteration
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/platform_impl/linux/wayland/event_loop/mod.rs:323:13
  82: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::poll_events_with_timeout
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/platform_impl/linux/wayland/event_loop/mod.rs:295:9
  83: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::pump_events
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/platform_impl/linux/wayland/event_loop/mod.rs:217:13
  84: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::run_on_demand
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/platform_impl/linux/wayland/event_loop/mod.rs:181:19
  85: winit::platform_impl::linux::EventLoop<T>::run_on_demand
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/platform_impl/linux/mod.rs:819:56
  86: winit::platform_impl::linux::EventLoop<T>::run
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/platform_impl/linux/mod.rs:812:9
  87: winit::event_loop::EventLoop<T>::run_app
             at /home/cht/.cargo/git/checkouts/winit-865c6d5afb3ec9c3/11414b6/src/event_loop.rs:265:9
  88: iced_winit::program::run
             at /home/cht/git/iced/winit/src/program.rs:513:17
  89: iced::program::Program::run_with
             at /home/cht/git/iced/src/program.rs:176:12
  90: iced::program::Program::run
             at /home/cht/git/iced/src/program.rs:80:9
  91: iced::application::Application<P>::run
             at /home/cht/git/iced/src/application.rs:166:9
  92: checkbox::main
             at ./src/main.rs:7:5
  93: core::ops::function::FnOnce::call_once
             at /home/cht/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@Decodetalkers Decodetalkers added the bug Something isn't working label Mar 9, 2025
@Decodetalkers
Copy link
Contributor Author

maybe the bug is from ashpd, seems it forgot to control where the zbus runs on.. it is really a serious bug, as soon as you have a dependence of zbus, and open the future of tokio , iced will panic, though not the fault of iced.

https://github.com/rust-dark-light/dark-light/blob/main/src/platforms/freedesktop.rs#L9-L21

bug comes from this snippet. Since there is not blocking on function in ashpd, author use the block_on of async_std to run ashpd, so seems bugs comes from ashpd

@Decodetalkers
Copy link
Contributor Author

Decodetalkers commented Mar 9, 2025

maybe it is the bug of rust.. I think I add the feature just for current target, but it influences the feature of the lib. Should I also report bug for rust?

@Decodetalkers
Copy link
Contributor Author

ok.. seems the part of dark-light need to use the blocking api of zbus to rewrite.. it seems impossible to fixed from upstream..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant