[FFmpeg-devel] [PATCH] ffmpeg: make reading packets from thread blocking.

Michael Niedermayer michaelni at gmx.at
Wed Oct 30 15:52:32 CET 2013


On Wed, Oct 30, 2013 at 03:35:37PM +0100, Michael Niedermayer wrote:
> On Wed, Oct 30, 2013 at 02:44:52PM +0100, Nicolas George wrote:
> > Le nonidi 9 brumaire, an CCXXII, Michael Niedermayer a écrit :
> > > this code deadlocked 1 out of 2 make -j12 fate
> > 
> > I did not manage to reproduce it even once. With how many cores /
> > hyperthreads does it happen?
> 
> 6 physical cores 12 logical ones
> 
> 
> > Do you happen to remember the test(s) that got
> > stuck?
> 
> sadly not but i could reproduce it here again stuck in
> fate-filter-amix-transition
> but even running that 100 times shows no deadlock, seems it happens
> only in a full fate run for me
> 
> 
> 
> also from looking at the code i see that finished could get set
> while the other thread is waiting, i didnt check if that would deadlock
> though
> also iam not sure that fifo_cond should be reused

i managed to make it happen with a binary with debug symbols in it:
(gdb) thread apply all bt

Thread 15 (Thread 0x2ad0d6cf4700 (LWP 31775)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d6cf4700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 14 (Thread 0x2ad0d6ef5700 (LWP 31776)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d6ef5700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 13 (Thread 0x2ad0d70f6700 (LWP 31777)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d70f6700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 12 (Thread 0x2ad0d72f7700 (LWP 31778)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d72f7700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 11 (Thread 0x2ad0d74f8700 (LWP 31780)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d74f8700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 10 (Thread 0x2ad0d76f9700 (LWP 31781)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d76f9700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 9 (Thread 0x2ad0d78fa700 (LWP 31782)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d78fa700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 8 (Thread 0x2ad0d7afb700 (LWP 31783)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d7afb700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 7 (Thread 0x2ad0d7cfc700 (LWP 31784)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d7cfc700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 6 (Thread 0x2ad0d7efd700 (LWP 31785)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d7efd700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x2ad0d80fe700 (LWP 31786)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d80fe700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x2ad0d82ff700 (LWP 31787)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
---Type <return> to continue, or q <return> to quit---
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d82ff700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x2ad0d8500700 (LWP 31788)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00000000004ab4eb in worker (v=0x2566f00) at libavfilter/pthread.c:81
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d8500700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x2ad0d8701700 (LWP 31805)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x000000000048213b in input_thread (arg=0x246bf60) at ffmpeg.c:2799
#2  0x00002ad0d2e05e9a in start_thread (arg=0x2ad0d8701700) at pthread_create.c:308
#3  0x00002ad0d310eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x2ad0d6af16c0 (LWP 31721)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x0000000000488573 in get_input_packet_mt (pkt=0x7fff6bf8bb90, f=0x2566d20) at ffmpeg.c:2893
#2  get_input_packet (pkt=0x7fff6bf8bb90, f=0x2566d20) at ffmpeg.c:2918
#3  process_input (file_index=1) at ffmpeg.c:2957
#4  0x000000000047745e in transcode_step () at ffmpeg.c:3227
#5  transcode () at ffmpeg.c:3279
#6  main (argc=<optimized out>, argv=<optimized out>) at ffmpeg.c:3457


[...]


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131030/b8682799/attachment.asc>


More information about the ffmpeg-devel mailing list