Opened 5 years ago

Last modified 7 months ago

#7570 new defect

fate-h264-conformance-frext-hpcafl_bcrm_c failes with THREADS=3

Reported by: Carl Eugen Hoyos Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: h264 race regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Originally reported by Lauri Kasanen:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-November/236620.html
fate with THREADS=3 (and higher) fails (on Linux Power8) since bdbbb8f11edbf10add874508c5125c174d8939be, output looks different every time.

$ ./ffmpeg
ffmpeg version N-92534-g5a76171 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20180813 (Advance-Toolchain-at12.0) [revision 263510]
  configuration: --enable-gpl --cc=/opt/at12.0/bin/gcc
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 40.100 / 58. 40.100
  libavformat    58. 23.100 / 58. 23.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 46.100 /  7. 46.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
$ make THREADS=3 SAMPLES=../fate-suite fate-h264-conformance-frext-hpcafl_bcrm_c
TEST    h264-conformance-frext-hpcafl_bcrm_c
--- /home/cehoyos/Projects/FFmpeg/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c   2018-11-27 01:07:22.736918154 +0000
+++ tests/data/fate/h264-conformance-frext-hpcafl_bcrm_c        2018-11-27 01:16:26.170503653 +0000
@@ -178,7 +178,7 @@
 0,        172,        172,        1,   152064, 0x1c641176
 0,        173,        173,        1,   152064, 0xf71489a4
 0,        174,        174,        1,   152064, 0xd7ac5555
-0,        175,        175,        1,   152064, 0xb4609c6d
+0,        175,        175,        1,   152064, 0x99899c70
 0,        176,        176,        1,   152064, 0xf5b2bd5e
 0,        177,        177,        1,   152064, 0x9f43ce57
 0,        178,        178,        1,   152064, 0x77642dd3
@@ -280,7 +280,7 @@
 0,        274,        274,        1,   152064, 0xa5496a0c
 0,        275,        275,        1,   152064, 0x84c25549
 0,        276,        276,        1,   152064, 0x96691600
-0,        277,        277,        1,   152064, 0x423135db
+0,        277,        277,        1,   152064, 0x3f6e35db
 0,        278,        278,        1,   152064, 0x8d2e08b6
 0,        279,        279,        1,   152064, 0xaeb4c840
 0,        280,        280,        1,   152064, 0xf3e71780
Test h264-conformance-frext-hpcafl_bcrm_c failed. Look at tests/data/fate/h264-conformance-frext-hpcafl_bcrm_c.err for details.
make: *** [fate-h264-conformance-frext-hpcafl_bcrm_c] Error 1

The commit that introduced the regression fixed ticket #4893, the sample in http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4893/ is not supposed to stop playback / transcoding after 15 (of 30) seconds.

Change History (2)

comment:1 by Carl Eugen Hoyos, 4 years ago

Keywords: race added

comment:2 by mkver, 7 months ago

tsan shows races with this one:

WARNING: ThreadSanitizer: data race (pid=962636)
  Read of size 4 at 0x7b7000020118 by thread T6 (mutexes: write M0):
    #0 pred_temp_direct_motion src/libavcodec/h264_direct.c:504:9 (libavcodec.so.60+0x4384dc) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #1 ff_h264_pred_direct_motion src/libavcodec/h264_direct.c:726:9 (libavcodec.so.60+0x4384dc)
    #2 ff_h264_decode_mb_cabac src/libavcodec/h264_cabac.c:2124:17 (libavcodec.so.60+0x41c6ac) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #3 decode_slice src/libavcodec/h264_slice.c:2614:19 (libavcodec.so.60+0x485292) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #4 ff_h264_execute_decode_slices src/libavcodec/h264_slice.c:2788:15 (libavcodec.so.60+0x48473d) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #5 decode_nal_units src/libavcodec/h264dec.c:675:27 (libavcodec.so.60+0x49488f) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #6 h264_decode_frame src/libavcodec/h264dec.c:1047:17 (libavcodec.so.60+0x49488f)
    #7 frame_worker_thread src/libavcodec/pthread_frame.c:228:21 (libavcodec.so.60+0x82968c) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #8 <null> <null> (ffmpeg+0x58858) (BuildId: 861bb3de734715ec5061bd4c494dd54f21bed62e)

  Previous write of size 4 at 0x7b7000020118 by thread T4 (mutexes: write M1):
    #0 ff_h264_decode_mb_cabac src/libavcodec/h264_cabac.c:2392:31 (libavcodec.so.60+0x41eaf2) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #1 decode_slice src/libavcodec/h264_slice.c:2614:19 (libavcodec.so.60+0x485292) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #2 ff_h264_execute_decode_slices src/libavcodec/h264_slice.c:2788:15 (libavcodec.so.60+0x48473d) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #3 decode_nal_units src/libavcodec/h264dec.c:675:27 (libavcodec.so.60+0x49488f) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #4 h264_decode_frame src/libavcodec/h264dec.c:1047:17 (libavcodec.so.60+0x49488f)
    #5 frame_worker_thread src/libavcodec/pthread_frame.c:228:21 (libavcodec.so.60+0x82968c) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #6 <null> <null> (ffmpeg+0x58858) (BuildId: 861bb3de734715ec5061bd4c494dd54f21bed62e)

