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 574838 - seeking can deadlock adder
seeking can deadlock adder
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-10 21:00 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2009-03-17 09:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
backtraces from all threads (46.62 KB, text/plain)
2009-03-12 21:53 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
  Details
use adder object lock (5.87 KB, patch)
2009-03-14 20:54 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
rejected Details | Review

Description Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-10 21:00:32 UTC
see frame #4 and #67

  • #0 __kernel_vsyscall
  • #1 __lll_lock_wait
    from /lib/libpthread.so.0
  • #2 _L_lock_89
    from /lib/libpthread.so.0
  • #3 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #4 gst_adder_src_event
    at gstadder.c line 653
  • #5 gst_pad_send_event
    at gstpad.c line 4701
  • #6 gst_pad_push_event
    at gstpad.c line 4557
  • #7 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #8 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #9 gst_pad_send_event
    at gstpad.c line 4701
  • #10 gst_pad_push_event
    at gstpad.c line 4557
  • #11 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #12 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #13 gst_pad_send_event
    at gstpad.c line 4701
  • #14 gst_pad_push_event
    at gstpad.c line 4557
  • #15 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #16 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #17 gst_pad_send_event
    at gstpad.c line 4701
  • #18 gst_pad_push_event
    at gstpad.c line 4557
  • #19 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #20 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #21 gst_pad_send_event
    at gstpad.c line 4701
  • #22 gst_pad_push_event
    at gstpad.c line 4557
  • #23 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #24 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #25 gst_pad_send_event
    at gstpad.c line 4701
  • #26 gst_pad_push_event
    at gstpad.c line 4557
  • #27 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #28 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #29 gst_pad_send_event
    at gstpad.c line 4701
  • #30 gst_pad_push_event
    at gstpad.c line 4557
  • #31 gst_pad_event_default
    at gstpad.c line 3327
  • #32 gst_pad_send_event
    at gstpad.c line 4701
  • #33 gst_pad_push_event
    at gstpad.c line 4557
  • #34 gst_proxy_pad_do_event
    at gstghostpad.c line 128
  • #35 gst_pad_send_event
    at gstpad.c line 4701
  • #36 gst_pad_push_event
    at gstpad.c line 4557
  • #37 gst_proxy_pad_do_event
    at gstghostpad.c line 128
  • #38 gst_pad_send_event
    at gstpad.c line 4701
  • #39 gst_pad_push_event
    at gstpad.c line 4557
  • #40 gst_queue_handle_src_event
    at gstqueue.c line 1176
  • #41 gst_pad_send_event
    at gstpad.c line 4701
  • #42 gst_pad_push_event
    at gstpad.c line 4557
  • #43 gst_pad_event_default
    at gstpad.c line 3327
  • #44 gst_pad_send_event
    at gstpad.c line 4701
  • #45 gst_pad_push_event
    at gstpad.c line 4557
  • #46 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #47 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #48 gst_pad_send_event
    at gstpad.c line 4701
  • #49 gst_pad_push_event
    at gstpad.c line 4557
  • #50 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #51 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #52 gst_pad_send_event
    at gstpad.c line 4701
  • #53 gst_pad_push_event
    at gstpad.c line 4557
  • #54 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #55 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #56 gst_pad_send_event
    at gstpad.c line 4701
  • #57 gst_pad_push_event
    at gstpad.c line 4557
  • #58 gst_proxy_pad_do_event
    at gstghostpad.c line 128
  • #59 gst_pad_send_event
    at gstpad.c line 4701
  • #60 gst_pad_push_event
    at gstpad.c line 4557
  • #61 gst_proxy_pad_do_event
    at gstghostpad.c line 128
  • #62 gst_pad_send_event
    at gstpad.c line 4701
  • #63 gst_pad_push_event
    at gstpad.c line 4557
  • #64 forward_event_func
    at gstadder.c line 576
  • #65 gst_iterator_fold
    at gstiterator.c line 540
  • #66 forward_event
    at gstadder.c line 609
  • #67 gst_adder_src_event
    at gstadder.c line 670
  • #68 gst_pad_send_event
    at gstpad.c line 4701
  • #69 gst_pad_push_event
    at gstpad.c line 4557
  • #70 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #71 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #72 gst_pad_send_event
    at gstpad.c line 4701
  • #73 gst_pad_push_event
    at gstpad.c line 4557
  • #74 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #75 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #76 gst_pad_send_event
    at gstpad.c line 4701
  • #77 gst_pad_push_event
    at gstpad.c line 4557
  • #78 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #79 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #80 gst_pad_send_event
    at gstpad.c line 4701
  • #81 gst_pad_push_event
    at gstpad.c line 4557
  • #82 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #83 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #84 gst_pad_send_event
    at gstpad.c line 4701
  • #85 gst_pad_push_event
    at gstpad.c line 4557
  • #86 gst_proxy_pad_do_event
    at gstghostpad.c line 128
  • #87 gst_pad_send_event
    at gstpad.c line 4701
  • #88 gst_pad_push_event
    at gstpad.c line 4557
  • #89 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #90 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #91 gst_pad_send_event
    at gstpad.c line 4701
  • #92 gst_pad_push_event
    at gstpad.c line 4557
  • #93 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1773
  • #94 gst_base_transform_src_event
    at gstbasetransform.c line 1742
  • #95 gst_pad_send_event
    at gstpad.c line 4701
  • #96 gst_pad_push_event
    at gstpad.c line 4557
  • #97 gst_base_sink_send_event
    at gstbasesink.c line 3603
  • #98 gst_element_send_event
    at gstelement.c line 1383
  • #99 gst_bin_send_event
    at gstbin.c line 2502
  • #100 gst_element_send_event
    at gstelement.c line 1383
  • #101 on_song_segment_done
    at song.c line 309
  • #102 marshal_VOID__MINIOBJECT
    at gstbus.c line 159
  • #103 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #104 ??
    from /usr/lib/libgobject-2.0.so.0
  • #105 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #106 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #107 gst_bus_async_signal_func
    at gstbus.c line 1132
  • #108 gst_bus_source_dispatch
    at gstbus.c line 795
  • #109 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #110 ??
    from /usr/lib/libglib-2.0.so.0
  • #111 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #112 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #113 bt_main_window_run
    at main-window.c line 393
  • #114 bt_edit_application_run_ui
    at edit-application.c line 192
  • #115 bt_edit_application_run
    at edit-application.c line 433
  • #116 main
    at bt-edit.c line 161

Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-12 21:53:42 UTC
Created attachment 130555 [details]
backtraces from all threads
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-14 20:54:32 UTC
Created attachment 130680 [details] [review]
use adder object lock

