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

Crash when closing second window on wayland #270

Closed
xentec opened this issue Oct 3, 2023 · 9 comments
Closed

Crash when closing second window on wayland #270

xentec opened this issue Oct 3, 2023 · 9 comments

Comments

@xentec
Copy link

xentec commented Oct 3, 2023

After opening a second window on Wayland (Sway) and closing it with Ctrl+D Rio will consistently crash with SIGSEGV.

Backtrace

Thread 1 "rio" received signal SIGSEGV, Segmentation fault.
0x00007ffff7f9eaa9 in wl_list_insert () from /usr/lib/libwayland-client.so
(gdb) bt
#0  0x00007ffff7f9eaa9 in wl_list_insert () from /usr/lib/libwayland-client.so
#1  0x00007ffff7fa0131 in wl_display_read_events () from /usr/lib/libwayland-client.so
#2  0x0000555556f5d5bf in wayland_backend::sys::client_impl::InnerReadEventsGuard::read (self=...) at src/sys/client_impl/mod.rs:445
#3  0x00005555565ea481 in wayland_backend::sys::client::ReadEventsGuard::read (self=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-backend-0.1.2/src/sys/../client_api.rs:323
#4  0x0000555556587f84 in wayland_client::calloop::{impl#1}::process_events::{closure#0}<winit::platform_impl::platform::wayland::state::WinitState, calloop::sources::{impl#4}::process_events::{closure_env#0}<winit::platform_impl::platform::wayland::state::WinitState, wayland_client::calloop::WaylandSource<winit::platform_impl::platform::wayland::state::WinitState>, winit::platform_impl::platform::wayland::event_loop::{impl#0}::new::{closure_env#1}<rio::event::EventP>>> () at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-client-0.30.2/src/calloop.rs:88
#5  0x000055555661303e in calloop::sources::generic::{impl#2}::process_events<i32, std::io::error::Error, wayland_client::calloop::{impl#1}::process_events::{closure_env#0}<winit::platform_impl::platform::wayland::state::WinitState, calloop::sources::{impl#4}::process_events::{closure_env#0}<winit::platform_impl::platform::wayland::state::WinitState, wayland_client::calloop::WaylandSource<winit::platform_impl::platform::wayland::state::WinitState>, winit::platform_impl::platform::wayland::event_loop::{impl#0}::new::{closure_env#1}<rio::event::EventP>>>> (self=0x555558174d30, readiness=..., token=...,
    callback=...) at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.10.6/src/sources/generic.rs:121
