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 630257 - GST_DEBUG_DUMP_DOT_DIR not working anymore
GST_DEBUG_DUMP_DOT_DIR not working anymore
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.x
Other Linux
: Normal blocker
: 0.10.31
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-09-21 12:36 UTC by Thijs Vermeir
Modified: 2010-10-05 09:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
use atomic ops in _get_property (1.69 KB, patch)
2010-09-25 11:27 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
use atomic ops in _get_property (1.29 KB, patch)
2010-09-25 18:13 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
use atomic ops in _get_property (2.13 KB, patch)
2010-09-30 12:20 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review

Description Thijs Vermeir 2010-09-21 12:36:32 UTC
GST_DEBUG_DUMP_DOT_DIR is not working anymore.

$export GST_DEBUG_DUMP_DOT_DIR=/tmp
$gst-launch videotestsrc ! xvimagesink

and this pipeline does not want to preroll...
Comment 1 Sebastian Dröge (slomo) 2010-09-25 08:58:49 UTC
Confirmed, pipeline doesn't want to preroll but only if that environment variable is set.
Comment 2 Sebastian Dröge (slomo) 2010-09-25 09:01:34 UTC
Relevant part of the backtrace. Something else is holding the preroll lock too apparently ;)

Thread 3 (Thread 0x7ffff38f7710 (LWP 27490))

  • #0 __lll_lock_wait
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S line 136
  • #1 _L_lock_953
    from /lib/libpthread.so.0
  • #2 __pthread_mutex_lock
    at pthread_mutex_lock.c line 61
  • #3 gst_base_sink_get_property
    at gstbasesink.c line 1325
  • #4 object_get_property
    at /glib2.0-2.25.16/gobject/gobject.c line 1120
  • #5 g_object_get_property
    at /glib2.0-2.25.16/gobject/gobject.c line 1963
  • #6 debug_dump_get_element_params
    at gstdebugutils.c line 116
  • #7 debug_dump_element
    at gstdebugutils.c line 496
  • #8 _gst_debug_bin_to_dot_file
    at gstdebugutils.c line 659
  • #9 _gst_debug_bin_to_dot_file_with_ts
    at gstdebugutils.c line 705
  • #10 bus_sync_handler
    at gst-launch.c line 689
  • #11 gst_bus_post
    at gstbus.c line 321
  • #12 gst_element_post_message
    at gstelement.c line 1710
  • #13 bin_handle_async_done
    at gstbin.c line 2945
  • #14 gst_bin_handle_message_func
    at gstbin.c line 3315
  • #15 gst_pipeline_handle_message
    at gstpipeline.c line 580
  • #16 bin_bus_handler
    at gstbin.c line 2741
  • #17 gst_bus_post
    at gstbus.c line 321
  • #18 gst_element_post_message
    at gstelement.c line 1710
  • #19 gst_base_sink_commit_state
    at gstbasesink.c line 1538
  • #20 gst_base_sink_preroll_object
    at gstbasesink.c line 3033
  • #21 gst_base_sink_queue_object_unlocked
    at gstbasesink.c line 3079
  • #22 gst_base_sink_chain_unlocked
    at gstbasesink.c line 3482
  • #23 gst_base_sink_chain_main
    at gstbasesink.c line 3520
  • #24 gst_pad_chain_data_unchecked
    at gstpad.c line 4182
  • #25 gst_pad_push_data
    at gstpad.c line 4411
  • #26 gst_base_src_loop
    at gstbasesrc.c line 2496
  • #27 gst_task_func
    at gsttask.c line 271
  • #28 g_thread_pool_thread_proxy
    at /glib2.0-2.25.16/glib/gthreadpool.c line 319
  • #29 g_thread_create_proxy
    at /glib2.0-2.25.16/glib/gthread.c line 1897
  • #30 start_thread
    at pthread_create.c line 300
  • #31 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 112
  • #32 ??

Comment 3 Tim-Philipp Müller 2010-09-25 09:11:25 UTC
Marking as blocker, since it looks like a regression.
Comment 4 Sebastian Dröge (slomo) 2010-09-25 10:05:58 UTC
The preroll lock is always taken while buffers/events are processed, the regression here most probably is this:

commit 3eb97aa32c9a9be382d2be7b2fb617c4d88042fc
Author: Stefan Kost <ensonic@users.sf.net>
Date:   Thu Sep 9 15:57:15 2010 +0300

    gst-launch: add a sync bus handler and move state-change logging there
    
    The sync handler is called for all mesages, the event loop we previously use
    was not. In the sync handler trigger pipeline dot dumps and call access for 
    file in tmp-dir to add markers interceptable by strace and co.


Before it would be deferred to the main loop while now it happens from the streaming thread, giving a deadlock.

Stefan, what exactly is the reason not to use a bus handler on the mainloop?
Comment 5 Sebastian Dröge (slomo) 2010-09-25 10:09:25 UTC
Drop the "most probably" from the last comment, reverting this makes everything work again.
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2010-09-25 10:54:54 UTC
The reason for the change is that the main-loop is not running for most of the state change and thus this was only working partialy before.

I haven't noticed any problem with the change so far, will now have a look.
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2010-09-25 11:26:45 UTC
Isn't the problem here that *reading* a property is protected with a lock in basesink:

gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value,
    GParamSpec * pspec)
{
  GstBaseSink *sink = GST_BASE_SINK (object);

  switch (prop_id) {
    case PROP_PREROLL_QUEUE_LEN:
      GST_PAD_PREROLL_LOCK (sink->sinkpad);
      g_value_set_uint (value, sink->preroll_queue_max_len);
      GST_PAD_PREROLL_UNLOCK (sink->sinkpad);


The lock around that parameter was introduced long time ago.
commit 94e1664fca0024de8b20d930b5b9f58083b91243
Author: Wim Taymans <wim.taymans@gmail.com>
Date:   Wed Jan 18 16:40:16 2006 +0000

    libs/gst/base/gstbasesink.c: Small cleanups.


Removing the locks on the property reads make it work and I get not failing tests. I am attaching a patch that uses atomic ops (btw. the preroll_queue_max_len variable is gint and the property guint with a range of 0...G_MAXUINT).
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2010-09-25 11:27:40 UTC
Created attachment 171082 [details] [review]
use atomic ops in _get_property
Comment 9 Sebastian Dröge (slomo) 2010-09-25 11:58:36 UTC
Not sure if you can use atomic ops on these fields. The preroll locks is taken a very long time and during the call of many functions, it might be that basesink expects it to not change during all the time.
Comment 10 Stefan Sauer (gstreamer, gtkdoc dev) 2010-09-25 12:03:56 UTC
(In reply to comment #9)
> Not sure if you can use atomic ops on these fields. The preroll locks is taken
> a very long time and during the call of many functions, it might be that
> basesink expects it to not change during all the time.

We don'T change them, we only read them. The GST_DEBUG_DUMP_DOT_DIR shows non-default properties.
Comment 11 Sebastian Dröge (slomo) 2010-09-25 12:29:21 UTC
Yes that part is fine, but you change gst_base_sink_set_async_enabled() to atomic ops.
Comment 12 Stefan Sauer (gstreamer, gtkdoc dev) 2010-09-25 18:13:09 UTC
Created attachment 171101 [details] [review]
use atomic ops in _get_property

oops, fixed
Comment 13 Wim Taymans 2010-09-30 11:29:24 UTC
(In reply to comment #12)
> Created an attachment (id=171101) [details] [review]
> use atomic ops in _get_property

If you use atomic ops to read properties, you need to use atomic ops to write properties too, else nothing is protected anymore.
Comment 14 Stefan Sauer (gstreamer, gtkdoc dev) 2010-09-30 12:20:51 UTC
Created attachment 171421 [details] [review]
use atomic ops in _get_property

Also use the atomic ops to modify the parameters atomically, as otherwise reading them in the same way is not guaranteed.
Comment 15 Stefan Sauer (gstreamer, gtkdoc dev) 2010-10-05 09:31:01 UTC
commit a11b047d0074af375628bdd6cbbf99ccd0f20661
Author: Stefan Kost <ensonic@users.sf.net>
Date:   Sat Sep 25 14:24:46 2010 +0300

    basesink: don't take preroll-lock in get_property
    
    Use atomic ops to read and write more properties. Taking the preroll lock in get_property
    can lock up applications reading the property during preroll.