playbin3: dead lock between typefind and urisourcebin when setting state to NULL
I'm getting a deadlock between typefind
and urisourcebin
when trying to set playbin3
state to NULL
.
- Thread 54
- holding
typefind:sink
stream lock, asgst_type_find_element_loop
is the pad task - waiting on
urisourcebin
state lock
- holding
- Thread 2
- holding
urisourcebin
state lock ingst_element_set_state_func
- waiting on
typefind:sink
stream lock
- holding
Thread 54 (Thread 0x7f3d256006c0 (LWP 163999) "typefindelement"):
#0 0x00007f3d8ab1dfc0 in __lll_lock_wait () at /lib64/libc.so.6
#1 0x00007f3d8ab244da in pthread_mutex_lock@@GLIBC_2.2.5 () at /lib64/libc.so.6
#2 0x00007f3d84747fad in setup_parsebin_for_slot (info=0x7f3bc91e6ad0, originating_pad=0x7f3d8068ca90) at ../subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c:1946
#3 0x00007f3d8474894d in handle_new_pad (info=0x7f3bc91e6ad0, srcpad=0x7f3d8068ca90, caps=0x7f3bc0007ee0) at ../subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c:2103
#4 0x00007f3d84748e95 in type_found (typefind=0x7f3d802c63c0, probability=100, caps=0x7f3bc0007ee0, info=0x7f3bc91e6ad0) at ../subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c:2186
#5 0x00007f3d8a8faa06 in ffi_call_unix64 () at /lib64/libffi.so.8
#6 0x00007f3d8a8f749d in ffi_call_int.lto_priv () at /lib64/libffi.so.8
#7 0x00007f3d8a8fa083 in ffi_call () at /lib64/libffi.so.8
#8 0x00007f3d8c117113 in g_cclosure_marshal_generic () at /lib64/libgobject-2.0.so.0
#9 0x00007f3d8c111060 in g_closure_invoke () at /lib64/libgobject-2.0.so.0
#10 0x00007f3d8c13df66 in signal_emit_unlocked_R.isra.0 () at /lib64/libgobject-2.0.so.0
#11 0x00007f3d8c12e4da in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
#12 0x00007f3d8c12e6f3 in g_signal_emit () at /lib64/libgobject-2.0.so.0
#13 0x00007f3d846e16dd in gst_type_find_element_emit_have_type (typefind=0x7f3d802c63c0, probability=100, caps=0x7f3bc0007ee0) at ../subprojects/gstreamer/plugins/elements/gsttypefindelement.c:239
#14 0x00007f3d846e4b9d in gst_type_find_element_loop (pad=0x7f3bc91ea550) at ../subprojects/gstreamer/plugins/elements/gsttypefindelement.c:1195
#15 0x00007f3d8c2670f6 in gst_task_func (task=0x7f3bc91c83b0) at ../subprojects/gstreamer/gst/gsttask.c:399
#16 0x00007f3d8c268501 in default_func (tdata=0x7f3d805b6fe0, pool=0x7f3d805b6100) at ../subprojects/gstreamer/gst/gsttaskpool.c:70
#17 0x00007f3d8c043052 in g_thread_pool_thread_proxy.lto_priv () at /lib64/libglib-2.0.so.0
#18 0x00007f3d8c03ff22 in g_thread_proxy () at /lib64/libglib-2.0.so.0
#19 0x00007f3d8ab2119d in start_thread () at /lib64/libc.so.6
#20 0x00007f3d8aba2c60 in clone3 () at /lib64/libc.so.6
Thread 2 (Thread 0x7f3d876006c0 (LWP 163945) "player::tests::"):
#0 0x00007f3d8ab1dfc0 in __lll_lock_wait () at /lib64/libc.so.6
#1 0x00007f3d8ab244da in pthread_mutex_lock@@GLIBC_2.2.5 () at /lib64/libc.so.6
#2 0x00007f3d8c22dff3 in gst_pad_stop_task (pad=0x7f3bc91ea550) at ../subprojects/gstreamer/gst/gstpad.c:6514
#3 0x00007f3d846e5155 in gst_type_find_element_activate_sink_mode (pad=0x7f3bc91ea550, parent=0x7f3d802c63c0, mode=GST_PAD_MODE_PULL, active=0) at ../subprojects/gstreamer/plugins/elements/gsttypefindelement.c:1288
#4 0x00007f3d8c21bc24 in activate_mode_internal (pad=0x7f3bc91ea550, parent=0x7f3d802c63c0, mode=GST_PAD_MODE_PULL, active=0) at ../subprojects/gstreamer/gst/gstpad.c:1224
#5 0x00007f3d8c21b7a2 in gst_pad_set_active (pad=0x7f3bc91ea550, active=0) at ../subprojects/gstreamer/gst/gstpad.c:1122
#6 0x00007f3d8c1f620b in activate_pads (vpad=0x7f3d875fe340, ret=0x7f3d875fe390, active=0x7f3d875fe3c4) at ../subprojects/gstreamer/gst/gstelement.c:3189
#7 0x00007f3d8c20da8d in gst_iterator_fold (it=0x7f3d8024aa10, func=0x7f3d8c1f61cc <activate_pads>, ret=0x7f3d875fe390, user_data=0x7f3d875fe3c4) at ../subprojects/gstreamer/gst/gstiterator.c:618
#8 0x00007f3d8c1f6294 in iterator_activate_fold_with_resync (iter=0x7f3d8024aa10, func=0x7f3d8c1f61cc <activate_pads>, user_data=0x7f3d875fe3c4) at ../subprojects/gstreamer/gst/gstelement.c:3213
#9 0x00007f3d8c1f63ce in gst_element_pads_activate (element=0x7f3d802c63c0, active=0) at ../subprojects/gstreamer/gst/gstelement.c:3258
#10 0x00007f3d8c1f66db in gst_element_change_state_func (element=0x7f3d802c63c0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstelement.c:3323
#11 0x00007f3d846e52eb in gst_type_find_element_change_state (element=0x7f3d802c63c0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/plugins/elements/gsttypefindelement.c:1353
#12 0x00007f3d8c1f5cf1 in gst_element_change_state (element=0x7f3d802c63c0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstelement.c:3101
#13 0x00007f3d8c1f5a76 in gst_element_set_state_func (element=0x7f3d802c63c0, state=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstelement.c:3055
#14 0x00007f3d8c1f5661 in gst_element_set_state (element=0x7f3d802c63c0, state=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstelement.c:2956
#15 0x00007f3d8c1c2259 in gst_bin_element_set_state (bin=0x7f3d8068ccc0, element=0x7f3d802c63c0, base_time=0, start_time=0, current=GST_STATE_PAUSED, next=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstbin.c:2582
#16 0x00007f3d8c1c38f7 in gst_bin_change_state_func (element=0x7f3d8068ccc0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstbin.c:2934
#17 0x00007f3d8474c219 in gst_uri_source_bin_change_state (element=0x7f3d8068ccc0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c:3083
#18 0x00007f3d8c1f5cf1 in gst_element_change_state (element=0x7f3d8068ccc0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstelement.c:3101
#19 0x00007f3d8c1f5a76 in gst_element_set_state_func (element=0x7f3d8068ccc0, state=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstelement.c:3055
#20 0x00007f3d8c1f5661 in gst_element_set_state (element=0x7f3d8068ccc0, state=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstelement.c:2956
#21 0x00007f3d8c1c2259 in gst_bin_element_set_state (bin=0x7f3d8068c380, element=0x7f3d8068ccc0, base_time=0, start_time=0, current=GST_STATE_PAUSED, next=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstbin.c:2582
#22 0x00007f3d8c1c38f7 in gst_bin_change_state_func (element=0x7f3d8068c380, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstbin.c:2934
#23 0x00007f3d84741a4f in gst_uri_decode_bin3_change_state (element=0x7f3d8068c380, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c:2083
#24 0x00007f3d8c1f5cf1 in gst_element_change_state (element=0x7f3d8068c380, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstelement.c:3101
#25 0x00007f3d8c1f5a76 in gst_element_set_state_func (element=0x7f3d8068c380, state=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstelement.c:3055
#26 0x00007f3d8c1f5661 in gst_element_set_state (element=0x7f3d8068c380, state=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstelement.c:2956
#27 0x00007f3d8c1c2259 in gst_bin_element_set_state (bin=0x7f3d8068e090, element=0x7f3d8068c380, base_time=0, start_time=0, current=GST_STATE_PAUSED, next=GST_STATE_READY) at ../subprojects/gstreamer/gst/gstbin.c:2582
#28 0x00007f3d8c1c38f7 in gst_bin_change_state_func (element=0x7f3d8068e090, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstbin.c:2934
#29 0x00007f3d8c231a37 in gst_pipeline_change_state (element=0x7f3d8068e090, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstpipeline.c:534
#30 0x00007f3d8477126d in gst_play_bin3_change_state (element=0x7f3d8068e090, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gst-plugins-base/gst/playback/gstplaybin3.c:2705
#31 0x00007f3d8c1f5cf1 in gst_element_change_state (element=0x7f3d8068e090, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../subprojects/gstreamer/gst/gstelement.c:3101
#32 0x00007f3d8c1f5a76 in gst_element_set_state_func (element=0x7f3d8068e090, state=GST_STATE_NULL) at ../subprojects/gstreamer/gst/gstelement.c:3055
#33 0x00007f3d8c1f5661 in gst_element_set_state (element=0x7f3d8068e090, state=GST_STATE_NULL) at ../subprojects/gstreamer/gst/gstelement.c:2956
#34 0x0000564ab8a4ded0 in gstreamer::auto::element::ElementExt::set_state<gstreamer::auto::element::Element> (self=0x7f3d875ff190, state=gstreamer::auto::enums::State::Null) at /var/home/cassidy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gstreamer-0.21.3/src/auto/element.rs:458
#35 karapulse::player::{impl#1}::drop (self=<optimized out>) at src/player.rs:372
#36 core::ptr::drop_in_place<karapulse::player::Player> () at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ptr/mod.rs:507
#37 0x0000564ab8a4f90c in core::ptr::drop_in_place<karapulse::player::tests::Test> () at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ptr/mod.rs:507
#38 0x0000564ab8ad6326 in karapulse::player::tests::stop () at src/player.rs:539
#39 karapulse::player::tests::player_tests () at src/player.rs:484
#40 0x0000564ab8acb9d9 in karapulse::player::tests::player_tests::{closure#0} () at src/player.rs:472
#41 core::ops::function::FnOnce::call_once<karapulse::player::tests::player_tests::{closure_env#0}, ()> () at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250
#42 0x0000564ab8c97d2f in core::ops::function::FnOnce::call_once<fn() -> core::result::Result<(), alloc::string::String>, ()> () at library/core/src/ops/function.rs:250
#43 test::__rust_begin_short_backtrace<core::result::Result<(), alloc::string::String>, fn() -> core::result::Result<(), alloc::string::String>> () at library/test/src/lib.rs:627
#44 0x0000564ab8c96ab1 in test::run_test_in_process::{closure#0} () at library/test/src/lib.rs:650
#45 core::panic::unwind_safe::{impl#23}::call_once<core::result::Result<(), alloc::string::String>, test::run_test_in_process::{closure_env#0}> () at library/core/src/panic/unwind_safe.rs:272
#46 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<test::run_test_in_process::{closure_env#0}>, core::result::Result<(), alloc::string::String>> () at library/std/src/panicking.rs:552
#47 std::panicking::try<core::result::Result<(), alloc::string::String>, core::panic::unwind_safe::AssertUnwindSafe<test::run_test_in_process::{closure_env#0}>> () at library/std/src/panicking.rs:516
#48 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<test::run_test_in_process::{closure_env#0}>, core::result::Result<(), alloc::string::String>> () at library/std/src/panic.rs:142
#49 test::run_test_in_process () at library/test/src/lib.rs:650
#50 test::run_test::{closure#0} () at library/test/src/lib.rs:573
#51 0x0000564ab8c5b966 in test::run_test::{closure#1} () at library/test/src/lib.rs:601
#52 std::sys_common::backtrace::__rust_begin_short_backtrace<test::run_test::{closure_env#1}, ()> () at library/std/src/sys_common/backtrace.rs:155
#53 0x0000564ab8c609c7 in std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure#0}<test::run_test::{closure_env#1}, ()> () at library/std/src/thread/mod.rs:529
#54 core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<test::run_test::{closure_env#1}, ()>> () at library/core/src/panic/unwind_safe.rs:272
#55 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<test::run_test::{closure_env#1}, ()>>, ()> () at library/std/src/panicking.rs:552
#56 std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<test::run_test::{closure_env#1}, ()>>> () at library/std/src/panicking.rs:516
#57 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<test::run_test::{closure_env#1}, ()>>, ()> () at library/std/src/panic.rs:142
#58 std::thread::{impl#0}::spawn_unchecked_::{closure#1}<test::run_test::{closure_env#1}, ()> () at library/std/src/thread/mod.rs:528
#59 core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<test::run_test::{closure_env#1}, ()>, ()> () at library/core/src/ops/function.rs:250
#60 0x0000564ab94a11a5 in alloc::boxed::{impl#47}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at library/alloc/src/boxed.rs:2015
#61 alloc::boxed::{impl#47}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at library/alloc/src/boxed.rs:2015
#62 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#63 0x00007f3d8ab2119d in start_thread () at /lib64/libc.so.6
#64 0x00007f3d8aba2c60 in clone3 () at /lib64/libc.so.6