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 583999 - (basetransform-caps) [basetransform] caps refcounting problem causing GST_IS_CAPS assertion failures
(basetransform-caps)
[basetransform] caps refcounting problem causing GST_IS_CAPS assertion failures
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: High critical
: 0.10.25
Assigned To: Wim Taymans
GStreamer Maintainers
: 575349 584742 593488 599215 601358 615622 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-05-27 13:27 UTC by Luca Ognibene
Modified: 2010-04-13 20:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test program (5.63 KB, text/x-python)
2009-05-27 13:28 UTC, Luca Ognibene
Details
C test case (9.04 KB, text/x-csrc)
2009-07-02 15:01 UTC, Luca Ognibene
Details

Description Luca Ognibene 2009-05-27 13:27:03 UTC
Look at the test code attached and try to run it, it'll segfault after a a couple of seconds. What the test-code does is:
 - define a new bin subclass
   - a single sink pad and multiple src request pads
   - there is a tee element inside it
   - whenever someone request a bin pad the bin request a tee pad, add some elements and return the ghost pad
 - test client will request a new pad from the bin every N seconds and attach queue ! fakesink and check if buffers arrive at the fakesink element

If you run it you'll see this output:
(filtersbin2.py:6297): GStreamer-CRITICAL **: gst_caps_is_fixed: assertion `GST_IS_CAPS (caps)' failed

(filtersbin2.py:6297): GStreamer-CRITICAL **: gst_caps_is_any: assertion `GST_IS_CAPS (caps)' failed

(filtersbin2.py:6297): GStreamer-CRITICAL **: gst_caps_is_empty: assertion `GST_IS_CAPS (caps)' failed

(filtersbin2.py:6297): GStreamer-CRITICAL **: gst_caps_is_any: assertion `GST_IS_CAPS (caps)' failed

(filtersbin2.py:6297): GStreamer-CRITICAL **: gst_caps_is_empty: assertion `GST_IS_CAPS (caps)' failed
Segmentation fault

Looking at the GST_DEBUG output it seems a GstCaps is freed while still being used by a buffer. I don't know if i'm doing something wrong or if there's really a bug in gstreamer but i've already asked on the gst-ml and no-one was able to help me.. i did a lot of tests and always found this problem.
Comment 1 Luca Ognibene 2009-05-27 13:28:04 UTC
Created attachment 135436 [details]
test program

run with python filtersbin2.py
Comment 2 Tim-Philipp Müller 2009-05-31 15:54:26 UTC
Looks like a caps refcount bug somewhere. Hard to say where though. Would be nice if you could try to reduce the complexity of the test case a bit.

Moving to core for now. Stacktrace (interesting threads only):

Thread 6 (Thread 0x7fc750f26950 (LWP 14260))

  • #0 *__GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 *__GI_abort
    at abort.c line 88
  • #2 IA__g_logv
    at /tmp/cdt.XX50MgKl/build-area/glib2.0-2.20.1/glib/gmessages.c line 506
  • #3 IA__g_log
    at /tmp/cdt.XX50MgKl/build-area/glib2.0-2.20.1/glib/gmessages.c line 526
  • #4 gst_caps_is_fixed
    at gstcaps.c line 976
  • #5 gst_caps_is_equal
    at gstcaps.c line 1097
  • #6 gst_pad_accept_caps
    at gstpad.c line 2434
  • #7 gst_pad_configure_sink
    at gstpad.c line 2593
  • #8 gst_pad_chain_data_unchecked
    at gstpad.c line 4043
  • #9 gst_pad_push_data
    at gstpad.c line 4291
  • #10 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #11 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #12 gst_pad_push_data
    at gstpad.c line 4291
  • #13 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #14 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #15 gst_pad_push_data
    at gstpad.c line 4291
  • #16 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #17 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #18 gst_pad_push_data
    at gstpad.c line 4291
  • #19 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #20 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #21 gst_pad_push_data
    at gstpad.c line 4291
  • #22 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #23 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #24 gst_pad_push_data
    at gstpad.c line 4291
  • #25 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #26 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #27 gst_pad_push_data
    at gstpad.c line 4291
  • #28 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #29 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #30 gst_pad_push_data
    at gstpad.c line 4291
  • #31 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #32 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #33 gst_pad_push_data
    at gstpad.c line 4291
  • #34 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #35 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #36 gst_pad_push_data
    at gstpad.c line 4291
  • #37 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #38 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #39 gst_pad_push_data
    at gstpad.c line 4291
  • #40 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #41 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #42 gst_pad_push_data
    at gstpad.c line 4291
  • #43 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #44 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #45 gst_pad_push_data
    at gstpad.c line 4291
  • #46 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #47 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #48 gst_pad_push_data
    at gstpad.c line 4291
  • #49 gst_queue_loop
    at gstqueue2.c line 1453
  • #50 gst_task_func
    at gsttask.c line 234

Thread 3 (Thread 0x7fc751f28950 (LWP 14257))

  • #0 gst_base_transform_handle_buffer
    at gstbasetransform.c line 1803
  • #1 gst_base_transform_chain
    at gstbasetransform.c line 2018
  • #2 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #3 gst_pad_push_data
    at gstpad.c line 4291
  • #4 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #5 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #6 gst_pad_push_data
    at gstpad.c line 4291
  • #7 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #8 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #9 gst_pad_push_data
    at gstpad.c line 4291
  • #10 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #11 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #12 gst_pad_push_data
    at gstpad.c line 4291
  • #13 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #14 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #15 gst_pad_push_data
    at gstpad.c line 4291
  • #16 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #17 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #18 gst_pad_push_data
    at gstpad.c line 4291
  • #19 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #20 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #21 gst_pad_push_data
    at gstpad.c line 4291
  • #22 gst_base_transform_chain
    at gstbasetransform.c line 2038
  • #23 gst_pad_chain_data_unchecked
    at gstpad.c line 4061
  • #24 gst_pad_push_data
    at gstpad.c line 4291
  • #25 gst_queue_loop
    at gstqueue2.c line 1453
  • #26 gst_task_func
    at gsttask.c line 234
  • #27 g_thread_pool_thread_proxy

Comment 3 Wim Taymans 2009-06-01 15:41:45 UTC
ANy chance you can make a C version of that to rule out something wrong with the python bindings?
Comment 4 Luca Ognibene 2009-06-01 16:23:34 UTC
I'll try to do a C version later this week. Thank you for looking at this problem!
Comment 5 Luca Ognibene 2009-07-02 15:01:44 UTC
Created attachment 137739 [details]
C test case

I've finally found time to do it.. i'm attaching a C version with the same segfault. Please tell me if i'm doing something wrong or there is a buf somewhere in gst.
Comment 6 Luca Ognibene 2009-07-02 15:39:13 UTC
of course you can compile with gcc -o filtersbin2 filtersbin2.c `pkg-config --cflags --libs gstreamer-0.10` -Wall -Werror
Comment 7 Wim Taymans 2009-07-13 12:06:22 UTC
Some caps ref problems somewhere... very hard to track down.
Comment 8 Luca Ognibene 2009-07-16 09:25:38 UTC
Ok.. should i set this as a blocker now that pre-releases are out?
Comment 9 Wim Taymans 2009-08-05 10:48:29 UTC
I found the problem. Basetransform was setting caps on non-metadata-writable buffers, which caused caps to disappear in elements. Too bad it did not make the release but it was not really a regression.

You get this problem after a tee with multiple branches, then a queue and a basetransform based element after the queue. The tee to make the buffers non-writable in each of the transforms and the queue to cause enough threading to cause races.

Will commit a patch after the freeze.
Comment 10 Wim Taymans 2009-08-06 09:18:40 UTC
commit 6cf64beb79f18d3956e18d59860fe4b0eb7bfe35
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Wed Aug 5 13:44:51 2009 +0200

    basetransform: fix refcounting problem
    
    Add some more debug info.
    Make sure that the output buffer has writable metadata before we attempt to set
    caps on it.
    
    fixes #583999
Comment 11 Luca Ognibene 2009-08-06 15:35:51 UTC
Thank you so much!! It's working now! I have 'only' some hangs now.. will try to look better!
Comment 12 Tim-Philipp Müller 2009-08-29 17:40:50 UTC
*** Bug 593488 has been marked as a duplicate of this bug. ***
Comment 13 Tim-Philipp Müller 2009-10-05 17:52:57 UTC
*** Bug 575349 has been marked as a duplicate of this bug. ***
Comment 14 Philip Withnall 2009-10-21 18:42:12 UTC
*** Bug 599215 has been marked as a duplicate of this bug. ***
Comment 15 Jonathan Matthew 2010-03-13 10:38:33 UTC
*** Bug 584742 has been marked as a duplicate of this bug. ***
Comment 16 Philip Withnall 2010-04-13 19:55:13 UTC
*** Bug 615622 has been marked as a duplicate of this bug. ***
Comment 17 Tim-Philipp Müller 2010-04-13 20:15:47 UTC
*** Bug 601358 has been marked as a duplicate of this bug. ***