Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#9518 closed defect (fixed)

scale_vulkan and gblur_vulkan filters trigger segfault on invocation.

Reported by: Dennis E. Mungai Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: vulkan
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I'm running FFmpeg's latest git tip from master, and encountered a segfault when running any command that invokes either scale_vulkan or gblur_vulkan. I'm yet to track down the exact commit that breaks these filters, so I'll update the ticket with that info when that's done.

Here is what gdb reports:

gdb --args /home/brainiarc7/ffmpeg_sources/ffmpeg/ffmpeg_g -init_hw_device cuda=cuda:0 -filter_hw_device cuda -i feeds.mp4 -filter_complex "[0:v]hwupload=extra_hw_frames=16:derive_device=vulkan,scale_vulkan=w=1920:h=1080,hwupload=derive_device=cuda[s0]" -map "[s0]" -c:v:0 h264_nvenc -map "0:a" -c:a copy -f mpegts -y scale_vulkan_test.ts
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/brainiarc7/ffmpeg_sources/ffmpeg/ffmpeg_g...
(gdb) run
Starting program: /home/brainiarc7/ffmpeg_sources/ffmpeg/ffmpeg_g -init_hw_device cuda=cuda:0 -filter_hw_device cuda -i feeds.mp4 -filter_complex \[0:v\]hwupload=extra_hw_frames=16:derive_device=vulkan,scale_vulkan=w=1920:h=1080,hwupload=derive_device=cuda\[s0\] -map \[s0\] -c:v:0 h264_nvenc -map 0:a -c:a copy -f mpegts -y scale_vulkan_test.ts
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ffmpeg version N-104617-g405685dec7 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --pkg-config-flags=--static --enable-static --disable-shared --prefix=/home/brainiarc7 --bindir=/home/brainiarc7/bin --enable-cuda-nvcc --enable-cuvid --enable-libnpp --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --enable-nvenc --enable-libass --enable-debug --enable-gpl --cpu=native --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-openssl --enable-librtmp --enable-libzvbi --enable-version3 --enable-opencl --enable-pic --enable-librav1e --enable-libglslang --enable-vulkan --enable-libsrt --enable-avisynth --enable-libsvtav1 --enable-libvpx --enable-libplacebo --enable-librav1e --nvccflags='-gencode arch=compute_75,code=sm_75 -O2' --extra-libs='-lpthread -lm -lz -ldl' --enable-nonfree
  libavutil      57.  9.100 / 57.  9.100
  libavcodec     59. 13.100 / 59. 13.100
  libavformat    59.  9.101 / 59.  9.101
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.100 /  6.  1.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
[New Thread 0x7fffe5973000 (LWP 2443713)]
[New Thread 0x7fffe5172000 (LWP 2443714)]
[New Thread 0x7fffe1fff000 (LWP 2443715)]
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'feeds.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.5.100
  Duration: 01:00:02.13, start: 0.000000, bitrate: 13533 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 13144 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main

Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault.
0x000055555596da4c in ff_vk_free_buf (s=s@entry=0x55555884a080, 
    buf=buf@entry=0x55555884a8f0) at ./libavutil/vulkan.c:356
356	    vk->DeviceWaitIdle(s->hwctx->act_dev);

And for the gblur_vulkan filter which also triggers a segfault in a similar fashion:

gdb --args /home/brainiarc7/ffmpeg_sources/ffmpeg/ffmpeg_g -init_hw_device cuda=cuda:0 -filter_hw_device cuda -i feeds.mp4 -filter_complex "[0:v]hwupload=extra_hw_frames=16:derive_device=vulkan,gblur_vulkan,hwupload=derive_device=cuda[s0]" -map "[s0]" -c:v:0 h264_nvenc -map "0:a" -c:a copy -f mpegts -y scale_vulkan_test.ts
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/brainiarc7/ffmpeg_sources/ffmpeg/ffmpeg_g...
(gdb) run
Starting program: /home/brainiarc7/ffmpeg_sources/ffmpeg/ffmpeg_g -init_hw_device cuda=cuda:0 -filter_hw_device cuda -i feeds.mp4 -filter_complex \[0:v\]hwupload=extra_hw_frames=16:derive_device=vulkan,gblur_vulkan,hwupload=derive_device=cuda\[s0\] -map \[s0\] -c:v:0 h264_nvenc -map 0:a -c:a copy -f mpegts -y scale_vulkan_test.ts
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ffmpeg version N-104617-g405685dec7 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --pkg-config-flags=--static --enable-static --disable-shared --prefix=/home/brainiarc7 --bindir=/home/brainiarc7/bin --enable-cuda-nvcc --enable-cuvid --enable-libnpp --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --enable-nvenc --enable-libass --enable-debug --enable-gpl --cpu=native --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-openssl --enable-librtmp --enable-libzvbi --enable-version3 --enable-opencl --enable-pic --enable-librav1e --enable-libglslang --enable-vulkan --enable-libsrt --enable-avisynth --enable-libsvtav1 --enable-libvpx --enable-libplacebo --enable-librav1e --nvccflags='-gencode arch=compute_75,code=sm_75 -O2' --extra-libs='-lpthread -lm -lz -ldl' --enable-nonfree
  libavutil      57.  9.100 / 57.  9.100
  libavcodec     59. 13.100 / 59. 13.100
  libavformat    59.  9.101 / 59.  9.101
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.100 /  6.  1.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
[New Thread 0x7fffe5973000 (LWP 2448642)]
[New Thread 0x7fffe5172000 (LWP 2448643)]
[New Thread 0x7fffe1fff000 (LWP 2448644)]
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'feeds.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.5.100
  Duration: 01:00:02.13, start: 0.000000, bitrate: 13533 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 13144 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main

Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault.
0x000055555596da4c in ff_vk_free_buf (s=s@entry=0x55555884a080, buf=buf@entry=0x55555884a8f0) at ./libavutil/vulkan.c:356
356	    vk->DeviceWaitIdle(s->hwctx->act_dev);

The other Vulkan-based filters (as tested) are unaffected.

Warm regards,

Dennis.

Change History (3)

comment:1 by Dennis E. Mungai, 2 years ago

Status: newopen

comment:2 by Dennis E. Mungai, 2 years ago

Version: unspecifiedgit-master

comment:3 by Dennis E. Mungai, 2 years ago

Resolution: fixed
Status: openclosed

This issue is fixed by the commit 135e1c0adf155419a9546f02d620fb2aae95194b

Last edited 2 years ago by Dennis E. Mungai (previous) (diff)
Note: See TracTickets for help on using tickets.