The deadlock happens between:
adder: gst_adder_src_event()/GST_EVENT_SEEK/GST_OBJECT_LOCK (adder->collect);
and
collectpads: gst_collect_pads_chain/GST_COLLECT_PADS_WAIT (pads);

In the patch I added logging and some more return value handling. The fix for the problem is to use GST_OBJECT_LOCK (adder) to protect adder->segment_pending in gst_adder_src_event() and gst_adder_collected() instead of the object-lock on adder->collect.

Is that the right fix?
Comment 3 Wim Taymans 2009-03-16 09:52:11 UTC
It's not correct, we take the collector lock to wait for the collectpads to finish processing.

From the backtrace it looks like the streaming thread is blocked somewhere in a sink. Is this a flushing seek?  
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-16 13:18:24 UTC
Its not a flushing seek. Its seamless looping.
Comment 5 Wim Taymans 2009-03-16 18:44:31 UTC
In fact, I don't see a deadlock.. I think it's just waiting for the collect function to finish before it can configure the new segment time and forward the event. 
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-16 20:12:24 UTC
But the collect function in turn is stuck in GST_COLLECT_PADS_WAIT. The application is definitely locked - no more sound. If I just disable the lock in
gst_adder_src_event()/GST_EVENT_SEEK/GST_OBJECT_LOCK (adder->collect);
it does not lock up, but does not behave correctly either.

I don't see why we have to wait for gst_collect_pads_chain() to finish. It does not (and it cannot) access adder->segment_pending and adder->segment_position and that is what we modity in the event function.
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-16 20:57:41 UTC
After implementing the patch in bug #575598, the deadlock does not happen any more. Also in my application I can workaround the problem by using new sequence number for each seek, so that I can ignore duplicate segment-dones. Unfortunately that will require 0.10.22 (not yet sure how I can avoid it with older versions). 
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2009-03-17 09:56:42 UTC
For older version I count my sources and ignore the first N-1 segment-done-event. Closing ticket as the fix in bug #575598 is accepted.