Re: Deadlock in Gst::init()



On Thu, 2012-05-10 at 17:56 -0400, Kurt Miller wrote:
> Using gstreamermm-0.10.10.1 with gstreamer-0.10.36 Gst::init()
> indirectly attempts a recursive load of the adder plugin. The
> recursive load deadlocks due to the use of a static mutex in
> gst_plugin_load_by_name(). This is reproduceable with
> subtitleeditor on OpenBSD HEAD/current.
> 
> Here is the stack trace showing the recursive call to
> gst_plugin_load_by_name():
> 
> #2  0x0009c065 in _rthread_mutex_lock (mutexp=0x7c1e6670, trywait=0, abstime=0x0) at /usr/src/lib/librthread/rthread_sync.c:127
> #3  0x08c68ec2 in g_mutex_lock () from /usr/local/lib/libglib-2.0.so.3200.0
> #4  0x02f1f3e5 in gst_plugin_load_file (filename=0x7c1f6580 "/usr/local/lib/gstreamer-0.10/libgstadder.so", error=0xcfbc0bc8)
>     at /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:722
> #5  0x02f2022b in gst_plugin_load_by_name (name=0x7c3c2bf5 "adder") at /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:1297
> #6  0x02f2185d in gst_plugin_feature_load (feature=0x7c3c32e8) at /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstpluginfeature.c:111
> #7  0x0b5e3954 in gst_adder_get_type () at /usr/obj/ports/gstreamermm-0.10.10.1/gstreamermm-0.10.10.1/gstreamer/gstreamermm/adder.cc:29
> #8  0x0ff679e1 in plugin_init (plugin=0x7c397d48) at /usr/obj/ports/gst-plugins-base-0.10.36/gst-plugins-base-0.10.36/gst/adder/gstadder.c:1322
> #9  0x02f1e6ff in gst_plugin_register_func (plugin=0x7c397d48, desc=0x2ff66020, user_data=0x0)
>     at /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:557
> #10 0x02f1f611 in gst_plugin_load_file (filename=0x7c1f6580 "/usr/local/lib/gstreamer-0.10/libgstadder.so", error=0xcfbc0dc8)
>     at /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:843
> #11 0x02f2022b in gst_plugin_load_by_name (name=0x7c3c2bf5 "adder") at /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:1297
> #12 0x02f2185d in gst_plugin_feature_load (feature=0x7c3c32e8) at /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstpluginfeature.c:111
> #13 0x0b5e3954 in gst_adder_get_type () at /usr/obj/ports/gstreamermm-0.10.10.1/gstreamermm-0.10.10.1/gstreamer/gstreamermm/adder.cc:29
> #14 0x0b624d21 in Gst::wrap_init () at /usr/obj/ports/gstreamermm-0.10.10.1/gstreamermm-0.10.10.1/gstreamer/gstreamermm/wrap_init.cc:386
> #15 0x0b6258d0 in initialize_wrap_system () at /usr/obj/ports/gstreamermm-0.10.10.1/gstreamermm-0.10.10.1/gstreamer/gstreamermm/init.cc:36
> #16 0x0b625a77 in Gst::init (argc=@0xcfbc0fb4, argv=@0xcfbc0fb8)
>     at /usr/obj/ports/gstreamermm-0.10.10.1/gstreamermm-0.10.10.1/gstreamer/gstreamermm/init.cc:53
> #17 0x1c01d13c in Glib::PropertyProxy<Glib::ustring>::get_value ()
> 
> Here are the debug messages:
> 
> GST_INIT /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gst.c:805:init_post: GLib runtime version: 2.32.2
> GST_INIT /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gst.c:807:init_post: GLib headers version: 2.32.2
> GST_INIT /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gst.c:437:gst_init_check: already initialized gst
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:311:gst_object_ref:<adder> 0x7c3c32e8 ref 1->2
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstpluginfeature.c:106:gst_plugin_feature_load: loading plugin for feature 0x7c3c32e8; 'adder'
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstpluginfeature.c:110:gst_plugin_feature_load: loading plugin adder
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:1293:gst_plugin_load_by_name: looking up plugin adder in default registry
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:311:gst_object_ref:<plugin96> 0x7c397d48 ref 1->2
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:311:gst_object_ref:<plugin96> 0x7c397d48 ref 2->3
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:337:gst_object_unref:<plugin96> 0x7c397d48 unref 3->2
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:1296:gst_plugin_load_by_name: loading plugin adder from file /usr/local/lib/gstreamer-0.10/libgstadder.so
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:311:gst_object_ref:<plugin96> 0x7c397d48 ref 2->3
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:737:gst_plugin_load_file: attempt to load plugin "/usr/local/lib/gstreamer-0.10/libgstadder.so"
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:834:gst_plugin_load_file: Plugin 0x7c397d48 for file "/usr/local/lib/gstreamer-0.10/libgstadder.so" prepared, calling entry function...
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:841:gst_plugin_load_file: Plugin 0x7c397d48 for file "/usr/local/lib/gstreamer-0.10/libgstadder.so" prepared, registering...
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:540:gst_plugin_register_func: plugin "/usr/local/lib/gstreamer-0.10/libgstadder.so" looks good
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:311:gst_object_ref:<adder> 0x7c3c32e8 ref 2->3
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstpluginfeature.c:106:gst_plugin_feature_load: loading plugin for feature 0x7c3c32e8; 'adder'
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstpluginfeature.c:110:gst_plugin_feature_load: loading plugin adder
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:1293:gst_plugin_load_by_name: looking up plugin adder in default registry
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:311:gst_object_ref:<plugin96> 0x7c397d48 ref 3->4
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:311:gst_object_ref:<plugin96> 0x7c397d48 ref 4->5
> GST_REFCOUNTING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstobject.c:337:gst_object_unref:<plugin96> 0x7c397d48 unref 5->4
> GST_PLUGIN_LOADING /usr/obj/ports/gstreamer-0.10.36/gstreamer-0.10.36/gst/gstplugin.c:1296:gst_plugin_load_by_name: loading plugin adder from file /usr/local/lib/gstreamer-0.10/libgstadder.so
> 
> It is not clear to me what globals are being protected by the
> gst_plugin_loading_mutex in gst/gstplugin.c gst_plugin_load_file().
> Perhaps the scope of the lock is to0 broad covering the potential
> recursion caused by the call to gst_plugin_register_func().
> 
> Any pointers on how to address this problem would be appreciated.

I can't reproduce this on an ubuntu 12.04 system using the same
versions of GStreamer and gstreamermm.  'make check' of the
gstreamermm-0.10.10.1 tarball succeeds (building and running the tests
which all call Gst::init()).  Also, the hello_world example works just
fine.  Here's some output:

[06:56][jose@jose-desktop: ~/Desktop]$ pkg-config --modversion gstreamer-0.10 
0.10.36

[07:21][jose@jose-desktop: /usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1]$ make check
Making check in tools
make[1]: Entering directory
`/usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1/tools'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory
`/usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1/tools'
Making check in gstreamer/gstreamermm
make[1]: Entering directory
`/usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1/gstreamer/gstreamermm'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory
`/usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1/gstreamer/gstreamermm'
Making check in tests
make[1]: Entering directory
`/usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1/tests'
make  test-caps test-create-element test-pipeline-add-element
test-link-elements test-create-bin test-miniobject-wrap
test-message-wrap test-event-wrap test-query-wrap test-structure
test-caps-structures test-interface test-create-bus test-taglist
test-tagsetter test-pad test-ghost-pad test-init-check test-init
test-init-check-noargs test-init-noargs test-iterator test-property-caps
test-plugin-gen test-plugin-signals test-buffer-list-iterator
test-base-src
make[2]: Entering directory
`/usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1/tests'
g++ -DHAVE_CONFIG_H   -I.. -I../gstreamer  -pthread
-I/usr/include/giomm-2.4 -I/usr/lib/x86_64-linux-gnu/giomm-2.4/include
-I/usr/include/glibmm-2.4 -I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
-I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include
-I/usr/include/libxml2 -I/usr/include/gstreamer-0.10
-I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include    -Wall -g
-O2 -MT test-caps.o -MD -MP -MF .deps/test-caps.Tpo -c -o test-caps.o
test-caps.cc
mv -f .deps/test-caps.Tpo .deps/test-caps.Po
...
make[2]: Leaving directory
`/usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1/tests'

make  check-TESTS
make[2]: Entering directory
`/usr/src/jhbuild-sources/gstreamermm/gstreamermm-0.10.10.1/tests'
Simple caps width after setting = 500.
Simple caps rate after setting = 25/1.
Simple caps string after setting = 'A string'.
Succeeded linking e1 and e2 with filter.
PASS: test-caps
Successfully created gst element 'source'.
PASS: test-create-element
Successfully added element 'source' to pipeline 'my-pipeline'.
PASS: test-pipeline-add-element
Successfully linked elements 'source', 'filter' and 'sink'.
PASS: test-link-elements
Successfully added elements 'source' and 'sink' to bin 'gtkmm__gstbin0'.
'gtkmm__gstbin0' children count  = 2.
'gtkmm__gstbin0' first child is 'sink'.
PASS: test-create-bin
C++ message instance is !null: 1
PASS: test-miniobject-wrap
C++ message instance is !null: 1
message is a Gst::MessageWarning: 1
message type name: 'warning'
Message structure name: 'GstMessageWarning'
PASS: test-message-wrap
C++ event instance is !null: 1
event is a Gst::EventLatency: 1
event type name: 'latency'
Event structure name: 'GstEventLatency'
PASS: test-event-wrap
C++ query instance is !null: 1
query is a Gst::QueryPosition: 1
query type name: 'position'
Query structure name: 'GstQueryPosition'
PASS: test-query-wrap
string value after getting = 'Hello; This is a ustring'.
integer value after getting = 100.
fraction value after getting = 1/2.
fractional range value after getting = [(1/2), (3/4)].
date value after getting = 5/10/2012.
state value after getting = Gst::STATE_PAUSED.
PASS: test-structure
Structure 1: Message 1
Structure 2: Message 2
Structure 3: Message 3
Removing cap's structure at index 0
Cap's structure at index 0 = Structure 2
Stealing cap's structure at index 0
Cap's stolen structure at indext 0 = Structure 2
Cap's structure at index 0 = Structure 3
PASS: test-caps-structures
Successfully created gst element 'source'.
element 'source' implements URIHandler interface.
source uri = 'file:///tmp/media.file'.
PASS: test-interface
Successfully created gst bus.
PASS: test-create-bus
Tag title is 'My Song'.
Tag artist is 'Artist'.
Tag bit-rate is 192.
Tag date is 2008-11-5.
PASS: test-taglist
bitrate = 192.
title = `A Song'.
PASS: test-tagsetter
Successfully created pad template 'source-template'; direction = 2.
Successfully created pad 'pad1'; direction = 2.
Successfully created pad 'gtkmm__gstpad0'; direction = 2.
Successfully created pad 'pad3'; direction = 2.
Successfully created pad 'gtkmm__gstpad1'; direction = 2.
PASS: test-pad
Successfully created pad template 'source-template'; direction = 2.
Successfully created pad 'gtkmm__gstpad0'; direction = 2.
Successfully created pad 'gtkmm__gstpad1'; direction = 2.
Successfully created pad 'gtkmm__gstghostpad0'; direction = 1.
Successfully created pad 'gtkmm__gstghostpad1'; direction = 2.
PASS: test-ghost-pad
Successfully created gst element 'videosink'.
element 'videosink' implements XOverlay interface.
Successfully wrapped a GstAudioClock in a GSt::AudioClock.
PASS: test-init-check
Successfully created gst element 'videosink'.
element 'videosink' implements XOverlay interface.
Successfully wrapped a GstAudioClock in a GSt::AudioClock.
PASS: test-init
Successfully created gst element 'videosink'.
element 'videosink' implements XOverlay interface.
PASS: test-init-check-noargs
Successfully created gst element 'videosink'.
element 'videosink' implements XOverlay interface.
PASS: test-init-noargs
The following elements have been added to bin 'my-bin'.
element4
element3
element2
element1
The first element iterator processed is 'element4'.
The loop iterated 4 time(s) to print bin 'my-bin' elements.

The following are standard GStreamer query types:
position -- Current position.
duration -- Total duration.
latency -- Latency.
jitter -- Jitter.
rate -- Configured rate 1000000 = 1.
seeking -- Seeking capabilities and parameters.
segment -- currently configured segment.
convert -- Converting between formats.
formats -- Supported formats for conversion.
buffering -- Buffering status.
custom -- Custom query.
uri -- URI of the source or sink.

The following are standard GStreamer formats:
default -- Default format for the media type.
bytes -- Bytes.
time -- Time.
buffers -- Buffers.
percent -- Percent.
PASS: test-iterator
`caps' property is null before setting property.
`caps' property after setting and getting is 'image/jpeg,
framerate=(fraction)2/1'.
PASS: test-property-caps
filesrc is valid.
mmapsize = 4194304
PASS: test-plugin-gen
Setting to PLAYING.
Running.
Gst::FakeSrc's handoff signal triggered.
The Gst::FakeSrc buffer's discont flag is set.
Gst::FakeSrc's handoff signal triggered.
Gst::FakeSrc's handoff signal triggered.
Gst::FakeSrc's handoff signal triggered.
Gst::FakeSrc's handoff signal triggered.
End of stream.
Returned. Stopping playback.
PASS: test-plugin-signals
PASS: test-buffer-list-iterator
Capture 43691 43691 [input]
PASS: test-base-src
===================
All 27 tests passed
===================

> Thanks,
> -Kurt
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list

-- 
José





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]