The default logging makes pyav almost unusable for thread-parallelized workloads. Below is a trace obtained by py-spy:
$ py-spy top --pid 2875341 --native --full-filenames
%Own %Total OwnTime TotalTime Function (filename)
96.00% 96.00% 9.11s 9.11s __futex_abstimed_wait_common (/usr/lib64/libc.so.6)
88.00% 88.00% 8.06s 8.06s __lll_lock_wait (/usr/lib64/libc.so.6)
40.00% 40.00% 3.52s 3.52s pthread_cond_signal@@GLIBC_2.3.2 (/usr/lib64/libc.so.6)
37.00% 37.00% 2.27s 2.27s __lll_lock_wake (/usr/lib64/libc.so.6)
4.00% 31.00% 0.640s 2.89s pthread_mutex_lock@@GLIBC_2.2.5 (/usr/lib64/libc.so.6)
3.00% 40.00% 0.490s 2.76s __pthread_mutex_unlock_usercnt (/usr/lib64/libc.so.6)
5.00% 266.00% 0.310s 24.40s logging_log_callback (/project/src/av/logging.c)
The issue can be solved by actively disabling pyav's logging through av.logging.set_level(None).
However, since pyav by default hooks itself into python's logging system when av.logging is first imported,
there is no way to enforce this behavior if other modules are also using it (unless we import before everyone else, which isn't possible for library code).
I therefore propose two fixes:
- Make logging async and lock free.
- Do not hook into python's logging system unless explicitly asked.
The default logging makes pyav almost unusable for thread-parallelized workloads. Below is a trace obtained by
py-spy:The issue can be solved by actively disabling pyav's logging through
av.logging.set_level(None).However, since pyav by default hooks itself into python's logging system when
av.loggingis first imported,there is no way to enforce this behavior if other modules are also using it (unless we import before everyone else, which isn't possible for library code).
I therefore propose two fixes: