pulsesink deadlock in gst_pulsesink_get_time

Chris Paulson-Ellis chris at edesix.com
Mon Jun 24 07:14:23 PDT 2013


Hi,

I have an otherwise working application that sometimes deadlocks when I try
and return the pipeline to the playing state after pausing. The 2 threads that
deadlock are the pulseaudio main loop thread (called "threaded-ml") and the
thread driving a queue & pulsesink (called "aqueue:src").

The "threaded-ml" thread holds the pulseaudio mainloop lock and is trying
to obtain the pulsesink element lock in a call to gst_element_post_message().

The "aqueue:src" thread holds the pulsesink element lock and is trying to
obtain the pulseaudio mainloop lock in a call to gst_pulsesink_get_time().

Here is a stack-trace of the 2 threads:

#0  0xf7fda430 in __kernel_vsyscall ()
#1  0xf72d54d2 in __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S:145
#2  0xf72d0e63 in _L_lock_693 () from /lib/libpthread.so.0
#3  0xf72d0ca8 in __pthread_mutex_lock (mutex=0x815e338) at pthread_mutex_lock.c:65
#4  0xf7f1b49f in gst_element_post_message (element=0x8160000 [GstPulseSink], message=0xea40e6d8 [GstMessage]) at ../../../../src/gstreamer-0.10.36/gst/gstelement.c:1842
#5  0xf6acaabe in mainloop_enter_defer_cb (api=0x81e5b48, userdata=0x8160000) at ../../../../../src/gst-plugins-good-0.10.31/ext/pulse/pulsesink.c:1147
#6  0xf6990fc1 in once_callback (m=0x81e5b48, e=0xeb819560, userdata=0xeb817dd0) at pulse/mainloop-api.c:48
#7  0xf69946b0 in dispatch_defer (m=0x81e5b08) at pulse/mainloop.c:713
#8  pa_mainloop_dispatch (m=0x81e5b08) at pulse/mainloop.c:924
#9  0xf69949f4 in pa_mainloop_iterate (m=0x81e5b08, block=1, retval=0x0) at pulse/mainloop.c:964
#10 0xf6994ab4 in pa_mainloop_run (m=0x81e5b08, retval=0x0) at pulse/mainloop.c:979
#11 0xf69a554f in thread (userdata=0x81ab3d8) at pulse/thread-mainloop.c:94
#12 0xf695d877 in internal_thread_func (userdata=0x81e5c38) at pulsecore/thread-posix.c:83
#13 0xf72cecd3 in start_thread (arg=0xf0b71b40) at pthread_create.c:309
#14 0xf720dd7e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133

#0  0xf7fda430 in __kernel_vsyscall ()
#1  0xf72cc88e in __pthread_mutex_lock_full (mutex=0xf72dfff4) at pthread_mutex_lock.c:307
#2  0xf695c5b0 in pa_mutex_lock (m=0x81e5ba8) at pulsecore/mutex-posix.c:90
#3  0xf69a5ac1 in pa_threaded_mainloop_lock (m=0x81ab3d8) at pulse/thread-mainloop.c:177
#4  0xf6acee3e in gst_pulsesink_get_time (sink=<optimized out>, clock=<optimized out>) at ../../../../../src/gst-plugins-good-0.10.31/ext/pulse/pulsesink.c:1981
#5  gst_pulsesink_get_time (clock=0x8163158 [GstAudioClock], sink=0x8160000 [GstPulseSink]) at ../../../../../src/gst-plugins-good-0.10.31/ext/pulse/pulsesink.c:1961
#6  0xf6a135b2 in gst_audio_clock_get_time (clock=0x8163158 [GstAudioClock]) at ../../../../../../src/gst-plugins-base-0.10.36/gst-libs/gst/audio/gstaudioclock.c:256
#7  0xf6a2b52d in gst_base_audio_sink_sync_latency (obj=0x84829f8 [GstBuffer], bsink=0x8160000 [GstPulseSink]) at ../../../../../../src/gst-plugins-base-0.10.36/gst-libs/gst/audio/gstbaseaudiosink.c:1431
#8  gst_base_audio_sink_render (bsink=0x8160000 [GstPulseSink], buf=0x84829f8 [GstBuffer]) at ../../../../../../src/gst-plugins-base-0.10.36/gst-libs/gst/audio/gstbaseaudiosink.c:1607
#9  0xf6b374ad in gst_base_sink_render_object (basesink=<optimized out>, pad=0x81544c0 [GstPad], obj_type=2 '\002', obj=0x84829f8) at ../../../../../../src/gstreamer-0.10.36/libs/gst/base/gstbasesink.c:3014
#10 0xf6b39123 in gst_base_sink_queue_object_unlocked (basesink=0x8160000 [GstPulseSink], pad=0x81544c0 [GstPad], obj_type=2 '\002', obj=0x84829f8, prerollable=1)
     at ../../../../../../src/gstreamer-0.10.36/libs/gst/base/gstbasesink.c:3295
#11 0xf6b39610 in gst_base_sink_chain_unlocked (basesink=0x8160000 [GstPulseSink], pad=0x81544c0 [GstPad], obj_type=2 '\002', obj=0x84829f8) at ../../../../../../src/gstreamer-0.10.36/libs/gst/base/gstbasesink.c:3677
#12 0xf6b39b00 in gst_base_sink_chain_main (basesink=<optimized out>, pad=0x81544c0 [GstPad], obj_type=2 '\002', obj=0x84829f8) at ../../../../../../src/gstreamer-0.10.36/libs/gst/base/gstbasesink.c:3715
#13 0xf7f391de in gst_pad_push (pad=0x81543f8 [GstPad], buffer=0x84829f8 [GstBuffer]) at ../../../../src/gstreamer-0.10.36/gst/gstpad.c:4710
#14 0xf6a68396 in gst_queue_push_one (queue=0x8155000 [GstQueue]) at ../../../../../src/gstreamer-0.10.36/plugins/elements/gstqueue.c:1156
#15 gst_queue_loop (pad=0x81543f8 [GstPad]) at ../../../../../src/gstreamer-0.10.36/plugins/elements/gstqueue.c:1264
#16 0xf7f607fa in gst_task_func (task=0x8196918 [GstTask]) at ../../../../src/gstreamer-0.10.36/gst/gsttask.c:327
#17 0xf7f6187c in default_func (tdata=0x81b4f18, pool=0x80a2040 [GstTaskPool]) at ../../../../src/gstreamer-0.10.36/gst/gsttaskpool.c:70
#18 0xf73508df in g_thread_pool_thread_proxy (data=0x80ac6d0) at gthreadpool.c:319
#19 0xf734e465 in g_thread_create_proxy (data=0x8297998) at gthread.c:1962
#20 0xf72cecd3 in start_thread (arg=0xec1ffb40) at pthread_create.c:309
#21 0xf720dd7e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133

I'm using 0.10.36 of core & gst-plugins-base and 0.10.31 of gst-plugins-good.
I can't use 1.x, because my program uses glimagesink from gst-plugins-gl.
I've looked at the code in git master and it doesn't seem to do this locking
in a different way to 0.10 as far as I can tell.

Any help would be much appreciated.

Regards,
Chris.



More information about the gstreamer-devel mailing list