It also shows the same races in (at least) h264-conformance-frext-hpcaflnl_bcrm_c and h264-conformance-frext-hpcamapalq_bcrm_b. There is also a CAVLC analog:

WARNING: ThreadSanitizer: data race (pid=963052)
  Read of size 4 at 0x7b7000021118 by thread T6 (mutexes: write M0):
    #0 pred_temp_direct_motion src/libavcodec/h264_direct.c:504:9 (libavcodec.so.60+0x4384dc) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #1 ff_h264_pred_direct_motion src/libavcodec/h264_direct.c:726:9 (libavcodec.so.60+0x4384dc)
    #2 ff_h264_decode_mb_cavlc src/libavcodec/h264_cavlc.c:855:17 (libavcodec.so.60+0x42c78c) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #3 decode_slice src/libavcodec/h264_slice.c:2685:19 (libavcodec.so.60+0x485bff) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #4 ff_h264_execute_decode_slices src/libavcodec/h264_slice.c:2788:15 (libavcodec.so.60+0x48473d) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #5 decode_nal_units src/libavcodec/h264dec.c:675:27 (libavcodec.so.60+0x49488f) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #6 h264_decode_frame src/libavcodec/h264dec.c:1047:17 (libavcodec.so.60+0x49488f)
    #7 frame_worker_thread src/libavcodec/pthread_frame.c:228:21 (libavcodec.so.60+0x82968c) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #8 <null> <null> (ffmpeg+0x58858) (BuildId: 861bb3de734715ec5061bd4c494dd54f21bed62e)

  Previous write of size 4 at 0x7b7000021118 by thread T4 (mutexes: write M1):
    #0 ff_h264_decode_mb_cavlc src/libavcodec/h264_cavlc.c:1094:31 (libavcodec.so.60+0x4311ce) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #1 decode_slice src/libavcodec/h264_slice.c:2685:19 (libavcodec.so.60+0x485bff) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #2 ff_h264_execute_decode_slices src/libavcodec/h264_slice.c:2788:15 (libavcodec.so.60+0x48473d) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #3 decode_nal_units src/libavcodec/h264dec.c:675:27 (libavcodec.so.60+0x49488f) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #4 h264_decode_frame src/libavcodec/h264dec.c:1047:17 (libavcodec.so.60+0x49488f)
    #5 frame_worker_thread src/libavcodec/pthread_frame.c:228:21 (libavcodec.so.60+0x82968c) (BuildId: 275297ad43451441dc12abf5615000d86b6c49ef)
    #6 <null> <null> (ffmpeg+0x58858) (BuildId: 861bb3de734715ec5061bd4c494dd54f21bed62e)

This one happens (at least) in h264-conformance-frext-hpcvfl_bcrm_a, h264-conformance-frext-hpcvflnl_bcrm_a and h264-conformance-mr8_bt_b.

Notice that ubitux' tsan FATE-box uses two threads and therefore does not show these races.

Note: See TracTickets for help on using tickets.