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 running example on linux with wayland #29

Closed
m4b opened this issue Nov 2, 2019 · 9 comments · Fixed by #251
Closed

crash running example on linux with wayland #29

m4b opened this issue Nov 2, 2019 · 9 comments · Fixed by #251
Labels
help wanted Extra attention is needed upstream bug Bug appears to originate in an upstream dependency

Comments

@m4b
Copy link

m4b commented Nov 2, 2019

hello, just thought I'd file this here:

RUST_BACKTRACE=full cargo run --example invaders
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/examples/invaders`
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
   0:     0x55b548e031ab - backtrace::backtrace::libunwind::trace::h89fcc71e59e3bc5b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1:     0x55b548e031ab - backtrace::backtrace::trace_unsynchronized::h0bad9be1379e729a
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2:     0x55b548e031ab - std::sys_common::backtrace::_print::hd3382a1f33c473da
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x55b548e031ab - std::sys_common::backtrace::print::h0ec6f03cfb8e76a6
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x55b548e031ab - std::panicking::default_hook::{{closure}}::h96cbf7b454e3f557
                               at src/libstd/panicking.rs:200
   5:     0x55b548e02e86 - std::panicking::default_hook::h95a8f00337383d83
                               at src/libstd/panicking.rs:214
   6:     0x55b548e0391d - std::panicking::rust_panic_with_hook::h92f98b46e22f14ed
                               at src/libstd/panicking.rs:477
   7:     0x55b548e034a2 - std::panicking::continue_panic_fmt::h25abfbb4e5b7043a
                               at src/libstd/panicking.rs:384
   8:     0x55b548e03386 - rust_begin_unwind
                               at src/libstd/panicking.rs:311
   9:     0x55b548e1f61d - core::panicking::panic_fmt::h7e9f94035af782b3
                               at src/libcore/panicking.rs:85
  10:     0x55b548e1f55c - core::panicking::panic::hda536e6f3accfb91
                               at src/libcore/panicking.rs:49
  11:     0x55b548654f6b - core::option::Option<T>::unwrap::h53f213eec78b21d3
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/macros.rs:12
  12:     0x55b5486868a7 - winit::platform_impl::platform::wayland::window::Window::current_monitor::h1fc431212bb70582
                               at /home/m4b/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.20.0-alpha4/src/platform_impl/linux/wayland/window.rs:334
  13:     0x55b5483471ad - winit::platform_impl::platform::Window::current_monitor::h36ec4e3753050276
                               at /home/m4b/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.20.0-alpha4/src/platform_impl/linux/mod.rs:433
  14:     0x55b54831588e - winit::window::Window::current_monitor::h331f66498ad0d993
                               at /home/m4b/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.20.0-alpha4/src/window.rs:744
  15:     0x55b54831652d - invaders::create_window::h8db4b89ce4d72ed3
                               at examples/invaders/main.rs:144
  16:     0x55b548315c04 - invaders::main::h7e93825e303b3309
                               at examples/invaders/main.rs:26
  17:     0x55b5483324e0 - std::rt::lang_start::{{closure}}::h83eea46cd4c6445f
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  18:     0x55b548e03323 - std::rt::lang_start_internal::{{closure}}::h4e93c1949c7a1955
                               at src/libstd/rt.rs:49
  19:     0x55b548e03323 - std::panicking::try::do_call::h9440ccd4dc467eaa
                               at src/libstd/panicking.rs:296
  20:     0x55b548e07bfa - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  21:     0x55b548e03e2d - std::panicking::try::hc046e7ee42ee744f
                               at src/libstd/panicking.rs:275
  22:     0x55b548e03e2d - std::panic::catch_unwind::h27dfc457c200aee0
                               at src/libstd/panic.rs:394
  23:     0x55b548e03e2d - std::rt::lang_start_internal::hea1b49a567afe309
                               at src/libstd/rt.rs:48
  24:     0x55b5483324b9 - std::rt::lang_start::hf88dabd11b766af7
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  25:     0x55b548316aca - main
  26:     0x7f49b4c81153 - __libc_start_main
  27:     0x55b5482f31ae - _start
@parasyte
Copy link
Owner

parasyte commented Nov 2, 2019

Thanks for the report. I haven't tried the example on Wayland. Looks like we can't get a current monitor for a hidden window on Wayland. I wonder if this is a winit bug? Searching their issue tracker didn't come up with anything.

@parasyte parasyte added bug Something isn't working help wanted Extra attention is needed labels Nov 2, 2019
@m4b m4b changed the title crash running example crash running example on linux with wayland Nov 2, 2019
@parasyte parasyte added upstream bug Bug appears to originate in an upstream dependency and removed bug Something isn't working labels Nov 3, 2019
@caemor
Copy link

caemor commented Nov 5, 2019

Seems to also happen with x11 on manjaro with gnome

https://gist.github.com/caemor/c2c0a3dbf0a4fa83cdbd0c81b82546e2

@parasyte
Copy link
Owner

parasyte commented Nov 5, 2019

That's another good data point. The only thing I have to add is that it works on Windows and macOS.

@caemor Unfortunately that backtrace does not tell us much. Can you get one from a debug build?

@caemor
Copy link

caemor commented Nov 5, 2019

Yes here is the output with more errors from the debug build:

Debug Backtrace
     Running `target/debug/examples/invaders`
[2019-11-05T08:37:36Z ERROR gfx_backend_vulkan] 
    GENERAL [Loader Message (0)] : setupLoaderTermPhysDevs:  Failed to detect any valid GPUs in the current config
    object info: (type: INSTANCE, hndl: 94142666705760)
    
[2019-11-05T08:37:36Z ERROR gfx_backend_vulkan] 
    GENERAL [Loader Message (0)] : setupLoaderTrampPhysDevs:  Failed during dispatch call of 'vkEnumeratePhysicalDevices' to lower layers or loader to get count.
    object info: (type: INSTANCE, hndl: 94142666705760)
    
[2019-11-05T08:37:36Z ERROR gfx_backend_vulkan] 
    GENERAL [Loader Message (0)] : setupLoaderTermPhysDevs:  Failed to detect any valid GPUs in the current config
    object info: (type: INSTANCE, hndl: 94142666705760)
    
[2019-11-05T08:37:36Z ERROR gfx_backend_vulkan] 
    GENERAL [Loader Message (0)] : setupLoaderTrampPhysDevs:  Failed during dispatch call of 'vkEnumeratePhysicalDevices' to lower layers or loader to get count.
    object info: (type: INSTANCE, hndl: 94142666705760)
    
[2019-11-05T08:37:36Z ERROR gfx_backend_vulkan] Could not enumerate physical devices! Initialization of a object has failed
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
   0:     0x559f4b21165b - backtrace::backtrace::libunwind::trace::h89fcc71e59e3bc5b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1:     0x559f4b21165b - backtrace::backtrace::trace_unsynchronized::h0bad9be1379e729a
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2:     0x559f4b21165b - std::sys_common::backtrace::_print::hd3382a1f33c473da
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x559f4b21165b - std::sys_common::backtrace::print::h0ec6f03cfb8e76a6
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x559f4b21165b - std::panicking::default_hook::{{closure}}::h96cbf7b454e3f557
                               at src/libstd/panicking.rs:200
   5:     0x559f4b211336 - std::panicking::default_hook::h95a8f00337383d83
                               at src/libstd/panicking.rs:214
   6:     0x559f4b211dcd - std::panicking::rust_panic_with_hook::h92f98b46e22f14ed
                               at src/libstd/panicking.rs:477
   7:     0x559f4b211952 - std::panicking::continue_panic_fmt::h25abfbb4e5b7043a
                               at src/libstd/panicking.rs:384
   8:     0x559f4b211836 - rust_begin_unwind
                               at src/libstd/panicking.rs:311
   9:     0x559f4b22dacd - core::panicking::panic_fmt::h7e9f94035af782b3
                               at src/libcore/panicking.rs:85
  10:     0x559f4b22da0c - core::panicking::panic::hda536e6f3accfb91
                               at src/libcore/panicking.rs:49
  11:     0x559f4ae9aa98 - core::option::Option<T>::unwrap::h6a8982082ab21bf2
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/macros.rs:12
  12:     0x559f4afb2a7d - wgpu_request_adapter
                               at /home/caemor/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-native-0.4.0/src/instance.rs:474
  13:     0x559f4adb33de - wgpu::Adapter::request::h5d0f480938252090
                               at /home/caemor/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.4.0/src/lib.rs:545
  14:     0x559f4adabe25 - pixels::PixelsBuilder::build::h59b6760c73bac5f1
                               at src/lib.rs:413
  15:     0x559f4adab2e4 - pixels::Pixels::new::hd357520d8b07f9a8
                               at src/lib.rs:140
  16:     0x559f4a6eae21 - invaders::main::h1045af4f645b64f7
                               at examples/invaders/main.rs:28
  17:     0x559f4a6e8d20 - std::rt::lang_start::{{closure}}::hda704dadbaa610b3
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  18:     0x559f4b2117d3 - std::rt::lang_start_internal::{{closure}}::h4e93c1949c7a1955
                               at src/libstd/rt.rs:49
  19:     0x559f4b2117d3 - std::panicking::try::do_call::h9440ccd4dc467eaa
                               at src/libstd/panicking.rs:296
  20:     0x559f4b2160aa - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  21:     0x559f4b2122dd - std::panicking::try::hc046e7ee42ee744f
                               at src/libstd/panicking.rs:275
  22:     0x559f4b2122dd - std::panic::catch_unwind::h27dfc457c200aee0
                               at src/libstd/panic.rs:394
  23:     0x559f4b2122dd - std::rt::lang_start_internal::hea1b49a567afe309
                               at src/libstd/rt.rs:48
  24:     0x559f4a6e8cf9 - std::rt::lang_start::h6eaa7268c68ca014
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  25:     0x559f4a6ebcfa - main
  26:     0x7febf9b9f153 - __libc_start_main
  27:     0x559f4a6df1ae - _start
  28:                0x0 - <unknown>

@parasyte
Copy link
Owner

parasyte commented Nov 5, 2019

@caemor You have some interesting errors from vulkan. Out of curiosity, have you tried the wgpu or gfx examples on that machine? I would be interested to hear the results of those tests.

So that's not actually the same bug as what was originally reported. I've opened #36 we can continue the conversation there. Thanks for the infos!

@joshtriplett
Copy link

I've run into the same bug trying to put together a simple test program:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
   7: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   8: rust_begin_unwind
             at src/libstd/panicking.rs:311
   9: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  10: core::panicking::panic
             at src/libcore/panicking.rs:49
  11: wgpu_request_adapter
  12: wgpu::Adapter::request
  13: pixels::PixelsBuilder::build
  14: pixels::Pixels::new
  15: fractal::main
  16: std::rt::lang_start::{{closure}}
  17: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:49
  18: std::panicking::try::do_call
             at src/libstd/panicking.rs:296
  19: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  20: std::panicking::try
             at src/libstd/panicking.rs:275
  21: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  22: std::rt::lang_start_internal
             at src/libstd/rt.rs:48
  23: main
  24: __libc_start_main
  25: _start

Here's the code:

use pixels::{wgpu::Surface, Pixels, SurfaceTexture};
use winit::event_loop::EventLoop;
use winit::window::Window;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let event_loop = EventLoop::new();
    let window = Window::new(&event_loop)?;
    let surface = Surface::create(&window);
    let size = window.inner_size().to_physical(window.hidpi_factor());

    let width = size.width.round() as u32;
    let height = size.height.round() as u32;

    let surface_texture = SurfaceTexture::new(width, height, surface);
    let pixels = Pixels::new(width, height, surface_texture);
}

Dependencies:

num = "*"
pixels = "*"
winit = "0.20.0-alpha4"

@parasyte
Copy link
Owner

parasyte commented Nov 5, 2019

Thanks @joshtriplett That looks like #36

@parasyte
Copy link
Owner

To followup here, this can be worked around by forcing winit to use X11.

WINIT_UNIX_BACKEND=x11 cargo run --release --example minimal-winit --features minimal-winit

@parasyte
Copy link
Owner

I believe rust-windowing/winit#1190 will fix this issue.

parasyte added a commit that referenced this issue Jan 8, 2022
- Rather than setting the position and window size based on available
  screen space, this PR just creates a window with a default size and
  doesn't attempt to set the position.
- Closes #29
parasyte added a commit that referenced this issue Jan 8, 2022
- Rather than setting the position and window size based on available
  screen space, this PR just creates a window with a default size and
  doesn't attempt to set the position.
- Closes #29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed upstream bug Bug appears to originate in an upstream dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants