testsuite: test_src_player randomly get stuck in title test
See: https://code.videolan.org/alexandre-janniaux/vlc/-/jobs/1064432
Compiled with TSAN with branch !2144 (merged):
[00007b2800000000] main libvlc warning: cannot read /home/janniaux/Projects/videolabs/vlc/build-tsan/src/.libs/vlc/plugins/plugins.dat: No such file or directory
[00007b4400000640] main audio output error: no suitable audio output module
[00007b4400019f00] main audio output error: no suitable audio output module
[00007b6c0000fc00] main decoder error: buffer deadlock prevented
[00007b6000010000] main video output error: video output display creation failed
[00007b6c00010300] main decoder error: buffer deadlock prevented
[00007b2800000000] main libvlc warning: cannot read /home/janniaux/Projects/videolabs/vlc/build-tsan/src/.libs/vlc/plugins/plugins.dat: No such file or directory
[00007b6c0000fc00] main decoder error: buffer deadlock prevented
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00010300] main decoder error: buffer deadlock prevented
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00010300] main decoder error: buffer deadlock prevented
[00007b6c0000fc00] main decoder error: buffer deadlock prevented
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b7800009000] main input error: EsOutTimeshift does not work with streams that have pace control
[00007b7800009000] main input warning: cannot set pause state at es_out level
[00007b7800009000] main input: cannot set rate faster
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b6c00020600] main subpicture warning: original picture size is undefined
[00007b7800009c00] main input warning: INPUT_CONTROL_SET_TIME @0 failed or not possible
[00007b780000b400] main input error: Your input can't be opened
[00007b780000b400] main input error: VLC is unable to open the MRL 'unknownuri://foo'. Check the log for details.
[00007b6c00020600] main subpicture warning: original picture size is undefined
testapi: test_no_outputs
testapi: test_outputs
testapi: same_media
testapi: current_media
testapi: next_media
testapi: seeks
testapi: pause
testapi: capabilites_pause
testapi: capabilites_seek
testapi: error
testapi: unknown_uri
testapi: titles (null_names: 1)
FAIL test_src_player (exit status: 134)
Stacktrace looks like this, so it might not look like a deadlock, because:
- vout is still running.
- the input has not been marked to be destroyed by the player destructor thread.
- the test is only waiting for stopped to be reached.
- it's randomly failing without TSAN complaining.
I'm not exactly sure why it's mostly triggered from my branch only with TSAN enabled.
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f4817b5dce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6
[Current thread is 1 (Thread 0x7f4817619800 (LWP 35642))]
Thread 13 (Thread 0x7f4816fb8700 (LWP 36050)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f4816fb7d80) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f4816fb7d80) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f4816fb7dc0, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=0x7f48100fae08, mutex=0x7f48100fadf8) at misc/threads.c:298
#5 0x00007f4817d91955 in vlc_queue_Wait (q=<optimized out>) at ../include/vlc_queue.h:122
#6 vlc_fifo_Wait (fifo=<optimized out>) at ../include/vlc_frame.h:664
#7 DecoderThread (p_data=0x7f48100fa700) at input/decoder.c:1785
#8 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#9 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 12 (Thread 0x7f4814516700 (LWP 36052)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b52b in sys_futex (val3=-1, addr2=0x0, to=<optimized out>, val=0, op=137, addr=0x7f4814515cb0) at linux/thread.c:82
#2 vlc_futex_wait (to=<optimized out>, val=0, flags=0, addr=0x7f4814515cb0) at linux/thread.c:93
#3 vlc_atomic_timedwait (addr=addr@entry=0x7f4814515cb0, val=val@entry=0, deadline=deadline@entry=29630620055267) at linux/thread.c:116
#4 0x00007f4817dfbe1f in vlc_cond_timedwait (cond=0x7f481000a410, mutex=0x7f481000a400, deadline=deadline@entry=29630620055267) at misc/threads.c:312
#5 0x00007f4817d8d379 in vlc_clock_Wait (clock=<optimized out>, deadline=deadline@entry=29630620055267) at clock/clock.c:387
#6 0x00007f4817dd21fa in RenderPicture (sys=sys@entry=0x7f480c023740, render_now=<optimized out>, render_now@entry=false) at video_output/video_output.c:1304
#7 0x00007f4817dd2739 in DisplayPicture (vout=0x7f480c023740) at video_output/video_output.c:1421
#8 Thread (object=0x7f480c023740) at video_output/video_output.c:1751
#9 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#10 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 11 (Thread 0x7f48175be700 (LWP 35695)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f48175bdda0) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f48175bdda0) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f48175bdde0, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=cond@entry=0x55f9bba4e9e8, mutex=mutex@entry=0x55f9bba4e990) at misc/threads.c:298
#5 0x00007f4817df1d1c in QueueTake (executor=0x55f9bba4e990) at misc/executor.c:98
#6 ThreadRun (userdata=0x55f9bbacfe30) at misc/executor.c:128
#7 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#8 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 10 (Thread 0x7f4816ea5700 (LWP 35701)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b52b in sys_futex (val3=-1, addr2=0x0, to=<optimized out>, val=0, op=137, addr=0x7f4816ea4dd0) at linux/thread.c:82
#2 vlc_futex_wait (to=<optimized out>, val=0, flags=0, addr=0x7f4816ea4dd0) at linux/thread.c:93
#3 vlc_atomic_timedwait (addr=addr@entry=0x7f4816ea4dd0, val=val@entry=0, deadline=deadline@entry=29630624172847) at linux/thread.c:116
#4 0x00007f4817dfbe1f in vlc_cond_timedwait (cond=cond@entry=0x7f480c0058c8, mutex=mutex@entry=0x7f480c0058e0, deadline=deadline@entry=29630624172847) at misc/threads.c:312
#5 0x00007f4817e0c2f1 in vlc_timer_thread (data=0x7f480c0058c0) at posix/timer.c:87
#6 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#7 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 9 (Thread 0x7f48170b9700 (LWP 36051)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f48170b8d80) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f48170b8d80) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f48170b8dc0, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=0x7f48100fb808, mutex=0x7f48100fb7f8) at misc/threads.c:298
#5 0x00007f4817d91955 in vlc_queue_Wait (q=<optimized out>) at ../include/vlc_queue.h:122
#6 vlc_fifo_Wait (fifo=<optimized out>) at ../include/vlc_frame.h:664
#7 DecoderThread (p_data=0x7f48100fb100) at input/decoder.c:1785
#8 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#9 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 8 (Thread 0x7f48172bb700 (LWP 35692)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f48172bada0) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f48172bada0) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f48172bade0, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=cond@entry=0x55f9bba52718, mutex=mutex@entry=0x55f9bba526c0) at misc/threads.c:298
#5 0x00007f4817df1d1c in QueueTake (executor=0x55f9bba526c0) at misc/executor.c:98
#6 ThreadRun (userdata=0x7f480c008670) at misc/executor.c:128
#7 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#8 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 7 (Thread 0x7f48171ba700 (LWP 35691)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f48171b9da0) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f48171b9da0) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f48171b9de0, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=cond@entry=0x55f9bba52e38, mutex=mutex@entry=0x55f9bba52de0) at misc/threads.c:298
#5 0x00007f4817df1d1c in QueueTake (executor=0x55f9bba52de0) at misc/executor.c:98
#6 ThreadRun (userdata=0x55f9bba4f2b0) at misc/executor.c:128
#7 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#8 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 6 (Thread 0x7f48143eb700 (LWP 36049)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b52b in sys_futex (val3=-1, addr2=0x0, to=<optimized out>, val=0, op=137, addr=0x7f48143eac60) at linux/thread.c:82
#2 vlc_futex_wait (to=<optimized out>, val=0, flags=0, addr=0x7f48143eac60) at linux/thread.c:93
#3 vlc_atomic_timedwait (addr=addr@entry=0x7f48143eac60, val=val@entry=0, deadline=deadline@entry=29630620090915) at linux/thread.c:116
#4 0x00007f4817dfbe1f in vlc_cond_timedwait (cond=cond@entry=0x55f9bbace1e0, mutex=mutex@entry=0x55f9bbace1d0, deadline=deadline@entry=29630620090915) at misc/threads.c:312
#5 0x00007f4817daa3dd in ControlPop (b_postpone_seek=false, i_deadline=29630620090915, p_param=<synthetic pointer>, pi_type=<synthetic pointer>, p_input=<optimized out>) at input/input.c:1546
#6 MainLoop (p_input=p_input@entry=0x55f9bbace0e0, b_interactive=b_interactive@entry=true) at input/input.c:714
#7 0x00007f4817dab5cd in Run (data=0x55f9bbace0e0) at input/input.c:428
#8 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#9 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 5 (Thread 0x7f48174bd700 (LWP 35694)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f48174bcda0) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f48174bcda0) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f48174bcde0, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=cond@entry=0x55f9bba4ff58, mutex=mutex@entry=0x55f9bba4ff00) at misc/threads.c:298
#5 0x00007f4817df1d1c in QueueTake (executor=0x55f9bba4ff00) at misc/executor.c:98
#6 ThreadRun (userdata=0x55f9bba4e370) at misc/executor.c:128
#7 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#8 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 4 (Thread 0x7f4816d9f700 (LWP 35700)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f4816d9ebf0) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f4816d9ebf0) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f4816d9ec30, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=cond@entry=0x7f480c03e430, mutex=mutex@entry=0x7f480c03e420) at misc/threads.c:298
#5 0x00007f4817dd8718 in spu_PrerenderThread (priv=0x7f480c03df30) at video_output/vout_subpictures.c:1533
#6 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#7 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 3 (Thread 0x7f48142db700 (LWP 35696)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f48142dad50) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f48142dad50) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f48142dad90, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=cond@entry=0x55f9bba4fb48, mutex=mutex@entry=0x55f9bba4fa28) at misc/threads.c:298
#5 0x00007f4817db02d4 in vlc_player_destructor_Thread (data=0x55f9bba4fa10) at player/player.c:217
#6 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#7 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 2 (Thread 0x7f48173bc700 (LWP 35693)):
#0 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7f48173bbda0) at linux/thread.c:82
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7f48173bbda0) at linux/thread.c:93
#3 vlc_atomic_wait (addr=addr@entry=0x7f48173bbde0, val=val@entry=0) at linux/thread.c:109
#4 0x00007f4817dfbd37 in vlc_cond_wait (cond=cond@entry=0x55f9bba507a8, mutex=mutex@entry=0x55f9bba50750) at misc/threads.c:298
#5 0x00007f4817df1d1c in QueueTake (executor=0x55f9bba50750) at misc/executor.c:98
#6 ThreadRun (userdata=0x55f9bba4dee0) at misc/executor.c:128
#7 0x00007f4817cefea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#8 0x00007f4817c1fdef in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 1 (Thread 0x7f4817619800 (LWP 35642)):
#0 0x00007f4817b5dce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4817b47537 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x000055f9baaf05e5 in on_timeout (signum=<optimized out>) at src/player/../../libvlc/test.h:69
#3 <signal handler called>
#4 0x00007f4817c1a9b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#5 0x00007f4817e0b4d2 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7ffdc69d9890) at linux/thread.c:82
#6 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7ffdc69d9890) at linux/thread.c:93
#7 vlc_atomic_wait (addr=addr@entry=0x7ffdc69d98d0, val=val@entry=0) at linux/thread.c:109
#8 0x00007f4817dfbd37 in vlc_cond_wait (cond=cond@entry=0x7ffdc69d9bf8, mutex=0x55f9bba4fa28) at misc/threads.c:298
#9 0x00007f4817db03a1 in vlc_player_CondWait (player=<optimized out>, cond=cond@entry=0x7ffdc69d9bf8) at player/player.c:968
#10 0x000055f9baaf4fa7 in wait_state (ctx=0x7ffdc69d9b10, state=VLC_PLAYER_STATE_STOPPED) at src/player/player.c:585
#11 0x000055f9baafad79 in test_titles (ctx=ctx@entry=0x7ffdc69d9b10, null_names=null_names@entry=true) at src/player/player.c:1628
#12 0x000055f9baaf1b57 in main () at src/player/player.c:2920
Of course, the following diff fixes the issue:
diff --git a/test/src/player/player.c b/test/src/player/player.c
index 61db7611c3..9a9b85da43 100644
--- a/test/src/player/player.c
+++ b/test/src/player/player.c
@@ -1625,6 +1625,7 @@ test_titles(struct ctx *ctx, bool null_names)
}
test_prestop(ctx);
+ vlc_player_Stop(player);
wait_state(ctx, VLC_PLAYER_STATE_STOPPED);
assert_normal_state(ctx);
test_end(ctx);