View Issue Details

IDProjectCategoryView StatusLast Update
0009044ardourbugspublic2022-10-29 17:04
Reportergonsolo Assigned Topaul  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
PlatformUbuntuOSLinuxOS Version(any)
Product Version7.0 
Summary0009044: Crash when trying to disconnect from jack.
DescriptionI start ardbg at commit 7.0-141-gefdc47bc74 and load my session on Ubuntu Kinetic with "pw-jack ./ardbg".
When I try to switch from jack to something else Ardour crashes.
Here is the stack trace:

#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
0000001 __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007ffff343bc46 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
0000004 0x00007ffff34227fc in __GI_abort () at ./stdlib/abort.c:79
0000005 0x00007ffff342271b in __assert_fail_base
    (fmt=0x7fffef6039b5 <error: Cannot access memory at address 0x7fffef6039b5>, assertion=0x7fffd7fe1614 <error: Cannot access memory at address 0x7fffd7fe1614>, file=0x7fffd7fe15e8 <error: Cannot access memory at address 0x7fffd7fe15e8>, line=728, function=<optimized out>) at ./assert/assert.c:92
#6 0x00007ffff3433596 in __GI___assert_fail
    (assertion=0x7fffd7fe1614 <error: Cannot access memory at address 0x7fffd7fe1614>, file=0x7fffd7fe15e8 <error: Cannot access memory at address 0x7fffd7fe15e8>, line=728, function=0x7fffd7fe1620 <error: Cannot access memory at address 0x7fffd7fe1620>) at ./assert/assert.c:101
#7 0x00007fffd7fd34fc in boost::shared_ptr<ARDOUR::JackPort>::operator->() const (this=0x7fffffffb3d0) at /usr/include/boost/smart_ptr/shared_ptr.hpp:728
0000008 0x00007fffd7fd0883 in ARDOUR::JACKAudioBackend::get_port_name[abi:cxx11](boost::shared_ptr<ARDOUR::ProtoPort> const&) const (this=0x5555575dd1e0, port=...) at ../libs/backends/jack/jack_portengine.cc:125
0000009 0x00007ffff744b2a4 in ARDOUR::PortManager::get_port_by_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    (this=0x5555575e1d60, portname=<Fehler beim Lesen der Variable: Cannot access memory at address 0x55555ed0b6a8>) at ../libs/ardour/port_manager.cc:507
0000010 0x00007ffff6dd9fc3 in ARDOUR::Bundle::connected_to(boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::AudioEngine&, ARDOUR::DataType, bool)
    (this=0x55555ec15f00, other=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffb4f0>, engine=..., type=..., exclusive=true) at ../libs/ardour/bundle.cc:483
0000011 0x000055555627a9af in IOButtonBase::set_label(IOButtonBase&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Bundle>&, boost::shared_ptr<ARDOUR::IO>)
    (self=..., session=..., bndl=..., io=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffb5b0>) at ../gtk2_ardour/io_button.cc:258
0000012 0x00005555562801b3 in IOButton::update() (this=0x5555775de540) at ../gtk2_ardour/io_button.cc:703
0000013 0x000055555628c369 in boost::_mfi::mf0<void, IOButton>::operator()(IOButton*) const (this=0x7fffb401cf58, p=0x5555775de540) at /usr/include/boost/bind/mem_fn_template.hpp:49
0000014 0x000055555628aa47 in boost::_bi::list1<boost::_bi::value<IOButton*> >::operator()<boost::_mfi::mf0<void, IOButton>, boost::_bi::rrlist2<ARDOUR::IOChange, void*> >(boost::_bi::type<void>, boost::_mfi::mf0<void, IOButton>&, boost::_bi::rrlist2<ARDOUR::IOChange, void*>&, int) (this=0x7fffb401cf68, f=..., a=...) at /usr/include/boost/bind/bind.hpp:259
#15 0x0000555556288e85 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, IOButton>, boost::_bi::list1<boost::_bi::value<IOButton*> > >::operator()<ARDOUR::IOChange, void*>(ARDOUR::IOChange&&, void*&&)
    (this=0x7fffb401cf58, a1=..., a2=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffbdc0>) at /usr/include/boost/bind/bind.hpp:1318
0000016 0x00005555562871a4 in boost::detail::function::void_function_obj_invoker2<boost::_bi::bind_t<void, boost::_mfi::mf0<void, IOButton>, boost::_bi::list1<boost::_bi::value<IOButton*> > >, void, ARDOUR::IOChange, void*>::invoke(boost::detail::function::function_buffer&, ARDOUR::IOChange, void*) (function_obj_ptr=..., a0=..., a1=0x555557bf6830) at /usr/include/boost/function/function_template.hpp:158
#17 0x00005555561e76db in boost::function2<void, ARDOUR::IOChange, void*>::operator()(ARDOUR::IOChange, void*) const (this=0x7fffb401cf50, a0=..., a1=0x555557bf6830)
    at /usr/include/boost/function/function_template.hpp:763
0000018 0x00005555561e678a in boost::_bi::list2<boost::_bi::value<ARDOUR::IOChange>, boost::_bi::value<void*> >::operator()<boost::function<void (ARDOUR::IOChange, void*)>, boost::_bi::list0>(boost::_bi::type<void>, boost::function<void (ARDOUR::IOChange, void*)>&, boost::_bi::list0&, int) (this=0x7fffb401cf70, f=..., a=...) at /usr/include/boost/bind/bind.hpp:319
0000019 0x00005555561e4f86 in boost::_bi::bind_t<boost::_bi::unspecified, boost::function<void (ARDOUR::IOChange, void*)>, boost::_bi::list2<boost::_bi::value<ARDOUR::IOChange>, boost::_bi::value<void*> > >::operator()() (this=0x7fffb401cf50) at /usr/include/boost/bind/bind.hpp:1294
0000020 0x00005555561e2d36 in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified, boost::function<void (ARDOUR::IOChange, void*)>, boost::_bi::list2<boost::_bi::value<ARDOUR::IOChange>, boost::_bi::value<void*> > >, void>::invoke(boost::detail::function::function_buffer&) (function_obj_ptr=...) at /usr/include/boost/function/function_template.hpp:158
0000021 0x0000555555cb32d3 in boost::function0<void>::operator()() const (this=0x7fffb4069570) at /usr/include/boost/function/function_template.hpp:763
0000022 0x00007ffff559bd9d in Gtkmm2ext::UI::do_request(Gtkmm2ext::UIRequest*) (this=0x5555575a5a20, req=0x7fffb4069560) at ../libs/gtkmm2ext/gtk_ui.cc:499
0000023 0x00007ffff55a1561 in AbstractUI<Gtkmm2ext::UIRequest>::handle_ui_requests() (this=0x5555575a5a20) at ../libs/pbd/pbd/abstract_ui.cc:365
#24 0x00007ffff513e2d0 in BaseUI::request_handler(Glib::IOCondition) (this=0x5555575a5a20, ioc=Glib::IO_IN) at ../libs/pbd/base_ui.cc:153
0000025 0x00007ffff5142d0e in sigc::bound_mem_functor1<bool, BaseUI, Glib::IOCondition>::operator()(Glib::IOCondition const&) const
    (this=0x5555575a3f08, _A_a1=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffc24c>) at /usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:2066
0000026 0x00007ffff514285d in sigc::adaptor_functor<sigc::bound_mem_functor1<bool, BaseUI, Glib::IOCondition> >::operator()<Glib::IOCondition const&>(Glib::IOCondition const&) const
    (this=0x5555575a3f00, _A_arg1=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffc24c>) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:89
0000027 0x00007ffff51421a9 in sigc::internal::slot_call1<sigc::bound_mem_functor1<bool, BaseUI, Glib::IOCondition>, bool, Glib::IOCondition>::call_it(sigc::internal::slot_rep*, Glib::IOCondition const&)
    (rep=0x5555575a3ed0, a_1=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffc24c>) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:170
0000028 0x00007ffff5158c20 in sigc::slot1<bool, Glib::IOCondition>::operator()(Glib::IOCondition const&) const
    (this=0x5555575a5ab8, _A_a1=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffc24c>) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:665
0000029 0x00007ffff51588e8 in cross_thread_channel_call_receive_slot(_GIOChannel*, GIOCondition, void*) (condition=G_IO_IN, data=0x5555575a5aa8) at ../libs/pbd/crossthread.cc:52
0000030 0x00007ffff4dfb3cf in g_main_dispatch (context=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffc178>) at ../../../glib/gmain.c:3444
0000031 g_main_context_dispatch (context=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffc178>) at ../../../glib/gmain.c:4162

I'm happy to provide further details.
Steps To Reproduce1. Get Ubuntu Kinetic
2. Compile ardour
3. Start with "pw-jack ./ardbg"
4. Load session: https://drive.google.com/file/d/1yAc12rxdwuMNrcdr2gV_lpkL0vPSrNcY/view?usp=sharing
5. Try to disconnect from jack: crash.
TagsNo tags attached.

Activities

kiilerix

2022-10-28 17:30

reporter   ~0026733

I can confirm that I also periodically have had problems around JACK / pipewire get_port_name.

gonsolo

2022-10-28 18:06

reporter   ~0026734

If it helps, I can also file a bug at pipewire.

paul

2022-10-28 19:48

administrator   ~0026735

A more usefl but also more difficult test would be to try a "real" version of JACK

gonsolo

2022-10-29 10:07

reporter   ~0026742

I filed a bug at pipewire.org: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2796

gonsolo

2022-10-29 15:29

reporter   ~0026745

Wim Taymans from pipewire suggested to run through valgrind.
This is the tail of the log:

```
Graph::engine_stopped. n_thread: 23
==9936== Thread 1 ArdourGUI:
==9936== Syscall param futex(futex) points to uninitialised byte(s)
==9936== at 0x8FF6C4D: syscall (syscall.S:38)
==9936== by 0x7740023: PBD::Semaphore::signal() (semutils.cc:108)
==9936== by 0x5C7DC55: ARDOUR::Graph::drop_threads() (graph.cc:171)
==9936== by 0x5C7D77F: ARDOUR::Graph::engine_stopped() (graph.cc:101)
==9936== by 0x5C8ABC8: boost::_mfi::mf0<void, ARDOUR::Graph>::operator()(ARDOUR::Graph*) const (mem_fn_template.hpp:49)
==9936== by 0x5C8A154: void boost::_bi::list1<boost::_bi::value<ARDOUR::Graph*> >::operator()<boost::_mfi::mf0<void, ARDOUR::Graph>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, ARDOUR::Graph>&, boost::_bi::list0&, int) (bind.hpp:259)
==9936== by 0x5C890A7: boost::_bi::bind_t<void, boost::_mfi::mf0<void, ARDOUR::Graph>, boost::_bi::list1<boost::_bi::value<ARDOUR::Graph*> > >::operator()() (bind.hpp:1294)
==9936== by 0x5C87618: boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ARDOUR::Graph>, boost::_bi::list1<boost::_bi::value<ARDOUR::Graph*> > >, void>::invoke(boost::detail::function::function_buffer&) (function_template.hpp:158)
==9936== by 0x8672D2: boost::function0<void>::operator()() const (function_template.hpp:763)
==9936== by 0x866D22: PBD::Signal0<void, PBD::OptionalLastValue<void> >::operator()() (signals_generated.h:340)
==9936== by 0x5A9C66B: ARDOUR::AudioEngine::stop(bool) (audioengine.cc:1147)
==9936== by 0xC847CC: EngineControl::stop_engine(bool) (engine_dialog.cc:517)
==9936== Address 0x118920e4 is 308 bytes inside a block of size 448 alloc'd
==9936== at 0x4845013: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==9936== by 0x62772B9: ARDOUR::Session::immediately_post_engine() (session.cc:569)
==9936== by 0x62732C6: ARDOUR::Session::Session(ARDOUR::AudioEngine&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ARDOUR::BusProfile const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool) (session.cc:372)
==9936== by 0x928CB7: ARDOUR_UI::build_session_stage_two(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ARDOUR::BusProfile const&, bool) (ardour_ui_session.cc:683)
==9936== by 0x9286C3: ARDOUR_UI::build_session(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ARDOUR::BusProfile const&, bool, bool) (ardour_ui_session.cc:626)
==9936== by 0x93AEB5: ARDOUR_UI::load_session_from_startup_fsm() (ardour_ui_startup.cc:670)
==9936== by 0x939DD7: ARDOUR_UI::sfsm_response(StartupFSM::Result) (ardour_ui_startup.cc:533)
==9936== by 0x93F47B: sigc::bound_mem_functor1<void, ARDOUR_UI, StartupFSM::Result>::operator()(StartupFSM::Result const&) const (mem_fun.h:2066)
==9936== by 0x93F016: sigc::adaptor_functor<sigc::bound_mem_functor1<void, ARDOUR_UI, StartupFSM::Result> >::deduce_result_type<StartupFSM::Result const&, void, void, void, void, void, void>::type sigc::adaptor_functor<sigc::bound_mem_functor1<void, ARDOUR_UI, StartupFSM::Result> >::operator()<StartupFSM::Result const&>(StartupFSM::Result const&) const (adaptor_trait.h:89)
==9936== by 0x93E770: sigc::internal::slot_call<sigc::bound_mem_functor1<void, ARDOUR_UI, StartupFSM::Result>, void, StartupFSM::Result>::call_it(sigc::internal::slot_rep*, StartupFSM::Result const&) (slot.h:451)
==9936== by 0x15EC896: sigc::internal::signal_emit1<void, StartupFSM::Result, sigc::nil>::emit(sigc::internal::signal_impl*, StartupFSM::Result const&) (signal.h:1045)
==9936== by 0x15EBD56: sigc::signal1<void, StartupFSM::Result, sigc::nil>::emit(StartupFSM::Result const&) const (signal.h:2955)
==9936==
Graph::drop_threads() sema-counts: 0, 0, 1
ardour-7.0.141: /usr/include/boost/smart_ptr/shared_ptr.hpp:728: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = ARDOUR::JackPort; typename boost::detail::sp_member_access<T>::type = ARDOUR::JackPort*]: Zusicherung »px != 0« nicht erfüllt.
==9936==
==9936== Process terminating with default action of signal 6 (SIGABRT)
==9936== at 0x8F7226B: __pthread_kill_implementation (pthread_kill.c:44)
==9936== by 0x8F7226B: __pthread_kill_internal (pthread_kill.c:78)
==9936== by 0x8F7226B: pthread_kill@@GLIBC_2.34 (pthread_kill.c:89)
==9936== by 0x8F1BC45: raise (raise.c:26)
==9936== by 0x8F027FB: abort (abort.c:79)
==9936== by 0x8F0271A: __assert_fail_base.cold (assert.c:92)
==9936== by 0x8F13595: __assert_fail (assert.c:101)
==9936== by 0x150D14FB: boost::shared_ptr<ARDOUR::JackPort>::operator->() const (shared_ptr.hpp:728)
==9936== by 0x150CE882: ARDOUR::JACKAudioBackend::get_port_name[abi:cxx11](boost::shared_ptr<ARDOUR::ProtoPort> const&) const (jack_portengine.cc:125)
==9936== by 0x61912A3: ARDOUR::PortManager::get_port_by_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (port_manager.cc:507)
==9936== by 0x5B1FFC2: ARDOUR::Bundle::connected_to(boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::AudioEngine&, ARDOUR::DataType, bool) (bundle.cc:483)
==9936== by 0xE2E9AE: IOButtonBase::set_label(IOButtonBase&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Bundle>&, boost::shared_ptr<ARDOUR::IO>) (io_button.cc:258)
==9936== by 0xE341B2: IOButton::update() (io_button.cc:703)
==9936== by 0xE31DBE: IOButton::port_connected_or_disconnected(boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>) (io_button.cc:487)
```

