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

[Vulkan] Release vulkan instance crashed. #387

Open
Youlin0301 opened this issue Dec 11, 2024 · 1 comment
Open

[Vulkan] Release vulkan instance crashed. #387

Youlin0301 opened this issue Dec 11, 2024 · 1 comment
Labels
question It's a question

Comments

@Youlin0301
Copy link

I meet a crash problem when my program release vulkan instance, let me explain:

  1. Suppose I have a vulkan render class, which will create vulkan instance, vulkan surface, pick physical device, and create vulkan device in sequence. Of course, I have to create another window to support the vulkan surface creation.

  2. For the destructor of vulkan render, I write the release source code by the order:
    vulkan device -> vulkan surface -> vulkan instance
    Of course, I also write the release source code in the destructor of the window class.

  3. In my program main function, I create the window and take it to initialize the vulkan render until the vulkan device is created, and then exit the program. No need to do anything.

  4. When program exits, it should release the vulkan encoder and window. Here, I find a strange crash issue:
    If the vulkan render is allocated in the main function, which is a local variable, the program will release it ok.
    But, if the vulkan render is announced as a "global" variable, program will crash when vulkan instance is released.

  5. The sample code likes below:
    1733901511649

As the picture shows, if the render is announced as global (try line 95 and disable line 101), program will crash when it exits and release vulkan instance:

Thread 1 "vulkan_test" received signal SIGSEGV, Segmentation fault.
0x00007ffff0ffaf57 in ?? () from /opt/amdgpu-pro/lib/x86_64-linux-gnu/amdvlk64.so
(gdb) where
#0 0x00007ffff0ffaf57 in ?? () from /opt/amdgpu-pro/lib/x86_64-linux-gnu/amdvlk64.so
#1 0x00007ffff7f64da5 in vkDestroyInstance () from /lib/x86_64-linux-gnu/libvulkan.so.1
#2 0x000055555555cb9e in CUbiVulkanRender::ClearCommonResource (this=0x55555559a340 , p_CommonInfo=...) at UbiVulkanRender.cpp:216
#3 0x000055555555cd50 in CUbiVulkanRender::Cleanup (this=0x55555559a340 ) at UbiVulkanRender.cpp:247
#4 0x000055555555c4b6 in CUbiVulkanRender::~CUbiVulkanRender (this=0x55555559a340 , __in_chrg=) at UbiVulkanRender.cpp:57
#5 0x00007ffff79c7495 in __run_exit_handlers (status=0, listp=0x7ffff7b9c838 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true,
run_dtors=run_dtors@entry=true) at ./stdlib/exit.c:113
#6 0x00007ffff79c7610 in __GI_exit (status=) at ./stdlib/exit.c:143
#7 0x00007ffff79abd97 in __libc_start_call_main (main=main@entry=0x55555555a8e0 <main()>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe098)
at ../sysdeps/nptl/libc_start_call_main.h:74
#8 0x00007ffff79abe40 in __libc_start_main_impl (main=0x55555555a8e0 <main()>, argc=1, argv=0x7fffffffe098, init=,
fini=, rtld_fini=, stack_end=0x7fffffffe088) at ../csu/libc-start.c:392
#9 0x000055555555a445 in _start ()

My platform is ubuntu 22.04, driver is "1:5.7.00.48.50700-1666569.22.04", and graphic card is [Radeon RX470].

@qiaojbao qiaojbao added the question It's a question label Dec 11, 2024
@qiaojbao
Copy link
Collaborator

Could you try to build a debug AMDVLK driver and debug more on your application?
You can start with here.
https://github.com/GPUOpen-Drivers/AMDVLK/blob/dev/README.md

And I noticed you have a RX470, the support was retired since v2023.Q4.1.
You could get codes from v2023.Q3.3.
https://github.com/GPUOpen-Drivers/AMDVLK/releases/tag/v-2023.Q3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question It's a question
Projects
None yet
Development

No branches or pull requests

2 participants