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

monitor_info takes an extremely long time creating windows #17640

Open
ColonelThirtyTwo opened this issue Feb 2, 2025 · 6 comments
Open

monitor_info takes an extremely long time creating windows #17640

ColonelThirtyTwo opened this issue Feb 2, 2025 · 6 comments
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior O-Linux Specific to the Linux desktop operating system S-Needs-Testing Testing must be done before this is safe to merge

Comments

@ColonelThirtyTwo
Copy link

ColonelThirtyTwo commented Feb 2, 2025

Bevy version

0.15.1

[Optional] Relevant system information

Rust 1.84.1
Arch Linux
AMD Radeon RX 7800 XT (RADV NAVI32)
KDE Plasma (Wayland)

What you did

Run cargo run --example monitor_info on the 0.15.1 tag of bevy.

What went wrong

The windows for each monitor are only created after several minutes of waiting:

2025-02-02T02:03:21.079119Z TRACE wgpu_core::device::global: Device::create_compute_pipeline -> Id(3,1)    
2025-02-02T02:06:57.382343Z TRACE Poller::wait{timeout=None}:wait{epoll_fd=6 timeout=None}: polling::epoll: new events epoll_fd=6 res=1
2025-02-02T02:06:57.382565Z TRACE calloop::loop_logic: [calloop] Dispatching events for source #0    

After waiting, both windows (one for each monitor I have) spawn at the same time.

Additional information

Other examples create windows fine. Window mode nor transparency seems to matter.

Log with RUST_LOG=trace from monitor_info: monitor_info.txt

--features wayland does not seem to affect it.

@ColonelThirtyTwo ColonelThirtyTwo added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 2, 2025
@ColonelThirtyTwo ColonelThirtyTwo changed the title Creating windows outside of setup (Ex. in monitor_info) takes an extremely long time monitor_info takes an extremely long time creating windows Feb 2, 2025
@ColonelThirtyTwo
Copy link
Author

Adding a primary window via the WindowPlugin seems to work around the issue - with that, the additional windows spawn in a timely manner.

@alice-i-cecile alice-i-cecile added A-Windowing Platform-agnostic interface layer to run your app in S-Needs-Testing Testing must be done before this is safe to merge and removed S-Needs-Triage This issue needs to be labelled labels Feb 2, 2025
@alice-i-cecile
Copy link
Member

I suspect this is an OS-specific event loop bug, but I'd appreciate testing (from you or others) on alternate platforms.

@alice-i-cecile alice-i-cecile added the O-Linux Specific to the Linux desktop operating system label Feb 2, 2025
@ColonelThirtyTwo
Copy link
Author

Works fine on a Windows 11 laptop with an Nvidia RTX 4060 card running Vulkan.

I'll try running on a windows 10 installation of my desktop with the RTX card later, but I have a feeling it won't be different.

@ColonelThirtyTwo
Copy link
Author

I suspect this is an OS-specific event loop bug, but I'd appreciate testing (from you or others) on alternate platforms.

Probably. According to rust-gdb, its stuck in the epoll_wait syscall:

#0  0x000055555793015f in rustix::backend::arch::asm::syscall4 (nr=..., a0=..., a1=..., a2=..., a3=...)
    at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.44/src/backend/linux_raw/arch/x86_64.rs:154
#1  0x0000555557930e52 in rustix::backend::event::syscalls::epoll_wait (epfd=..., events=&mut [core::mem::maybe_uninit::MaybeUninit<rustix::event::epoll::Event>](size=1024) = {...}, timeout=-1)
    at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.44/src/backend/linux_raw/arch/mod.rs:105
#2  0x000055555792f6be in rustix::event::epoll::wait<&std::os::fd::owned::OwnedFd> (epoll=0x55555c7b6cb0, event_list=0x55555c7c0e30, timeout=-1)
    at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.44/src/event/epoll.rs:210
#3  0x0000555557935fc3 in polling::epoll::Poller::wait (self=0x55555c7b6cb0, events=0x55555c7c0e30, timeout=...) at src/epoll.rs:214
#4  0x00005555579324ba in polling::Poller::wait (self=0x55555c7b6cb0, events=0x55555c7c0e30, timeout=...) at src/lib.rs:744
#5  0x0000555557923968 in calloop::sys::Poll::poll (self=0x55555c7c0dd8, timeout=...) at src/sys.rs:233
#6  0x000055555768393c in calloop::loop_logic::EventLoop<winit::platform_impl::linux::x11::EventLoopState>::dispatch_events<winit::platform_impl::linux::x11::EventLoopState> (self=0x7fffffff8f20, timeout=..., 
    data=0x7fffffff8f59) at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:384
