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

Segmentation fault running example #2789

Closed
hw762 opened this issue Jun 19, 2022 · 10 comments
Closed

Segmentation fault running example #2789

hw762 opened this issue Jun 19, 2022 · 10 comments

Comments

@hw762
Copy link

hw762 commented Jun 19, 2022

Description
Tried to run any example, but causes segfault

Repro steps

Clone repo, checkout 0.12.0, try to run any example (cube, hello-compute, etc):

RUST_LOG=trace cargo run --example cube --features trace

Expected vs observed behavior
Expected: example runs

Observed: segmentation fault

Extra materials

Look at attachment
trace.log

Platform
Pop OS 22.04, Intel UHD, Vulkan:

00:02.0 VGA compatible controller: Intel Corporation CometLake-U GT2 [UHD Graphics] (rev 02)
@cwfitzgerald
Copy link
Member

cwfitzgerald commented Jun 19, 2022

Thanks for filling, nothing off to my eye in the log.

Could you try to get a backtrace from the segmentation fault using gdb?

Some other possible causes - if you have the vulkan validation layers installed, make sure they are up to date, versions before 1.2.180 or so can easily segfault.

@hw762
Copy link
Author

hw762 commented Jun 19, 2022

Backtrace:

Thread 1 "hello-compute" received signal SIGSEGV, Segmentation fault.
0x00007fffd09a773f in ?? () from /lib/librenderdoc.so
(gdb) bt
#0  0x00007fffd09a773f in ?? () from /lib/librenderdoc.so
#1  0x00007fffd0339c3c in ?? () from /lib/librenderdoc.so
#2  0x00007fffd0340682 in ?? () from /lib/librenderdoc.so
#3  0x00007ffff7fc947e in call_init (l=<optimized out>, argc=argc@entry=1, 
    argv=argv@entry=0x7fffffffdc88, env=env@entry=0x7fffffffdc98) at ./elf/dl-init.c:70
#4  0x00007ffff7fc9568 in call_init (env=0x7fffffffdc98, argv=0x7fffffffdc88, argc=1, 
    l=<optimized out>) at ./elf/dl-init.c:33
#5  _dl_init (main_map=0x555556a3c1a0, argc=1, argv=0x7fffffffdc88, env=0x7fffffffdc98)
    at ./elf/dl-init.c:117
#6  0x00007ffff7ddac85 in __GI__dl_catch_exception (exception=<optimized out>, 
    operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:182
#7  0x00007ffff7fd0ff6 in dl_open_worker (a=0x7ffffffcfd50) at ./elf/dl-open.c:808
#8  dl_open_worker (a=a@entry=0x7ffffffcfd50) at ./elf/dl-open.c:771
#9  0x00007ffff7ddac28 in __GI__dl_catch_exception (exception=<optimized out>, 
    operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#10 0x00007ffff7fd134e in _dl_open (file=<optimized out>, mode=-2147483647, 
    caller_dlopen=0x555555d7e7db <libloading::os::unix::{impl#2}::open::{closure#1}<&str>+171>, 
    nsid=-2, argc=1, argv=<optimized out>, env=0x7fffffffdc98) at ./elf/dl-open.c:883
#11 0x00007ffff7cf66bc in dlopen_doit (a=a@entry=0x7ffffffcffc0) at ./dlfcn/dlopen.c:56
#12 0x00007ffff7ddac28 in __GI__dl_catch_exception (exception=exception@entry=0x7ffffffcff20, 
    operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#13 0x00007ffff7ddacf3 in __GI__dl_catch_error (objname=0x7ffffffcff78, errstring=0x7ffffffcff80, 
    mallocedp=0x7ffffffcff77, operate=<optimized out>, args=<optimized out>)
    at ./elf/dl-error-skeleton.c:227
#14 0x00007ffff7cf61ae in _dlerror_run (operate=operate@entry=0x7ffff7cf6660 <dlopen_doit>, 
    args=args@entry=0x7ffffffcffc0) at ./dlfcn/dlerror.c:138
--Type <RET> for more, q to quit, c to continue without paging--
#15 0x00007ffff7cf6748 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, 
    file=<optimized out>) at ./dlfcn/dlopen.c:71
#16 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81
#17 0x0000555555d7e7db in libloading::os::unix::{impl#2}::open::{closure#1}<&str> ()
    at /home/prototype/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/libloading-0.7.3/src/os/unix/mod.rs:173
#18 0x0000555555d7e221 in libloading::os::unix::with_dlerror<libloading::os::unix::Library, libloading::os::unix::{impl#2}::open::{closure_env#1}<&str>> (
    wrap=0x555555d8f280 <core::ops::function::FnOnce::call_once<libloading::os::unix::{impl#2}::open::{closure_env#0}<&str>, (libloading::error::DlDescription)>>, 
    closure=<error reading variable: Cannot access memory at address 0xf>)
    at /home/prototype/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/libloading-0.7.3/src/os/unix/mod.rs:54
#19 0x0000555555d7e6d5 in libloading::os::unix::Library::open<&str> (filename=..., flags=1)
    at /home/prototype/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/libloading-0.7.3/src/os/unix/mod.rs:172
#20 0x0000555555d7e474 in libloading::os::unix::Library::new<&str> (filename=...)
    at /home/prototype/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/libloading-0.7.3/src/os/unix/mod.rs:121
#21 0x0000555555d6f6f3 in libloading::safe::Library::new<&str> (filename=...)
    at /home/prototype/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/libloading-0.7.3/src/safe.rs:84
#22 0x0000555555cb2878 in wgpu_hal::auxil::renderdoc::RenderDoc::new ()
    at wgpu-hal/src/auxil/renderdoc.rs:42
#23 0x0000555555cb2eed in wgpu_hal::auxil::renderdoc::{impl#3}::default ()
    at wgpu-hal/src/auxil/renderdoc.rs:90
#24 0x0000555555c3ef00 in wgpu_hal::vulkan::Adapter::device_from_raw (self=0x555556a3a9d8, 
--Type <RET> for more, q to quit, c to continue without paging--
    raw_device=..., handle_is_owned=true, enabled_extensions=..., features=..., uab_types=..., 
    family_index=0, queue_index=0) at wgpu-hal/src/vulkan/adapter.rs:1388
#25 0x0000555555c3f6af in wgpu_hal::vulkan::adapter::{impl#9}::open (self=0x555556a3a9d8, 
    features=..., limits=0x7fffffffc1f0) at wgpu-hal/src/vulkan/adapter.rs:1434
#26 0x00005555558c4578 in wgpu_core::instance::Adapter<wgpu_hal::vulkan::Api>::create_device<wgpu_hal::vulkan::Api> (self=0x555556a3a9d8, self_id=..., desc=0x7fffffffc1c8, trace_path=...)
    at /home/prototype/src/wgpu/wgpu-core/src/instance.rs:317
#27 0x00005555558b4083 in wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>::adapter_request_device<wgpu_core::hub::IdentityManagerFactory, wgpu_hal::vulkan::Api> (self=0x5555569fe410, 
    adapter_id=..., desc=0x7fffffffc1c8, trace_path=..., id_in=...)
    at /home/prototype/src/wgpu/wgpu-core/src/instance.rs:938
#28 0x0000555555aa0228 in wgpu::backend::direct::{impl#3}::adapter_request_device (
    self=0x5555569fe410, adapter=0x7fffffffd720, desc=0x7fffffffd760, trace_dir=...)
    at wgpu/src/backend/direct.rs:885
#29 0x0000555555a40888 in wgpu::Adapter::request_device (self=0x7fffffffd718, desc=0x7fffffffd760, 
    trace_path=...) at wgpu/src/lib.rs:1826
#30 0x00005555556a337e in hello_compute::execute_gpu::{async_fn#0} ()
    at wgpu/examples/hello-compute/main.rs:45
#31 0x000055555566ec9f in core::future::from_generator::{impl#1}::poll<hello_compute::execute_gpu::{async_fn_env#0}> (self=..., cx=0x7fffffffd678)
    at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/future/mod.rs:84
#32 0x00005555556a29c1 in hello_compute::run::{async_fn#0} () at wgpu/examples/hello-compute/main.rs:19
#33 0x000055555566ea09 in core::future::from_generator::{impl#1}::poll<hello_compute::run::{async_fn_env#0}> (self=..., cx=0x7fffffffd678)
    at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/future/mod.rs:84
#34 0x000055555568c37d in pollster::block_on<core::future::from_generator::GenFuture<hello_compute::run:--Type <RET> for more, q to quit, c to continue without paging--
:{async_fn_env#0}>> (fut=...)
    at /home/prototype/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/pollster-0.2.5/src/lib.rs:125
#35 0x000055555568bcf1 in hello_compute::main () at wgpu/examples/hello-compute/main.rs:186

The vulkan packages I use:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                              Version           Architecture Description
+++-=================================-=================-============-=============================================
un  gir1.2-vulkan-1.0                 <none>            <none>       (no description available)
ii  libvulkan-dev:amd64               1.3.204.1-2       amd64        Vulkan loader library -- development files
ii  libvulkan1:amd64                  1.3.204.1-2       amd64        Vulkan loader library
ii  libvulkan1:i386                   1.3.204.1-2       i386         Vulkan loader library
ii  mesa-vulkan-drivers:amd64         22.0.1-1ubuntu2.1 amd64        Mesa Vulkan graphics drivers
ii  mesa-vulkan-drivers:i386          22.0.1-1ubuntu2.1 i386         Mesa Vulkan graphics drivers
un  vulkan-headers                    <none>            <none>       (no description available)
un  vulkan-icd                        <none>            <none>       (no description available)
un  vulkan-loader                     <none>            <none>       (no description available)
un  vulkan-sdk-headers                <none>            <none>       (no description available)
un  vulkan-sdk-runtime                <none>            <none>       (no description available)
ii  vulkan-tools                      1.3.204.0+dfsg1-1 amd64        Miscellaneous Vulkan utilities
ii  vulkan-validationlayers:amd64     1.3.204.1-2       amd64        Vulkan validation layers
ii  vulkan-validationlayers-dev:amd64 1.3.204.1-2       amd64        Vulkan validation layers -- development files

@cwfitzgerald
Copy link
Member

Are you using renderdoc? Is it up to date?

@hw762
Copy link
Author

hw762 commented Jun 20, 2022

I do have it installed:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name              Version      Architecture Description
+++-=================-============-============-========================================================
ii  librenderdoc      1.18+dfsg-1  amd64        Stand-alone graphics debugging tool -- library
ii  librenderdoc-dev  1.18+dfsg-1  amd64        Stand-alone graphics debugging tool -- development files
ii  python3-renderdoc 1.18+dfsg-1  amd64        Stand-alone graphics debugging tool -- Python module
ii  qrenderdoc        1.18+dfsg-1  amd64        Stand-alone graphics debugging tool -- graphical utility
ii  renderdoc         1.18+dfsg-1  amd64        Stand-alone graphics debugging tool -- metapackage
ii  renderdoc-doc     1.18+dfsg-1  all          Stand-alone graphics debugging tool -- docs
ii  renderdoccmd      1.18+dfsg-1  amd64        Stand-alone graphics debugging tool -- command line tool

I don't know why this would cause a segfault.

@hw762
Copy link
Author

hw762 commented Jun 20, 2022

Is the backtrace saying the segfault comes from trying to open librenderdoc library?

@cwfitzgerald
Copy link
Member

Yeah, that's what it looks like to me

@hw762
Copy link
Author

hw762 commented Jun 20, 2022

Is there any next step I can do? I have never used libloading before.

@cwfitzgerald
Copy link
Member

I think this is an issue with librenderdoc.so - I suspect you're only supposed to load it while renderdoc is attached. Clarifying this with baldurk...

@cwfitzgerald
Copy link
Member

We aren't loading renderdoc correctly - I'm going to file a new issue about that and close this one. Thank you for the report!

In the mean time, the best route would be to try to hide renderdoc from your application - not sure exactly how to do this on your system.

@cwfitzgerald
Copy link
Member

Closed in favor of #2793

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