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

Panic on Linux (Arch) when attempting to use multiple windows #401

Open
zeta0134 opened this issue Sep 26, 2017 · 3 comments
Open

Panic on Linux (Arch) when attempting to use multiple windows #401

zeta0134 opened this issue Sep 26, 2017 · 3 comments

Comments

@zeta0134
Copy link

When attempting to run multi_window, or any derivative code that attempts to create more than one window, the following panic occurs:

/home/zeta0134/Github/piston-examples/target/release
[zeta0134@dave-arch release]$ ./multi_window 
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:335:20
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', src/libcore/result.rs:860:4
stack backtrace:
   0:     0x55da84f48f4f - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::h124b4bcef86dcc8e
   1:     0x55da84f38d71 - std::sys_common::backtrace::print::hc582a11b3ee21b31
   2:     0x55da84f3e91d - std::panicking::default_hook::{{closure}}::h8186675e6f93fe64
   3:     0x55da84f3e5cf - std::panicking::default_hook::hd0d178fcebd87257
   4:     0x55da84f3ee0d - std::panicking::rust_panic_with_hook::h3ecd70e9e7b4a365
   5:     0x55da84f3ecf4 - std::panicking::begin_panic_new::h7cd1c43e212cb664
   6:     0x55da84f3ebf1 - std::panicking::begin_panic_fmt::h2cbeb1751e9072e6
   7:     0x55da84f3eb7a - rust_begin_unwind
   8:     0x55da84f7de60 - core::panicking::panic_fmt::h14002c1b69bfc0aa
   9:     0x55da84eb76c6 - core::result::unwrap_failed::h3d40e9d0ff226b17
  10:     0x55da84ec55ad - <winit::platform::platform::x11::Window2 as core::ops::drop::Drop>::drop::h208f69a407780713
  11:     0x55da84e575e7 - core::ptr::drop_in_place::h2d0f0555e5f76058
  12:     0x55da84e5a223 - core::ptr::drop_in_place::hf24d12830800cd33
  13:     0x55da84e568dc - core::ptr::drop_in_place::h01e10b93c1d82ada
  14:     0x55da84e58cea - core::ptr::drop_in_place::h9d7fd56a688626f8
  15:     0x55da84e75bec - multi_window::main::h5fc2d69543202507
  16:     0x55da84f50527 - __rust_maybe_catch_panic
  17:     0x55da84f3eab7 - std::panicking::try::h36ff7733b5113eb6
  18:     0x55da84f4a139 - std::rt::lang_start::h60bbe14d465df98b
  19:     0x7f11b65fbf69 - __libc_start_main
  20:     0x55da84e54529 - _start
  21:                0x0 - <unknown>
thread panicked while panicking. aborting.
Illegal instruction (core dumped)

Weirdly, the example does "run" very briefly, and all the windows all show up onscreen for a moment. It seems like the actual window creation is succeeding, and the program dies somewhere in the event loop. I've tried switching the OpenGL context to no avail; I can get it to fail earlier with OpenGL contexts my system can't run, but I haven't found a WindowSettings that works for multi_window.

This only occurs with multiple windows; all the other examples and my own projects compile and run fine if I use only a single window.

[zeta0134@dave-arch release]$ rustc -V
rustc 1.20.0
[zeta0134@dave-arch release]$ uname -a
Linux dave-arch 4.12.13-1-ARCH #1 SMP PREEMPT Fri Sep 15 06:36:43 UTC 2017 x86_64 GNU/Linux

I'm running Arch Linux, with the LightDM desktop manager under X Server (not Wayland as far as I can tell) and am running the Cinnamon desktop environment. Graphics card is a GeForce 730, but I get similar behavior on my work laptop, which is running Intel graphics. On this particular system I'm running official nVidia drivers, version 384.69.

I've attached my glxinfo if that's helpful, and will be happy to provide any additional info.
glxinfo.txt

@dhardy
Copy link

dhardy commented Feb 17, 2018

Same (but Fedora Linux, KDE/X11, radeon). I'm guessing this is the source panic:

  11:     0x563a3183d61f - <winit::platform::platform::x11::Window as core::ops::drop::Drop>::drop::hc0f7a0deb0022a42
                               at /home/dhardy/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/x11/mod.rs:971

which is a panic:

            let ic = (x_events_loop.display.xlib.XCreateIC)(im,
                                              b"inputStyle\0".as_ptr() as *const _,
                                              ffi::XIMPreeditNothing | ffi::XIMStatusNothing, b"clientWindow\0".as_ptr() as *const _,
                                              win.id().0, ptr::null::<()>());
            if ic.is_null() {
                panic!("XCreateIC failed");
            }

@malikolivier
Copy link

The same occurs on Ubuntu 17.10 (running X11 on i3).

This appears to be a winit bug. There is an issue for it: rust-windowing/winit#347

malikolivier added a commit to malikolivier/matplotrs that referenced this issue Mar 13, 2018
@francesca64
Copy link

@dhardy note that you were running winit 0.10.0, at which point in history, this was line 971: https://github.com/tomaka/winit/blob/198d9ff230d8fb8de0d5103d9fa40cee1f55c368/src/platform/linux/x11/mod.rs#L971 (I suspect it was actually the XCloseIM line, though)

Anyway, could you try here: https://github.com/francesca64/piston-examples

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

4 participants