After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 556986 - pulsesink deadlocks when raising an error
pulsesink deadlocks when raising an error
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.x
Other Linux
: Normal normal
: 0.10.14
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 573562 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-10-19 19:39 UTC by Sjoerd Simons
Modified: 2009-03-03 11:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sjoerd Simons 2008-10-19 19:39:33 UTC
To reproduce:
  $ gst-launch audiotestsrc ! pulsesink
- Kill you pulse server
- gst-launch tries to go into pause but hangs there

Backtrace:
arting program: /usr/bin/gst-launch-0.10 audiotestsrc \! pulsesink
[Thread debugging using libthread_db enabled]
[New Thread 0x480231a0 (LWP 23892)]
[New Thread 0x489e24d0 (LWP 23895)]
Setting pipeline to PAUSED ...
[New Thread 0x491e24d0 (LWP 23896)]
[Thread 0x491e24d0 (LWP 23896) exited]
[New Thread 0x491e24d0 (LWP 23897)]
Pipeline is PREROLLING ...
[New Thread 0x4d9e34d0 (LWP 23898)]
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstAudioSinkClock
ERROR: from element /GstPipeline:pipeline0/GstPulseSink:pulsesink0: Disconnected: Conn    ection terminated
Additional debug info:
pulsesink.c(684): gst_pulsesink_write (): /GstPipeline:pipeline0/GstPulseSink:pulsesin    k0
Execution ended after 3680822000 ns.
Setting pipeline to PAUSED ...


^C
Program received signal SIGINT, Interrupt.

Thread 1208103328 (LWP 23892)

  • #0 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #1 ??
    from /usr/lib/libpulse.so.0
  • #2 pa_threaded_mainloop_lock
    from /usr/lib/libpulse.so.0
  • #3 gst_pulsesink_reset
    at pulsesink.c line 777
  • #4 ??
    from /usr/lib/libgstaudio-0.10.so.0
  • #5 ??
    from /usr/lib/libgstaudio-0.10.so.0
  • #6 gst_ring_buffer_pause
    from /usr/lib/libgstaudio-0.10.so.0
  • #7 ??
    from /usr/lib/libgstaudio-0.10.so.0
  • #8 gst_pulsesink_change_state
    at pulsesink.c line 928
  • #9 gst_element_change_state
    at gstelement.c line 2427
  • #10 gst_element_set_state_func
    at gstelement.c line 2377
  • #11 gst_element_set_state
    at gstelement.c line 2280
  • #12 gst_bin_change_state_func
    at gstbin.c line 1932
  • #13 gst_pipeline_change_state
    at gstpipeline.c line 463
  • #14 gst_element_change_state
    at gstelement.c line 2427
  • #15 gst_element_set_state_func
    at gstelement.c line 2377
  • #16 gst_element_set_state
    at gstelement.c line 2280
  • #17 main
    at gst-launch.c line 785

Thread 5 (Thread 0x4d9e34d0 (LWP 23898))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #2 gst_object_get_name
    at gstobject.c line 702
  • #3 gst_object_get_path_string
    at gstobject.c line 1103
  • #4 gst_element_message_full
    at gstelement.c line 1663
  • #5 gst_pulsesink_write
    at pulsesink.c line 684
  • #6 ??
    from /usr/lib/libgstaudio-0.10.so.0
  • #7 g_thread_create_proxy
    at /build/buildd/glib2.0-2.16.6/glib/gthread.c line 635
  • #8 start_thread
    from /lib/libpthread.so.0
  • #9 clone
    from /lib/libc.so.6

Thread 4 (Thread 0x491e24d0 (LWP 23897))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #2 gst_ring_buffer_is_acquired
    from /usr/lib/libgstaudio-0.10.so.0
  • #3 ??
    from /usr/lib/libgstaudio-0.10.so.0
  • #4 gst_base_sink_render_object
    at gstbasesink.c line 2189
  • #5 gst_base_sink_queue_object_unlocked
    at gstbasesink.c line 2384
  • #6 gst_base_sink_chain_unlocked
    at gstbasesink.c line 2728
  • #7 gst_base_sink_chain
    at gstbasesink.c line 2769
  • #8 gst_pad_chain_unchecked
    at gstpad.c line 3877
  • #9 gst_pad_push
    at gstpad.c line 4045
  • #10 gst_base_src_loop
    at gstbasesrc.c line 2187
  • #11 gst_task_func
    at gsttask.c line 192
  • #12 g_thread_pool_thread_proxy
    at /build/buildd/glib2.0-2.16.6/glib/gthreadpool.c line 265
  • #13 g_thread_create_proxy
    at /build/buildd/glib2.0-2.16.6/glib/gthread.c line 635
  • #14 start_thread
    from /lib/libpthread.so.0
  • #15 clone
    from /lib/libc.so.6

Thread 1 (Thread 0x480231a0 (LWP 23892))

  • #0 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #1 ??
    from /usr/lib/libpulse.so.0
  • #2 pa_threaded_mainloop_lock
    from /usr/lib/libpulse.so.0
  • #3 gst_pulsesink_reset
    at pulsesink.c line 777
  • #4 ??
    from /usr/lib/libgstaudio-0.10.so.0
  • #5 ??
    from /usr/lib/libgstaudio-0.10.so.0
  • #6 gst_ring_buffer_pause
    from /usr/lib/libgstaudio-0.10.so.0
  • #7 ??
    from /usr/lib/libgstaudio-0.10.so.0
  • #8 gst_pulsesink_change_state
    at pulsesink.c line 928
  • #9 gst_element_change_state
    at gstelement.c line 2427
  • #10 gst_element_set_state_func
    at gstelement.c line 2377
  • #11 gst_element_set_state
    at gstelement.c line 2280
  • #12 gst_bin_change_state_func
    at gstbin.c line 1932
  • #13 gst_pipeline_change_state
    at gstpipeline.c line 463
  • #14 gst_element_change_state
    at gstelement.c line 2427
  • #15 gst_element_set_state_func
    at gstelement.c line 2377
  • #16 gst_element_set_state
    at gstelement.c line 2280
  • #17 main
    at gst-launch.c line 785


This is with -plugins-good 0.10.10.3
Comment 1 Jan Schmidt 2008-10-20 10:10:04 UTC
There's a locking order problem here. Pulsesink is holding the pulse mainloop lock while throwing the element error, which tries to take the object lock and read the object name. One of the other threads is attempting to acquire the pulseaudio lock while holding the element object lock (the set_state() thread, I imagine), leading to deadlock.

The fix is probably to ensure that we drop the pulseaudio mainloop lock in all cases before throwing an error.
Comment 2 Sebastian Dröge (slomo) 2008-11-24 11:18:57 UTC
After unlocking the pulse main loop before throwing any error messages it still deadlocks the same way.
Comment 3 Sebastian Dröge (slomo) 2009-01-05 17:31:43 UTC
This is fixed by these two changes:

2009-01-05  Wim Taymans  <wim.taymans@collabora.co.uk>

        * gst-libs/gst/audio/gstbaseaudiosink.c:
        (gst_base_audio_sink_change_state):
        Avoid holding the OBJECT_LOCK when calling ringbuffer functions that
        take the ringbuffer lock because rinbuffer lock > OBJECT_LOCK. We can do
        this because the async_play method is deprecated and usually not called
        anymore.

2009-01-05  Sebastian Dröge  <sebastian.droege@collabora.co.uk>

	* ext/pulse/pulsesink.c: (gst_pulsesink_destroy_stream):
	Don't wait for the pulse mainloop when destroying the stream.
	Fixes a deadlock when the pulsedaemon goes away while pulsesink
	is PLAYING. Fixes bug #556986.
Comment 4 Bastien Nocera 2009-03-03 11:32:30 UTC
*** Bug 573562 has been marked as a duplicate of this bug. ***