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

Error, panics, then segfault #23

Open
DuckDuckWhale opened this issue Mar 21, 2022 · 9 comments
Open

Error, panics, then segfault #23

DuckDuckWhale opened this issue Mar 21, 2022 · 9 comments

Comments

@DuckDuckWhale
Copy link

On Wayland Gnome Ubuntu 21.10 with Nvidia driver 510 on hybrid GPU:

user@host:show-image-rs$ cargo run --example show-image test.png
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

ImageInfo {
    pixel_format: Rgba8(
        Unpremultiplied,
    ),
    size: UVec2(
        1920,
        1080,
    ),
    stride: UVec2(
        4,
        7680,
    ),
}
[2022-03-21T21:57:35Z ERROR smithay_client_toolkit::window::concept_frame] No font could be found
thread 'main' panicked at 'Error in Surface::configure: surface does not support the adapter's queue family', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.0/src/backend/direct.rs:204:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'global context failed to send function return value back, which can only happen if the event loop stopped, but that should also kill the process: Disconnected', /home/user/develop/show-image-rs/src/backend/proxy.rs:144:14
Segmentation fault (core dumped)
@de-vri-es
Copy link
Member

Thanks for the report!

Could you update to 0.12.0 and try again? If it still fails, can you run it with RUST_BACKTRACE=1 and show the full backtrace?

@DuckDuckWhale
Copy link
Author

Updated to a5f1449 with Rust 1.60.0:

With non-existing test.png:

MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

Error: "Failed to read image from \"test.png\": No such file or directory (os error 2)"
Segmentation fault (core dumped)

With existing test.png:

user@host:show-image-rs$ RUST_BACKTRACE=1 cargo run --example show-image test.png
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/examples/show-image test.png`
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

ImageInfo {
    pixel_format: Rgba8(
        Unpremultiplied,
    ),
    size: UVec2(
        1920,
        1080,
    ),
    stride: UVec2(
        4,
        7680,
    ),
}
thread 'main' panicked at 'Error in Surface::configure: surface does not support the adapter's queue family', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:214:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: wgpu::backend::direct::Context::handle_error_fatal
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:214:9
   3: <wgpu::backend::direct::Context as wgpu::Context>::surface_configure
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:921:13
   4: wgpu::Surface::configure
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/lib.rs:3267:9
   5: show_image::backend::context::configure_surface
             at ./src/backend/context.rs:898:2
   6: show_image::backend::context::Context::create_window
             at ./src/backend/context.rs:299:3
   7: show_image::backend::context::ContextHandle::create_window
             at ./src/backend/context.rs:240:15
   8: show_image::backend::create_window::{{closure}}
             at ./src/backend/mod.rs:234:16
   9: show_image::backend::proxy::ContextProxy::run_function_wait::{{closure}}
             at ./src/backend/proxy.rs:142:51
  10: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
  11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/alloc/src/boxed.rs:1853:9
  12: show_image::backend::context::Context::handle_event
             at ./src/backend/context.rs:520:5
  13: show_image::backend::context::Context::run::{{closure}}
             at ./src/backend/context.rs:190:4
  14: winit::platform_impl::platform::sticky_exit_callback
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:753:5
  15: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_return
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/wayland/event_loop/mod.rs:242:17
  16: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/wayland/event_loop/mod.rs:209:9
  17: winit::platform_impl::platform::EventLoop<T>::run
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:669:56
  18: winit::event_loop::EventLoop<T>::run
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/event_loop.rs:154:9
  19: show_image::backend::context::Context::run
             at ./src/backend/context.rs:188:3
  20: show_image::backend::run_context
             at ./src/backend/mod.rs:93:2
  21: show_image::main
             at ./examples/show-image.rs:3:1
  22: core::ops::function::FnOnce::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'global context failed to send function return value back, which can only happen if the event loop stopped, but that should also kill the process: Disconnected', /home/user/develop/show-image-rs/src/backend/proxy.rs:144:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1749:5
   3: core::result::Result<T,E>::expect
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1022:23
   4: show_image::backend::proxy::ContextProxy::run_function_wait
             at ./src/backend/proxy.rs:143:3
   5: show_image::backend::create_window
             at ./src/backend/mod.rs:233:2
   6: show_image::main::main
             at ./examples/show-image.rs:20:15
   7: core::ops::function::FnOnce::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
   8: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panic/unwind_safe.rs:271:9
   9: std::panicking::try::do_call
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:492:40
  10: __rust_try
  11: std::panicking::try
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:456:19
  12: std::panic::catch_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panic.rs:137:14
  13: show_image::backend::run_context::{{closure}}
             at ./src/backend/mod.rs:82:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Segmentation fault (core dumped)

Also, I've noticed that although the main branch is tagged v0.12.0, the version Cargo sees is still 0.11.0. Is that a mistake?

@de-vri-es
Copy link
Member

Oops, I tagged it as 0.12.0, but it should have been 0.11.0.

Thanks for the full traceback. I'll try to investigate more. Could you also post the output of lspci | grep VGA? It would be nice to know the exact hardware you've got.

@DuckDuckWhale
Copy link
Author

My hardware model is XPS-7590 with Nvidia GPU (1650, I think) and Intel integrated GPU.

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630]

@de-vri-es
Copy link
Member

de-vri-es commented Apr 10, 2022

Thanks! I think this was causing the issue:

https://github.com/robohouse-delft/show-image-rs/blob/v0.11.0/src/backend/context.rs#L760

The adapter chosen wasn't necessarily compatible with the created window. Ideally we'd do it the other way around: create a window compatible with the chosen adapter. But I'm not sure if and how that would be possible. For now, I delayed GPU initialization until the first window is created so we can choose a compatible adapter.

Could you see if the problem is solved (this time truly with v0.12.0)?

@DuckDuckWhale
Copy link
Author

Unfortunately not. On eb9ff44:

$ RUST_BACKTRACE=1 cargo run --example show-image test.png
   Compiling show-image v0.12.0 (/home/user/develop/show-image-rs)
   Compiling show-image-macros v0.12.0 (/home/user/develop/show-image-rs/show-image-macros)
    Finished dev [unoptimized + debuginfo] target(s) in 15.72s
     Running `target/debug/examples/show-image test.png`
ImageInfo {
    pixel_format: Rgba8(
        Unpremultiplied,
    ),
    size: UVec2(
        1920,
        1080,
    ),
    stride: UVec2(
        4,
        7680,
    ),
}
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

thread 'main' panicked at 'Error in Surface::configure: parent device is lost', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:214:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: wgpu::backend::direct::Context::handle_error_fatal
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:214:9
   3: <wgpu::backend::direct::Context as wgpu::Context>::surface_configure
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:921:13
   4: wgpu::Surface::configure
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/lib.rs:3267:9
   5: show_image::backend::context::configure_surface
             at ./src/backend/context.rs:924:2
   6: show_image::backend::context::Context::create_window
             at ./src/backend/context.rs:321:3
   7: show_image::backend::context::ContextHandle::create_window
             at ./src/backend/context.rs:253:15
   8: show_image::backend::create_window::{{closure}}
             at ./src/backend/mod.rs:234:16
   9: show_image::backend::proxy::ContextProxy::run_function_wait::{{closure}}
             at ./src/backend/proxy.rs:142:51
  10: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
  11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/alloc/src/boxed.rs:1853:9
  12: show_image::backend::context::Context::handle_event
             at ./src/backend/context.rs:546:5
  13: show_image::backend::context::Context::run::{{closure}}
             at ./src/backend/context.rs:203:4
  14: winit::platform_impl::platform::sticky_exit_callback
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:753:5
  15: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_return
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/wayland/event_loop/mod.rs:242:17
  16: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/wayland/event_loop/mod.rs:209:9
  17: winit::platform_impl::platform::EventLoop<T>::run
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:669:56
  18: winit::event_loop::EventLoop<T>::run
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/event_loop.rs:154:9
  19: show_image::backend::context::Context::run
             at ./src/backend/context.rs:201:3
  20: show_image::backend::run_context
             at ./src/backend/mod.rs:93:2
  21: show_image::main
             at ./examples/show-image.rs:3:1
  22: core::ops::function::FnOnce::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'global context failed to send function return value back, which can only happen if the event loop stopped, but that should also kill the process: Disconnected', /home/user/develop/show-image-rs/src/backend/proxy.rs:144:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1749:5
   3: core::result::Result<T,E>::expect
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1022:23
   4: show_image::backend::proxy::ContextProxy::run_function_wait
             at ./src/backend/proxy.rs:143:3
   5: show_image::backend::create_window
             at ./src/backend/mod.rs:233:2
   6: show_image::main::main
             at ./examples/show-image.rs:20:15
   7: core::ops::function::FnOnce::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
   8: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panic/unwind_safe.rs:271:9
   9: std::panicking::try::do_call
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:492:40
  10: __rust_try
  11: std::panicking::try
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:456:19
  12: std::panic::catch_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panic.rs:137:14
  13: show_image::backend::run_context::{{closure}}
             at ./src/backend/mod.rs:82:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Segmentation fault (core dumped)

If this gets too complex we can probably do a bug-fix branch for testing to avoid polluting the version numbers.

@de-vri-es
Copy link
Member

Thanks for the extra info. Not sure if this is a related problem now, or if it's a new problem. Either way, I'll have to read up a bit and then indeed, lets use a separate branch to test fixes.

@de-vri-es
Copy link
Member

Btw, could you also see if either setting the environment variable WGPU_POWER_PREF=high or WGPU_POWER_PREF=low "solves" the issue?

Of course, it should just work out of the box, but it's interesting to know if both the integrated GPU and the discrete one are broken, or just one of the two.

@DuckDuckWhale
Copy link
Author

Identical backtrace on both settings.

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