#6  0x0000555556587e1f in wayland_client::calloop::{impl#1}::process_events<winit::platform_impl::platform::wayland::state::WinitState, calloop::sources::{impl#4}::process_events::{closure_env#0}<winit::platform_impl::platform::wayland::state::WinitState, wayland_client::calloop::WaylandSource<winit::platform_impl::platform::wayland::state::WinitState>, winit::platform_impl::platform::wayland::event_loop::{impl#0}::new::{closure_env#1}<rio::event::EventP>>> (self=0x555558174d08, readiness=..., token=..., callback=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-client-0.30.2/src/calloop.rs:84
#7  0x00005555565cdce8 in calloop::sources::{impl#4}::process_events<winit::platform_impl::platform::wayland::state::WinitState, wayland_client::calloop::WaylandSource<winit::platform_impl::platform::wayland::state::WinitState>, winit::platform_impl::platform::wayland::event_loop::{impl#0}::new::{closure_env#1}<rio::event::EventP>> (self=0x555558174d00, readiness=..., token=..., data=0x555558167f08)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.10.6/src/sources/mod.rs:305
#8  0x00005555565da797 in calloop::loop_logic::EventLoop<winit::platform_impl::platform::wayland::state::WinitState>::dispatch_events<winit::platform_impl::platform::wayland::state::WinitState> (self=0x555558167ec0, timeout=..., data=0x555558167f08)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.10.6/src/loop_logic.rs:300
#9  0x00005555565dc25d in calloop::loop_logic::EventLoop<winit::platform_impl::platform::wayland::state::WinitState>::dispatch<winit::platform_impl::platform::wayland::state::WinitState, core::option::Option<core::time::Duration>> (self=0x555558167ec0, timeout=..., data=0x555558167f08)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.10.6/src/loop_logic.rs:415
#10 0x000055555669a569 in winit::platform_impl::platform::wayland::event_loop::EventLoop<rio::event::EventP>::loop_dispatch<rio::event::EventP, core::option::Option<core::time::Duration>> (self=0x555558167e30, timeout=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/wayland/event_loop/mod.rs:637
#11 0x000055555669e06e in winit::platform_impl::platform::wayland::event_loop::EventLoop<rio::event::EventP>::poll_events_with_timeout<rio::event::EventP, &mut &mut rio::sequencer::{impl#0}::run::{async_fn#0}::{closure_env#0}> (self=0x555558167e30, timeout=..., callback=0x7ffffffdd5c8)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/wayland/event_loop/mod.rs:329
#12 0x000055555669a195 in winit::platform_impl::platform::wayland::event_loop::EventLoop<rio::event::EventP>::pump_events<rio::event::EventP, &mut rio::sequencer::{impl#0}::run::{async_fn#0}::{closure_env#0}> (self=0x555558167e30, timeout=..., callback=0x7ffffffec2d0)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/wayland/event_loop/mod.rs:243
#13 0x000055555669a315 in winit::platform_impl::platform::wayland::event_loop::EventLoop<rio::event::EventP>::run_ondemand<rio::event::EventP, rio::sequencer::{impl#0}::run::{async_fn#0}::{closure_env#0}> (self=0x555558167e30, event_handler=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/wayland/event_loop/mod.rs:202
#14 0x000055555658251c in winit::platform_impl::platform::EventLoop<rio::event::EventP>::run_ondemand<rio::event::EventP, rio::sequencer::{impl#0}::run::{async_fn#0}::{closure_env#0}> (self=0x7fffffff10b8, callback=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/mod.rs:801
#15 0x00005555566d7a76 in winit::platform::run_ondemand::{impl#0}::run_ondemand<rio::event::EventP, rio::sequencer::{impl#0}::run::{async_fn#0}::{closure_env#0}> (self=0x7fffffff10b8, event_handler=<error reading variable: Cannot access memory at address 0x0>)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform/run_ondemand.rs:72
#16 0x00005555565e53dd in rio::sequencer::{impl#0}::run::{async_fn#0} () at rio/src/sequencer.rs:65
#17 0x00005555565ed179 in rio::main::{async_block#0} () at rio/src/main.rs:146
#18 0x00005555565abac3 in tokio::runtime::park::{impl#4}::block_on::{closure#0}<rio::main::{async_block_env#0}> ()
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/park.rs:282
#19 0x00005555565ab8c2 in tokio::runtime::coop::with_budget<core::task::poll::Poll<core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>>, tokio::runtime::park::{impl#4}::block_on::{closure_env#0}<rio::main::{async_block_env#0}>> (budget=..., f=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/coop.rs:107
#20 tokio::runtime::coop::budget<core::task::poll::Poll<core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>>, tokio::runtime::park::{impl#4}::block_on::{closure_env#0}<rio::main::{async_block_env#0}>> (f=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/coop.rs:73
#21 tokio::runtime::park::CachedParkThread::block_on<rio::main::{async_block_env#0}> (self=0x7fffffff1d08, f=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/park.rs:282
#22 0x00005555565890f1 in tokio::runtime::context::blocking::BlockingRegionGuard::block_on<rio::main::{async_block_env#0}> (self=0x7fffffff4e00, f=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context/blocking.rs:66
#23 0x000055555662395a in tokio::runtime::scheduler::multi_thread::{impl#0}::block_on::{closure#0}<rio::main::{async_block_env#0}> (
    blocking=0x7fffffff4e00)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/mod.rs:87
#24 0x00005555565909d3 in tokio::runtime::context::runtime::enter_runtime<tokio::runtime::scheduler::multi_thread::{impl#0}::block_on::{closure_env#0}<rio::main::{async_block_env#0}>, core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>> (handle=0x7fffffffc818,
    allow_block_in_place=true, f=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context/runtime.rs:65
#25 0x00005555566238eb in tokio::runtime::scheduler::multi_thread::MultiThread::block_on<rio::main::{async_block_env#0}> (self=0x7fffffffc7f0,
    handle=0x7fffffffc818, future=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/mod.rs:86
