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 756828 - Deadlocks in rhythmbox at the end of a song
Deadlocks in rhythmbox at the end of a song
Status: RESOLVED OBSOLETE
Product: rhythmbox
Classification: Other
Component: general
HEAD
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-19 20:31 UTC by Lionel Landwerlin
Modified: 2018-05-24 18:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
playbin: do not deadlock the main & streaming threads (2.07 KB, patch)
2015-10-20 23:01 UTC, Lionel Landwerlin
needs-work Details | Review

Description Lionel Landwerlin 2015-10-19 20:31:35 UTC
Here are the backtraces of all the threads : 

(gdb) thread apply all bt

Thread 2 (Thread 0x7f7e85f13700 (LWP 2963))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./glib/gthread-posix.c line 1397
  • #2 0x00007f7eca78e9aa in
  • #3 _g_closure_invoke_va
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gclosure.c line 864
  • #4 g_signal_emit_valist
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gsignal.c line 3292
  • #5 g_signal_emit
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gsignal.c line 3439
  • #6 drained_cb
    at gstplaybin2.c line 3831
  • #7 _g_closure_invoke_va
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gclosure.c line 864
  • #8 g_signal_emit_valist
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gsignal.c line 3292
  • #9 g_signal_emit
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gsignal.c line 3439
  • #10 _g_closure_invoke_va
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gclosure.c line 864
  • #11 g_signal_emit_valist
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gsignal.c line 3292
  • #12 g_signal_emit
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gsignal.c line 3439
  • #13 drain_and_switch_chains
    at gstdecodebin2.c line 4096
  • #14 source_pad_event_probe
    at gstdecodebin2.c line 4115
  • #15 source_pad_event_probe
    at gstdecodebin2.c line 4843
  • #16 probe_hook_marshal
    at gstpad.c line 3353
  • #17 g_hook_list_marshal
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./glib/ghook.c line 672
  • #18 do_probe_callbacks
    at gstpad.c line 3505
  • #19 gst_pad_push_event_unchecked
    at gstpad.c line 5097
  • #20 push_sticky
    at gstpad.c line 3690
  • #21 events_foreach
    at gstpad.c line 597
  • #22 gst_pad_push_event
    at gstpad.c line 3746
  • #23 gst_pad_push_event
    at gstpad.c line 5252
  • #24 event_forward_func
    at gstpad.c line 2896
  • #25 gst_pad_forward
    at gstpad.c line 2850
  • #26 gst_pad_event_default
    at gstpad.c line 2947
  • #27 gst_pad_send_event_unchecked
    at gstpad.c line 5452
  • #28 gst_pad_push_event_unchecked
    at gstpad.c line 5123
  • #29 push_sticky
    at gstpad.c line 3690
  • #30 events_foreach
    at gstpad.c line 597
  • #31 gst_pad_push_event
    at gstpad.c line 3746
  • #32 gst_pad_push_event
    at gstpad.c line 5252
  • #33 gst_audio_decoder_push_event
    at gstaudiodecoder.c line 686
  • #34 gst_audio_decoder_sink_eventfunc
    at gstaudiodecoder.c line 2286
  • #35 gst_pad_send_event_unchecked
    at gstpad.c line 5452
  • #36 gst_pad_push_event_unchecked
    at gstpad.c line 5123
  • #37 push_sticky
    at gstpad.c line 3690
  • #38 events_foreach
    at gstpad.c line 597
  • #39 gst_pad_push_event
    at gstpad.c line 3746
  • #40 gst_pad_push_event
    at gstpad.c line 5252
  • #41 gst_base_parse_loop
    at gstbaseparse.c line 3467
  • #42 gst_task_func
    at gsttask.c line 331
  • #43 g_thread_pool_thread_proxy
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./glib/gthreadpool.c line 307
  • #44 g_thread_proxy
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./glib/gthread.c line 778
  • #45 start_thread
    at pthread_create.c line 309
  • #46 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 111

Thread 1 (Thread 0x7f7ecab04ac0 (LWP 2915))

  • #0 __lll_lock_wait
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S line 135
  • #1 _L_lock_986
  • #2 __GI___pthread_mutex_lock
    at ../nptl/pthread_mutex_lock.c line 114
  • #3 gst_pad_activate_mode
    at gstpad.c line 1006
  • #4 gst_pad_activate_mode
    at gstpad.c line 1194
  • #5 gst_ghost_pad_activate_push_default
    at gstghostpad.c line 379
  • #6 gst_pad_activate_mode
    at gstpad.c line 1187
  • #7 gst_pad_set_active
    at gstpad.c line 1071
  • #8 activate_pads
    at gstbin.c line 2382
  • #9 gst_iterator_fold
    at gstiterator.c line 614
  • #10 gst_bin_src_pads_activate
    at gstbin.c line 2405
  • #11 gst_bin_src_pads_activate
    at gstbin.c line 2439
  • #12 gst_bin_change_state_func
    at gstbin.c line 2629
  • #13 gst_decode_bin_change_state
    at gstdecodebin2.c line 5150
  • #14 gst_element_change_state
    at gstelement.c line 2604
  • #15 gst_element_set_state_func
    at gstelement.c line 2560
  • #16 gst_bin_change_state_func
    at gstbin.c line 2341
  • #17 gst_bin_change_state_func
    at gstbin.c line 2694
  • #18 gst_uri_decode_bin_change_state
    at gsturidecodebin.c line 2752
  • #19 gst_element_change_state
    at gstelement.c line 2604
  • #20 gst_element_set_state_func
    at gstelement.c line 2560
  • #21 gst_bin_change_state_func
    at gstbin.c line 2341
  • #22 gst_bin_change_state_func
    at gstbin.c line 2694
  • #23 gst_play_bin_change_state
    at gstplaybin2.c line 5675
  • #24 gst_element_change_state
    at gstelement.c line 2604
  • #25 gst_element_continue_state
    at gstelement.c line 2314
  • #26 gst_element_change_state
    at gstelement.c line 2641
  • #27 gst_element_set_state_func
    at gstelement.c line 2560
  • #28 0x00007f7eca78d32f in
  • #29 0x00007f7eca78d878 in
  • #30 0x00007f7eca706b76 in
  • #31 0x00007f7eca709820 in
  • #32 0x00007f7eca709ba2 in
  • #36 <emit signal ??? on instance 0x249f8d0 [RBPlayerGst]>
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gobject/gsignal.c line 3439
  • #37 0x00007f7eca78caf1 in
  • #38 g_main_context_dispatch
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./glib/gmain.c line 3154
  • #39 g_main_context_dispatch
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./glib/gmain.c line 3769
  • #40 g_main_context_iterate
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./glib/gmain.c line 3840
  • #41 g_main_context_iteration
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./glib/gmain.c line 3901
  • #42 g_application_run
    at /build/glib2.0-l3js1a/glib2.0-2.46.1/./gio/gapplication.c line 2311
  • #43 rb_application_run
  • #44 main

Comment 1 Sebastian Dröge (slomo) 2015-10-20 07:25:55 UTC
Thread 2 looks like a problem in Rhythmbox: the about-to-finish handler waits for a GCond there.

And that combined with Thread 1, where Rhythmbox is shutting down the pipeline... which deadlocks because Thread 2 is waiting (from a streaming thread!) for a GCond.
Comment 2 Lionel Landwerlin 2015-10-20 23:01:39 UTC
Created attachment 313785 [details] [review]
playbin: do not deadlock the main & streaming threads

It seems GStreamer has a tendancy to deadlock if we wait for a message to be
processed on the main thread from the streaming thread. Indeed the main
might already be blocking on changing the state of the pipeline.

Instead of waiting the end of stream message to be processed, let's just
post it and give the hand back to gstreamer.
This reworks the following commit : 256f7eb568dd3c4713c2a3b8e1bafe06270e7e18
Comment 3 Sebastian Dröge (slomo) 2015-10-21 06:38:06 UTC
That's not how about-to-finish works. You must not return from the signal handler until you set a new URI, otherwise playbin might just finish instead of playing any new URI that you set too late.
Comment 4 Lionel Landwerlin 2015-11-01 16:28:46 UTC
So if I understand correctly, in the about-to-finish handler, we're only allowed to set uri and suburi properties, nothing else (otherwise it might deadlock)?
Comment 5 Sebastian Dröge (slomo) 2015-11-01 18:47:26 UTC
You can also do other things, basically everything that you're allowed to do from a GStreamer streaming thread.

In your backtraces the problem is that rhythmbox shuts down the pipeline but does not signal its *own* GCond that is blocking the streaming thread of that pipeline. Just signal it and make sure nothing is waiting in about-to-finish if you're currently shutting down.
Comment 6 GNOME Infrastructure Team 2018-05-24 18:34:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/rhythmbox/issues/1421.