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 (core dumped) happend in VkBlobAllocator::fastFree(VkImageMemory* ptr) #3259

Open
arnoldfychen opened this issue Sep 29, 2021 · 1 comment

Comments

@arnoldfychen
Copy link

arnoldfychen commented Sep 29, 2021

error log | 日志或报错信息 | ログ

Segmentation fault (core dumped)

I got the backtrace of the segmentation fault by gdb:

Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000007f748cbed8 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvidia-eglcore.so.32.5.0
[Current thread is 1 (Thread 0x7f79e21010 (LWP 30466))]
(gdb) bt
#0 0x0000007f748cbed8 in () at /usr/lib/aarch64-linux-gnu/tegra/libnvidia-eglcore.so.32.5.0
#1 0x0000007f748cc2d8 in () at /usr/lib/aarch64-linux-gnu/tegra/libnvidia-eglcore.so.32.5.0
#2 0x0000007f749dfb10 in () at /usr/lib/aarch64-linux-gnu/tegra/libnvidia-eglcore.so.32.5.0
#3 0x0000007f749e5fec in () at /usr/lib/aarch64-linux-gnu/tegra/libnvidia-eglcore.so.32.5.0
#4 0x0000005567aeeb8c in ncnn::VkBlobAllocator::fastFree(ncnn::VkImageMemory*) ()
#5 0x0000005567afe4c0 in ncnn::VulkanDevicePrivate::destroy_dummy_buffer_image() ()
#6 0x0000005567afe700 in ncnn::VulkanDevice::~VulkanDevice() ()
#7 0x0000005567afe9d8 in ncnn::destroy_gpu_instance() ()
#8 0x0000007f90ad9e54 in __run_exit_handlers (status=1, listp=0x7f90bf85a0 <__exit_funcs>, run_list_atexit=127, run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
#9 0x0000007f90ad9f8c in __GI_exit (status=) at exit.c:139
#10 0x0000007f83385424 in gtk_init () at /usr/lib/aarch64-linux-gnu/libgtk-x11-2.0.so.0
#11 0x0000007f917119dc in cvInitSystem () at /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.4.1
#12 0x0000007f91714dbc in cvNamedWindow () at /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.4.1
#13 0x0000007f91715650 in cvShowImage () at /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.4.1
#14 0x0000007f9170c900 in cv::imshow(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&) ()
at /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.4.1
#15 0x0000005567ac9fd4 in main ()

context | 编译/运行环境 | バックグラウンド

The latest ncnn + vulkan (1.2.141 or 1.2.193) + Jetpack4.5 on NVIDIA Jetson Nano

how to reproduce | 复现步骤 | 再現方法

Under my work directory /home/ubuntu/ :

  1. git clone -b v1.2.141 https://github.com/KhronosGroup/Vulkan-Loader.git or
    git clone https://github.com/KhronosGroup/Vulkan-Loader.git
  2. cd Vulkan-Loader && mkdir build && cd build
  3. ../scripts/update_deps.py
  4. cmake -DCMAKE_BUILD_TYPE=Release -DVULKAN_HEADERS_INSTALL_DIR=$(pwd)/Vulkan-Headers/build/install ..
  5. make
  6. cd Vulkan-Headers
  7. ln -s ../loader lib
  8. export VULKAN_SDK=/home/ubuntu/Vulkan-Loader/build/Vulkan-Headers
  9. git clone [email protected]:Tencent/ncnn
  10. cd ncnn
  11. git submodule update --init
  12. mkdir build && cd build
  13. cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/jetson.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=ON ..
  14. make
  15. cd examples
  16. copy scrfd_500m-opt2.bin and scrfd_500m-opt2.param to this folder and cp a test image test.jpg to this folder
  17. ./scrfd test.jpg
  18. You will see coredump happens almost when program ends.

more | 其他 | その他

I had an investigation and found the segmentation fault happens at line #1045 in void VkBlobAllocator::fastFree(VkImageMemory* ptr) in allocator.cpp :

vkDestroyImageView(vkdev->vkdevice(), ptr->imageview, 0);

@arnoldfychen
Copy link
Author

arnoldfychen commented Sep 29, 2021

Please note on Jetson Nano the vulkan version provided in JetPack4.5 is 1.2.141, I also had a try to use the latest vulkan 1.2.193 .so library,which I compiled out on Nano, to replace the 1.2.141 .so library under /usr/lib/aarch64-linux-gnu/tegra/:

cp /home/ubuntu/Vulkan-Loader/build/loader/libvulkan.so.1.2.193 /usr/lib/aarch64-linux-gnu/tegra/
cd /usr/lib/aarch64-linux-gnu/tegra
rm libvulkan.so.1
ln -s libvulkan.so.1.2.193 libvulkan.so.1
cd ..
rm libvulkan.so.1.2
ln -s tegra/libvulkan.so.1.2.193 libvulkan.so.1.2

but this segmentation fault still happened.

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

1 participant