#26 0x000055555667dc28 in tokio::runtime::runtime::Runtime::block_on<rio::main::{async_block_env#0}> (self=0x7fffffffc7e8, future=...)
    at /home/xentec/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/runtime.rs:349
#27 0x0000555556679dfc in rio::main () at rio/src/main.rs:148
#28 0x00005555566df64b in core::ops::function::FnOnce::call_once<fn() -> core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>, ()> () at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/ops/function.rs:250
#29 0x000055555668a44e in std::sys_common::backtrace::__rust_begin_short_backtrace<fn() -> core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>, core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>> (f=0x555556679cb0 <rio::main>)
    at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:135
#30 0x0000555556585301 in std::rt::lang_start::{closure#0}<core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>> ()
    at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/rt.rs:166
#31 0x0000555557f8c97b in core::ops::function::impls::{impl#2}::call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> () at library/core/src/ops/function.rs:284
#32 std::panicking::try::do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> ()
    at library/std/src/panicking.rs:500
#33 std::panicking::try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> ()
    at library/std/src/panicking.rs:464
#34 std::panic::catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> ()
    at library/std/src/panic.rs:142
#35 std::rt::lang_start_internal::{closure#2} () at library/std/src/rt.rs:148
#36 std::panicking::try::do_call<std::rt::lang_start_internal::{closure_env#2}, isize> () at library/std/src/panicking.rs:500
#37 std::panicking::try<isize, std::rt::lang_start_internal::{closure_env#2}> () at library/std/src/panicking.rs:464
#38 std::panic::catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> () at library/std/src/panic.rs:142
#39 std::rt::lang_start_internal () at library/std/src/rt.rs:148
#40 0x00005555565852da in std::rt::lang_start<core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>> (
    main=0x555556679cb0 <rio::main>, argc=1, argv=0x7fffffffe468, sigpipe=0)
    at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/rt.rs:165
#41 0x0000555556679ece in main ()
#42 0x00007ffff7cbbcd0 in ?? () from /usr/lib/libc.so.6
#43 0x00007ffff7cbbd8a in __libc_start_main () from /usr/lib/libc.so.6
#44 0x0000555556528da5 in _start ()

@raphamorim
Copy link
Owner

Hey @xentec thanks for the issue, which version is that one?

@xentec
Copy link
Author

xentec commented Oct 3, 2023

The latest: 0.0.22

I've also used cargo update and tried again, but it still crashed.

@raphamorim
Copy link
Owner

Just by curiosity did it happen before? or first time using Rio?
(will try to reproduce on my linux machine tomorrow)

@xentec
Copy link
Author

xentec commented Oct 3, 2023

The latter: was using it for the first time.

@raphamorim
Copy link
Owner

Hey there, I forgot to update this thread. I was unable to reproduce it to be honest. Is just create a second window and run control+d?

@xentec
Copy link
Author

xentec commented Oct 11, 2023

Yeah, you can also close the windows however you want, it will still crash.
While testing it again, I've discovered that it might be focus related:

  • Open a second window
  • switch to some non-rio window
  • close one of the rio windows
  • switch to the other one
  • CRASH

When closing the first window, this warning appears on stderr:

warning: queue 0x7f03a4000cc0 destroyed while proxies still attached:
  zwp_primary_selection_offer_v1@4278190084 still attached
  wl_data_offer@4278190085 still attached
  zwp_primary_selection_device_v1@42 still attached
  zwp_primary_selection_device_manager_v1@50 still attached
  wl_data_device@43 still attached
  wl_seat@45 still attached
  wl_data_device_manager@47 still attached
  wl_registry@49 still attached

Looks winit related.

@raphamorim
Copy link
Owner

@xentec can you try again using canary?
Updated the winit to latest

@xentec
Copy link
Author

xentec commented Oct 25, 2023

I did and got some mixed results.
The first 4 times it did crash again with the same Wayland-trace as above, but then started working fine and still does.
So... it seems to be fixed.

Many thanks!

@raphamorim
Copy link
Owner

That's great! I will close it for now but if anyone have similar issue please comment here and I will reopen (or open another issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants