[vlc-devel] Thread safety issues with ALSA/FontConfig?

Jérôme FORISSIER jerome at taodyne.com
Mon Jan 28 18:32:09 CET 2013


Hello,

Are there known thread safety issues when using LibVLC 2.0.5 with ALSA?
I use LibVLC in a C++ application. The app is multi-threaded, but I always call libvlc functions from the main thread.
Sometimes (but not always), when I start playing several videos simultaneously, I get error messages from ALSA, such as:

ALSA lib conf.c:4571:(parse_args) Unknown parameter CARD
ALSA lib conf.c:4571:(parse_args) Unknown parameter DEV
ALSA lib conf.c:4704:(snd_config_expand) Parse arguments error: No such file or directory
ALSA lib conf.c:4687:(snd_config_expand) Unknown parameters CARD=NVidia,DEV=0
ALSA lib conf.c:4571:(parse_args) Unknown parameter CARD
ALSA lib conf.c:4687:(snd_config_expand) Unknown parameters CARD=PCH,DEV=0
ALSA lib conf.c:4687:(snd_config_expand) Unknown parameters CARD=NVidia,DEV=0
ALSA lib conf.c:4571:(parse_args) Unknown parameter DEV

Another run, different errors:

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.ICE1724.pcm.rear.1:CARD=Juli'
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4720:(snd_config_expand) Evaluate error: No such file or directory

Yet another run:

ALSA lib conf.c:4571:(parse_args) Unknown parameter DEV
ALSA lib conf.c:4571:(parse_args) Unknown parameter CARD
ALSA lib conf.c:4571:(parse_args) Unknown parameter CARD
ALSA lib conf.c:4571:(parse_args) Unknown parameter CARD
ALSA lib conf.c:4571:(parse_args) Unknown parameter CARD
ALSA lib conf.c:4571:(parse_args) Unknown parameter DEV
ALSA lib conf.c:4704:(snd_config_expand) Parse arguments error: No such file or directory

I never observed any error when playing back a single video, however. That's why I'm suspecting some kind of race condition between the multiple player instances.

Possibly related: I also observed a rare crash in libfontconfig (glibc assert):

(gdb) bt
#0  0x00007f54d53d4425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007f54d53d7b10 in __GI_abort () at abort.c:120
#2  0x00007f54d541239e in __libc_message (do_abort=2, fmt=0x7f54d551c008 "*** glibc detected *** %s: %s: 0x%s ***\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:201
#3  0x00007f54d541cb96 in malloc_printerr (action=3, str=0x7f54d551c168 "double free or corruption (out)", ptr=<optimized out>) at malloc.c:5007
#4  0x00007f54d1a4dcc1 in ?? () from /usr/lib/nvidia-current-updates/tls/libnvidia-tls.so.304.43
#5  0x00007f54d28e05b8 in ?? () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
#6  0x00007f54d28e088f in FcPatternDestroy () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
#7  0x00007f54545c55a0 in FontConfig_Select (family=0x7f5430002a80 "Serif Bold", b_bold=false, b_italic=false, i_size=<optimized out>, i_idx=0x7f54653be5b8, config=0x0) at freetype.c:538
#8  0x00007f54545c5b9f in Create (p_this=0x7f5430002418) at freetype.c:2717
#9  0x00007f54b640752e in vlc_module_load (p_this=0x7f5430002418, psz_capability=0x7f54b64369be "text renderer", psz_name=<optimized out>, b_strict=false, probe=0x7f54b6406ed0 <generic_start>)
    at modules/modules.c:347
#10 0x00007f54b63eb704 in SpuRenderCreateAndLoadText (spu=0x7f54300015e8) at video_output/vout_subpictures.c:220
#11 0x00007f54b63ebb57 in spu_Create (object=<optimized out>) at video_output/vout_subpictures.c:1245
#12 0x00007f54b63e88c2 in VoutCreate (cfg=0x7f54653be8f0, object=0x75d9bd8) at video_output/video_output.c:148
#13 vout_Request (object=0x75d9bd8, cfg=0x7f54653be8f0) at video_output/video_output.c:231
#14 0x00007f54b63d8da3 in RequestVout (b_recycle=<optimized out>, dpb_size=31, p_fmt=0x7f54653be960, p_vout=0x0, p_resource=0x7266ed0) at input/resource.c:238
#15 input_resource_RequestVout (p_resource=0x7266ed0, p_vout=<optimized out>, p_fmt=0x7f54653be960, dpb_size=31, b_recycle=<optimized out>) at input/resource.c:480
#16 0x00007f54b63c1a2e in vout_new_buffer (p_dec=0x7f54700113a8) at input/decoder.c:2427

My impression is that ALSA and FontConfig are not thread-safe, but that libVLC does not properly serialize access to these APIs.
Any suggestions?

Thanks,

-- 
Jerome




More information about the vlc-devel mailing list