Winit: [Wayland] Crash when resizing window too small

Created on 19 Oct 2019  路  6Comments  路  Source: rust-windowing/winit

This has been reported to Alacritty in https://github.com/jwilm/alacritty/issues/2895.

Apparently when shrinking the window size below ~160px in width or height, winit will crash with a protocol error.

Backtrace:

$ RUST_BACKTRACE=full ./target/debug/alacritty
xkbcommon: ERROR: Key "<LFSH>" added to modifier map for multiple modifiers; Using Lock, ignoring Shift
xkbcommon: ERROR: Key "<LFSH>" added to modifier map for multiple modifiers; Using Lock, ignoring Shift
xkbcommon: ERROR: Key "<LFSH>" added to modifier map for multiple modifiers; Using Lock, ignoring Shift
wl_drm@43: error 2: invalid name
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 71, kind: Other, message: "Protocol error" }', src/libcore/result.rs:1084:5
stack backtrace:
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 71, kind: Other, message: "Protocol error" }', src/libcore/result.rs:1084:5
   0:     0x55c0b16bc5db - backtrace::backtrace::libunwind::trace::h89fcc71e59e3bc5b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1:     0x55c0b16bc5db - backtrace::backtrace::trace_unsynchronized::h0bad9be1379e729a
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2:     0x55c0b16bc5db - std::sys_common::backtrace::_print::hd3382a1f33c473da
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x55c0b16bc5db - std::sys_common::backtrace::print::h0ec6f03cfb8e76a6
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x55c0b16bc5db - std::panicking::default_hook::{{closure}}::h96cbf7b454e3f557
                               at src/libstd/panicking.rs:200
   5:     0x55c0b16bc2b6 - std::panicking::default_hook::h95a8f00337383d83
                               at src/libstd/panicking.rs:214
   6:     0x55c0b16bcd4d - std::panicking::rust_panic_with_hook::h92f98b46e22f14ed
                               at src/libstd/panicking.rs:477
   7:     0x55c0b16bc8d2 - std::panicking::continue_panic_fmt::h25abfbb4e5b7043a
                               at src/libstd/panicking.rs:384
   8:     0x55c0b16bc7b6 - rust_begin_unwind
                               at src/libstd/panicking.rs:311
   9:     0x55c0b16ddf0d - core::panicking::panic_fmt::h7e9f94035af782b3
                               at src/libcore/panicking.rs:85
  10:     0x55c0b16de007 - core::result::unwrap_failed::hf7591c1dd9412006
                               at src/libcore/result.rs:1084
  11:     0x55c0b13bd340 - core::result::Result<T,E>::unwrap::h4dcad5a74d687370
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/result.rs:852
  12:     0x55c0b138b6c6 - <wayland_client::<impl calloop::sources::EventSource for wayland_client::event_queue::EventQueue>::make_dispatcher::Dispatcher as calloop::sources::EventDispatcher<Data>>::ready::h9ba56154af651043
                               at /home/maddy/.cargo/registry/src/github.com-1ecc6299db9ec823/wayland-client-0.23.6/src/lib.rs:283
  13:     0x55c0b06c8f24 - calloop::loop_logic::EventLoop<Data>::dispatch_events::hc2d0667b049653c8
                               at /home/maddy/.cargo/registry/src/github.com-1ecc6299db9ec823/calloop-0.4.4/src/loop_logic.rs:157
  14:     0x55c0b06c92a4 - calloop::loop_logic::EventLoop<Data>::dispatch::hb8605920283728db
                               at /home/maddy/.cargo/registry/src/github.com-1ecc6299db9ec823/calloop-0.4.4/src/loop_logic.rs:189
  15:     0x55c0b072c3e5 - winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_return::hace73442d1cf28e0
                               at /home/maddy/.cargo/git/checkouts/winit-c2fdb27092aba5a7/08cb950/src/platform_impl/linux/wayland/event_loop.rs:568
  16:     0x55c0b0849196 - winit::platform_impl::platform::EventLoop<T>::run_return::h6625450b5bcefdc0
                               at /home/maddy/.cargo/git/checkouts/winit-c2fdb27092aba5a7/08cb950/src/platform_impl/linux/mod.rs:609
  17:     0x55c0b0682b1c - <winit::event_loop::EventLoop<T> as winit::platform::desktop::EventLoopExtDesktop>::run_return::hf8d9e40882794815
                               at /home/maddy/.cargo/git/checkouts/winit-c2fdb27092aba5a7/08cb950/src/platform/desktop.rs:43
  18:     0x55c0b089628d - alacritty::event::Processor<N>::run::h3f80de7037f69753
                               at alacritty/src/event.rs:346
  19:     0x55c0b0840bef - alacritty::run::h2cb7b869f8ab551d
                               at alacritty/src/main.rs:215
  20:     0x55c0b083f60b - alacritty::main::h3463e27e4eb6db05
                               at alacritty/src/main.rs:106
  21:     0x55c0b0723ed0 - std::rt::lang_start::{{closure}}::h85bd6445b4ffb376
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  22:     0x55c0b16bc753 - std::rt::lang_start_internal::{{closure}}::h4e93c1949c7a1955
                               at src/libstd/rt.rs:49
  23:     0x55c0b16bc753 - std::panicking::try::do_call::h9440ccd4dc467eaa
                               at src/libstd/panicking.rs:296
  24:     0x55c0b16c554a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  25:     0x55c0b16bd31d - std::panicking::try::hc046e7ee42ee744f
                               at src/libstd/panicking.rs:275
  26:     0x55c0b16bd31d - std::panic::catch_unwind::h27dfc457c200aee0
                               at src/libstd/panic.rs:394
  27:     0x55c0b16bd31d - std::rt::lang_start_internal::hea1b49a567afe309
                               at src/libstd/rt.rs:48
  28:     0x55c0b0723ea9 - std::rt::lang_start::h189ee5ac098283b4
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  29:     0x55c0b084117a - main
  30:     0x7f62b9531153 - __libc_start_main
  31:     0x55c0b05e619e - _start
  32:                0x0 - <unknown>
stack backtrace:
   0:     0x55c0b16bc5db - backtrace::backtrace::libunwind::trace::h89fcc71e59e3bc5b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1:     0x55c0b16bc5db - backtrace::backtrace::trace_unsynchronized::h0bad9be1379e729a
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2:     0x55c0b16bc5db - std::sys_common::backtrace::_print::hd3382a1f33c473da
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x55c0b16bc5db - std::sys_common::backtrace::print::h0ec6f03cfb8e76a6
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x55c0b16bc5db - std::panicking::default_hook::{{closure}}::h96cbf7b454e3f557
                               at src/libstd/panicking.rs:200
   5:     0x55c0b16bc2b6 - std::panicking::default_hook::h95a8f00337383d83
                               at src/libstd/panicking.rs:214
   6:     0x55c0b16bcd4d - std::panicking::rust_panic_with_hook::h92f98b46e22f14ed
                               at src/libstd/panicking.rs:477
   7:     0x55c0b16bc8d2 - std::panicking::continue_panic_fmt::h25abfbb4e5b7043a
                               at src/libstd/panicking.rs:384
   8:     0x55c0b16bc7b6 - rust_begin_unwind
                               at src/libstd/panicking.rs:311
   9:     0x55c0b16ddf0d - core::panicking::panic_fmt::h7e9f94035af782b3
                               at src/libcore/panicking.rs:85
  10:     0x55c0b16de007 - core::result::unwrap_failed::hf7591c1dd9412006
                               at src/libcore/result.rs:1084
  11:     0x55c0b125bb40 - core::result::Result<T,E>::unwrap::h6c590e4beefe4b98
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/result.rs:852
  12:     0x55c0b11f8d1e - smithay_clipboard::threaded::clipboard_thread::h6726c953b7ff0921
                               at /home/maddy/.cargo/registry/src/github.com-1ecc6299db9ec823/smithay-clipboard-0.3.5/src/threaded.rs:478
  13:     0x55c0b11f6b9a - smithay_clipboard::threaded::ThreadedClipboard::new_from_external::{{closure}}::h9a476f84ec6a09b7
                               at /home/maddy/.cargo/registry/src/github.com-1ecc6299db9ec823/smithay-clipboard-0.3.5/src/threaded.rs:101
  14:     0x55c0b1265642 - std::sys_common::backtrace::__rust_begin_short_backtrace::h70e6bc59dfce0a9b
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/sys_common/backtrace.rs:77
  15:     0x55c0b1256461 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h4e8796e6bffbaa90
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/mod.rs:470
  16:     0x55c0b122f0a1 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hcc4e1580b0a8275a
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panic.rs:315

Wayland needs investigation bug

All 6 comments

The panic is just a consequence of this

wl_drm@43: error 2: invalid name

This is a protocol error, after it occurred the Wayland server closed the socket, hence wayland-client returned an error which was promptly unwrapped.

Now, this protocol error occurred on the wl_drm wayland global, which is an internal implementation detail of mesa. This means that client-side-mesa did something that server-side-mesa decided was illegal. So this is very much OpenGL related. Possibly a bug in the graphics driver.

@vberger Wouldn't that mean that other applications should show the same behavior?

@b0o can you reproduce this in another Wayland application (not XWayland), ideally one using OpenGL?

A run of the debug log with WAYLAND_DEBUG=1 would help figuring out what mesa did that was incorrect, which may help identifying the actual issue.

@chrisduerr I can reproduce it in Kitty - log of WAYLAND_DEBUG=1 ./kitty/launcher/kitty

@vberger Here's a log of WAYLAND_DEBUG=1 RUST_BACKTRACE=full ./target/debug/alacritty.

Okay, so the protocol error is triggered as a response to

-> [email protected]_prime_buffer(new id wl_buffer@47, fd 26, 956, 144, 875713089, 0, 3840, 0, 0, 0, 0)

The error being "invalid name", that means that the fd that mesa sent to the server (fd 26) was considered invalid.

I can't really say more given wl_drm is an implementation detail of mesa and I'm not familiar with its internals, but this kind of error strongly suggest a mesa or driver bug.

Reported to Mesa in https://gitlab.freedesktop.org/mesa/mesa/-/issues/2982. I think that's the best we can do.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryanisaacg picture ryanisaacg  路  3Comments

swiftcoder picture swiftcoder  路  3Comments

francesca64 picture francesca64  路  4Comments

JDTX picture JDTX  路  3Comments

chrisduerr picture chrisduerr  路  3Comments