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 646811 - baseparse: deadlock in gst_base_parse_set_index
baseparse: deadlock in gst_base_parse_set_index
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.33
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 518857
 
 
Reported: 2011-04-05 13:21 UTC by Philip Jägenstedt
Modified: 2011-04-19 13:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Philip Jägenstedt 2011-04-05 13:21:52 UTC
Opera is using a memindex on decodebin2 to have that be populated by matroskademux, allowing us to map bytes to time and vice versa with help from the seek index. This has exposed a deadlock in the new baseparse in gst-plugins-bad.

Input: http://www.nch.com.au/acm/8kmp38.wav

gst_base_parse_set_index takes the object lock and then calls gst_index_get_writer_id. The default resolver, GST_INDEX_RESOLVER_PATH, will use gst_object_get_path_string which also tries to take the object lock. Since it's a GMutex which is not recursive, it will simply deadlock.

Backtrace:

  • #0 __lll_lock_wait
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S line 136

Comment 1 Sebastian Dröge (slomo) 2011-04-05 13:43:25 UTC
Other elements are doing the same btw, at least flvdemux. cddabasesrc is releasing the object lock before getting a writer ID but this doesn't sound safe to me, a different thread could set another index on the element at exactly that time and with bad luck the writer ID that is stored is the one from the old index.
Comment 2 Philip Jägenstedt 2011-04-05 14:00:45 UTC
I should also note that the documentation for gst_index_get_writer_id doesn't say that the caller mustn't old the object lock, do you want a separate bug for that?
Comment 3 Tim-Philipp Müller 2011-04-08 17:58:33 UTC
> I should also note that the documentation for gst_index_get_writer_id doesn't
> say that the caller mustn't old the object lock, do you want a separate bug for
> that?

Nah, I'll fix that (unless you have a patch at hand already).
Comment 4 Tim-Philipp Müller 2011-04-19 13:15:05 UTC
commit 60bbb9c24f5b09ae4f6546b16ec64cd3484b2255
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Tue Apr 19 13:23:19 2011 +0100

    docs: add note/warning to gst_index_get_writer_id() docs about the OBJECT_LOCK
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646811

commit b35d54dcd1afb11dd70356e67f4d95441be6d74d
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Tue Apr 19 13:05:53 2011 +0100

    baseparse: don't deadlock when setting external index
    
    Protect index with its own lock. gst_index_get_writer_id() may take
    the object lock internally (the default resolver, GST_INDEX_RESOLVER_PATH,
    will anyway), so if we're using that to protect the index as well,
    we'll deadlock.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646811