Can it be that ardour was stopping the engine and then trying to grab a port?
log.xz (122,212 bytes)

paul

2022-10-29 15:37

administrator   ~0026746

Last edited: 2022-10-29 15:38

I've just pushed 1eaaf4303b which might address this. Let me know.

paul

2022-10-29 15:48

administrator   ~0026747

BTW, gdb produces more useful backtraces than valgrind, but the valgrind output is still sometimes useful.

gonsolo

2022-10-29 15:55

reporter   ~0026748

The following patch fixes the issue. I'm not sure who is the guilty one (ardour or pipewire), but I thought I just let you both know.

After applying the fix I can stop and start (pipewire-)jack without any crash.
0001-Fix-crash-when-stop-jack-server-under-pipewire.patch (846 bytes)   
From 136c5eedb459add3f11dfaa6ccd979ec17255221 Mon Sep 17 00:00:00 2001
From: Gon Solo <gonsolo@gmail.com>
Date: Sat, 29 Oct 2022 17:52:01 +0200
Subject: [PATCH] Fix crash when stop jack server under pipewire.

---
 libs/backends/jack/jack_portengine.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libs/backends/jack/jack_portengine.cc b/libs/backends/jack/jack_portengine.cc
index 0074732953..f2be1645a0 100644
--- a/libs/backends/jack/jack_portengine.cc
+++ b/libs/backends/jack/jack_portengine.cc
@@ -122,6 +122,10 @@ JACKAudioBackend::set_port_name (PortHandle port, const std::string& name)
 string
 JACKAudioBackend::get_port_name (PortHandle port) const
 {
+        if (port == nullptr) {
+                return "";
+        }
+
 	return jack_port_name (boost::dynamic_pointer_cast<JackPort>(port)->jack_ptr);
 }
 
-- 
2.37.2

gonsolo

2022-10-29 15:59

reporter   ~0026749

I also sent the fix to pipewire: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2796#note_1613565

gonsolo

2022-10-29 16:01

reporter   ~0026750

Ah, now I've read the message about commit 1eaaf4303b. Trying it out...

gonsolo

2022-10-29 16:12

reporter   ~0026751

Ok. 1eaaf4303b fixes my issue.

Issue History

Date Modified Username Field Change
2022-10-28 10:36 gonsolo New Issue
2022-10-28 17:30 kiilerix Note Added: 0026733
2022-10-28 18:06 gonsolo Note Added: 0026734
2022-10-28 19:48 paul Note Added: 0026735
2022-10-29 10:07 gonsolo Note Added: 0026742
2022-10-29 15:29 gonsolo Note Added: 0026745
2022-10-29 15:29 gonsolo File Added: log.xz
2022-10-29 15:37 paul Note Added: 0026746
2022-10-29 15:38 paul Note Edited: 0026746
2022-10-29 15:48 paul Note Added: 0026747
2022-10-29 15:55 gonsolo Note Added: 0026748
2022-10-29 15:55 gonsolo File Added: 0001-Fix-crash-when-stop-jack-server-under-pipewire.patch
2022-10-29 15:59 gonsolo Note Added: 0026749
2022-10-29 16:01 gonsolo Note Added: 0026750
2022-10-29 16:12 gonsolo Note Added: 0026751
2022-10-29 17:04 paul Assigned To => paul
2022-10-29 17:04 paul Status new => resolved
2022-10-29 17:04 paul Resolution open => fixed