#7446(avcodec:new): x264 init race/corruption
#7446: x264 init race/corruption -------------------------------------+------------------------------------- Reporter: lukealonso | Type: defect Status: new | Priority: normal Component: avcodec | Version: Keywords: | unspecified Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Summary of the bug: I have a program that creates many concurrent instances of x264 via AVCodecContext. Occasionally, I'll get the following output: {{{ x264 [error]: invalid tune '[RANDOM JUNK]' }}} and avcodec_open2 will fail. I've attached a stripped down program that reproduces the issue, at least on Ubuntu 16.04. This appears to happen with all x264 versions, I tried the latest stable commit, and one from several years ago. This does *NOT* happen with older FFmpeg versions. I git bisected and found that the problem started happening on commit: {{{ [abaa12263e08ae7b2099f00fa4597ae6a86d7a9c] avcodec: Don't lock during open if the codec has threadsafe init] }}} .... which is not surprising, but not terribly helpful in finding what exactly is happening in X264_init that causes the issue. Hopefully this is just me being dumb, any pointers would be appreciated. How to reproduce: Build enc_test.c: {{{ gcc -o enc_test enc_test.c -lavcodec -lavformat -lavutil -lpthread }}} Run 1-10 times, with num_threads between 4-32, whatever is appropriate for your machine. Happens more often with higher thread counts. It should happen early on, so ctrl-c and try again if it hasn't happened with in a few seconds. {{{ ./enc_test [num_threads] }}} -- Ticket URL: <https://trac.ffmpeg.org/ticket/7446> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#7446: x264 init race/corruption -------------------------------------+----------------------------------- Reporter: lukealonso | Owner: Type: defect | Status: new Priority: normal | Component: avcodec Version: unspecified | Resolution: Keywords: libx264 | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+----------------------------------- Changes (by cehoyos): * keywords: => libx264 Comment: Please confirm that the issue is reproducible with current FFmpeg git head and current libx264 git head. -- Ticket URL: <https://trac.ffmpeg.org/ticket/7446#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#7446: x264 init race/corruption -------------------------------------+----------------------------------- Reporter: lukealonso | Owner: Type: defect | Status: new Priority: normal | Component: avcodec Version: unspecified | Resolution: Keywords: libx264 | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+----------------------------------- Comment (by lukealonso): Yes, it occurs with ffmpeg git head and libx264 git head. -- Ticket URL: <https://trac.ffmpeg.org/ticket/7446#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#7446: x264 init race/corruption -------------------------------------+------------------------------------- Reporter: lukealonso | Owner: Type: defect | Status: new Priority: important | Component: avcodec Version: git-master | Resolution: Keywords: libx264 | Blocked By: regression | Reproduced by developer: 0 Blocking: | Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by cehoyos): * keywords: libx264 => libx264 regression * priority: normal => important * version: unspecified => git-master Comment: Reproducible with both old and current x264. -- Ticket URL: <https://trac.ffmpeg.org/ticket/7446#comment:3> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#7446: x264 init race/corruption -------------------------------------+------------------------------------- Reporter: lukealonso | Owner: cus Type: defect | Status: open Priority: important | Component: avcodec Version: git-master | Resolution: Keywords: libx264 | Blocked By: regression | Reproduced by developer: 0 Blocking: | Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by cus): * cc: cus (added) * owner: => cus * status: new => open -- Ticket URL: <https://trac.ffmpeg.org/ticket/7446#comment:4> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#7446: x264 init race/corruption -------------------------------------+------------------------------------- Reporter: lukealonso | Owner: cus Type: defect | Status: closed Priority: important | Component: avcodec Version: git-master | Resolution: fixed Keywords: libx264 | Blocked By: regression | Reproduced by developer: 0 Blocking: | Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by cus): * status: open => closed * resolution: => fixed Comment: Fixed in b02490a497009064b7f192802aa246aa0b6a4dad. -- Ticket URL: <https://trac.ffmpeg.org/ticket/7446#comment:5> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg