OpenVisualCloud / SVT-HEVC

SVT HEVC encoder. Scalable Video Technology (SVT) is a software-based video coding technology that is highly optimized for Intel® Xeon® processors. Using the open source SVT-HEVC encoder, it is possible to spread video encoding processing across multiple Intel® Xeon® processors to achieve a real advantage of processing efficiency.
Other
519 stars 169 forks source link

[SVT-HEVC] SvtHevcEncApp v1.4.1 core-dump occurred when encode #413

Closed xiajin-2007 closed 4 years ago

xiajin-2007 commented 4 years ago
OS: Ubuntu 18.04 LTS (GNU/Linux 4.15.0-20-generic x86_64) GCC: gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) SVT CommitID: 228d8ef Verify SVT-HEVC sample binary SvtHevcEncApp with Commit ID 228d8ef, with an 1 frame input yuv stream, then segmentation fault (core dumped) occurred. - Input stream: Please ref the attachment file 'input_stream.zip' below, target input "car_output.yuv" is generated from the other one 'car-detection_3840_2160_16s_1frame.mp4' by pure decode. Tips: only one frame in the video. [input_stream.zip](https://github.com/OpenVisualCloud/SVT-HEVC/files/3808325/input_stream.zip) - Command line: ./SvtHevcEncApp -i ./car_output.yuv -w 3840 -h 2160 -fps-num 25 -fps-denom 1 -tbr 5000000 -rc 1 -intra-period 29 -tune 1 -encMode 1 -profile -hierarchical-levels 0 -irefresh-type 2 -n 1 -b output.bin Tips: using deprecated param "tune" and with a blank value for param "profile". - Captures with different version: Problem occurred (228d8ef): ![CoreDump_v1 4 1_228d8ef](https://user-images.githubusercontent.com/49190050/68199158-72880580-fff8-11e9-99a6-b52cb05d444f.PNG) Problem occurred (tag v1.4.1 02fd126): ![CoreDump_v1 4 1_release](https://user-images.githubusercontent.com/49190050/68196949-4f5b5700-fff4-11e9-80aa-dcc7bf030cdf.PNG) No problem (tag v1.4.0 ca499c9): ![Safe_v1 4 0_release](https://user-images.githubusercontent.com/49190050/68199324-ce528e80-fff8-11e9-810d-24fb018db88b.PNG) No problem (tag v1.3.0 60076f7): ![Safe_v1 3 0_release](https://user-images.githubusercontent.com/49190050/68199401-f17d3e00-fff8-11e9-8378-61cdc98da074.PNG) - Bug basic analysis: GDB information as below: > [Thread debugging using libthread_db enabled] >Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". >Core was generated by `./SvtHevcEncApp -i ./car_output.yuv -w 3840 -h 2160 -fps-num 25 -fps-denom 1 -t'. >Program terminated with signal SIGSEGV, Segmentation fault. >#0 0x00007f2fef58ab24 in ApplySaoOffsetsPicture (contextPtr=contextPtr@entry=0x5621fd1ddd20, sequenceControlSetPtr=sequenceControlSetPtr@entry=0x5621404cf7b0, pictureControlSetPtr=pictureControlSetPtr@entry=0x5621b1400bd0) at /home/berta/sgc/SVT-HEVC/Source/Lib/Codec/EbEncDecProcess.c:569 569 tbOriginX = lcuParams->originX; >[Current thread is 1 (Thread 0x7f2d94872700 (LWP 74179))] >(gdb) L569~L573, originX / originY / width / height may use invalid pointer.
tianjunwork commented 4 years ago

Hi @xiajin-2007 , Thank you for reporting the issue and attached detailed information which helped us root cause the regression.

Austin-Hu commented 4 years ago

Hi @xiajin-2007 ,

It's a race condition issue which was exposed when PR #348 was merged, and it's not a regression issue actually. Because PR #348 makes some encoding kernel threads keep processing the input data meanwhile EbDeinitEncoder() is called to free some memory objects being accessed by some of those threads.

So fixed (worked around) this issue by PR #415 , and please also verify it in your side. Thanks!

BTW, PR #270 couldn't address such race condition, either, unfortunatelly.