#7  0x0000555557686ee0 in calloop::loop_logic::EventLoop<winit::platform_impl::linux::x11::EventLoopState>::dispatch<winit::platform_impl::linux::x11::EventLoopState, core::option::Option<core::time::Duration>> (
    self=0x7fffffff8f20, timeout=..., data=0x7fffffff8f59) at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:559
#8  0x0000555557703899 in winit::platform_impl::linux::x11::EventLoop<bevy_winit::WakeUp>::poll_events_with_timeout<bevy_winit::WakeUp, &mut &mut winit::event_loop::{impl#6}::run_app::{closure_env#0}<bevy_winit::WakeUp, bevy_winit::state::WinitAppRunnerState<bevy_winit::WakeUp>>> (self=0x7fffffff8c18, timeout=..., callback=0x7fffffff8828)
    at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.8/src/platform_impl/linux/x11/mod.rs:468
#9  0x0000555557700eab in winit::platform_impl::linux::x11::EventLoop<bevy_winit::WakeUp>::pump_events<bevy_winit::WakeUp, &mut winit::event_loop::{impl#6}::run_app::{closure_env#0}<bevy_winit::WakeUp, bevy_winit::state::WinitAppRunnerState<bevy_winit::WakeUp>>> (self=0x7fffffff8c18, timeout=..., callback=0x7fffffff8a10)
    at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.8/src/platform_impl/linux/x11/mod.rs:424
#10 0x00005555577017b0 in winit::platform_impl::linux::x11::EventLoop<bevy_winit::WakeUp>::run_on_demand<bevy_winit::WakeUp, winit::event_loop::{impl#6}::run_app::{closure_env#0}<bevy_winit::WakeUp, bevy_winit::state::WinitAppRunnerState<bevy_winit::WakeUp>>> (self=0x7fffffff8c18, event_handler=...) at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.8/src/platform_impl/linux/x11/mod.rs:385
#11 0x00005555576feb81 in winit::platform_impl::linux::EventLoop<bevy_winit::WakeUp>::run_on_demand<bevy_winit::WakeUp, winit::event_loop::{impl#6}::run_app::{closure_env#0}<bevy_winit::WakeUp, bevy_winit::state::WinitAppRunnerState<bevy_winit::WakeUp>>> (self=0x7fffffff8c18, callback=...) at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.8/src/platform_impl/linux/mod.rs:819
#12 0x00005555576ff29e in winit::platform_impl::linux::EventLoop<bevy_winit::WakeUp>::run<bevy_winit::WakeUp, winit::event_loop::{impl#6}::run_app::{closure_env#0}<bevy_winit::WakeUp, bevy_winit::state::WinitAppRunnerState<bevy_winit::WakeUp>>> (self=..., callback=...) at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.8/src/platform_impl/linux/mod.rs:812
#13 0x00005555576dfff0 in winit::event_loop::EventLoop<bevy_winit::WakeUp>::run_app<bevy_winit::WakeUp, bevy_winit::state::WinitAppRunnerState<bevy_winit::WakeUp>> (self=..., app=0x7fffffff9748)
    at /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.8/src/event_loop.rs:265
#14 0x00005555576ec7ff in bevy_winit::state::winit_runner<bevy_winit::WakeUp> (app=...) at crates/bevy_winit/src/state.rs:862
#15 0x00005555576a4410 in core::ops::function::FnOnce::call_once<fn(bevy_app::app::App) -> bevy_app::app::AppExit, (bevy_app::app::App)> ()
    at /home/col/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
#16 0x00005555576a4122 in core::ops::function::FnOnce::call_once<fn(bevy_app::app::App) -> bevy_app::app::AppExit, (bevy_app::app::App)> ()
    at /home/col/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
#17 0x000055555bce6729 in alloc::boxed::{impl#28}::call_once<(bevy_app::app::App), dyn core::ops::function::FnOnce<(bevy_app::app::App), Output=bevy_app::app::AppExit>, alloc::alloc::Global> (self=..., args=...)
    at /home/col/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1972
#18 0x000055555bd16fd5 in bevy_app::app::App::run (self=0x7fffffffd0c8) at crates/bevy_app/src/app.rs:170
#19 0x0000555557638bcf in monitor_info::main () at examples/window/monitor_info.rs:10

@alice-i-cecile
Copy link
Member

Excellent investigation. Could you try reproducing with raw winit and opening a bug there, linking this one? I suspect we need to kick this up the dependency chain at least once.

@ColonelThirtyTwo
Copy link
Author

Not easily. Seems like it's more complicated than simply creating a window in new_events or about_to_wait. I'm not familiar with what bevy is doing behind the scenes that may be contributing to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior O-Linux Specific to the Linux desktop operating system S-Needs-Testing Testing must be done before this is safe to merge
Projects
None yet
Development

No branches or pull requests

2 participants