brummer10 / Fluida.lv2

Fluidsynth as LV2 plugin
GNU General Public License v2.0
37 stars 5 forks source link

Git head crashes Ardour 8.6 host #33

Open mikelupe opened 6 months ago

mikelupe commented 6 months ago

Hello, first of all thank you for your plugins.

I'm on Debian 12 / KDE / X11. I build Ardour with and without the gtk2 replacement "ytk" (which integrates a stripped-down gtk2), so this parameter could be ruled out for the following issue, I guess.

A build I had compiled shortly after your last commit in January now crashes Ardour (Ardour backtrace showed it, x42 confirmed this). Possibly this already could have happend before I stumbled over it last week.

I'd have to create a new BT in Ardour, the old one is lost. Or is there a "simple" way to debug Fluida.lv2?

regards

x42 commented 6 months ago

Mike posted a backtrace, but the link meanwhile expired.

The issue was in the LV2's state restore function that and caused a segfault somewhere when setting state to fluidsynth.

brummer10 commented 6 months ago

Thanks for forward the issue to me, I'll check and fix that. _ could already reproduce the crash, that's good.

mikelupe commented 6 months ago

I've found the bt in the lowlands of my editor's CTRL-Z history.

I guess the relevant entries are:

(gdb) thread apply all bt Thread 286 (Thread 0x7fff93e006c0 (LWP 18657) "ArdourGUI"):

0 __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x5555af371200) at ./nptl/futex-internal.c:57

1 __futex_abstimed_wait_common (futex_word=futex_word@entry=0x5555af371200, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0, cancel=cancel@entry=true) at ./nptl/futex-internal.c:87

2 0x00007ffff32a4efb in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x5555af371200, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ./nptl/futex-internal.c:139

3 0x00007ffff32a7558 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555af3711a8, cond=0x5555af3711d8) at ./nptl/pthread_cond_wait.c:503

4 ___pthread_cond_wait (cond=0x5555af3711d8, mutex=0x5555af3711a8) at ./nptl/pthread_cond_wait.c:618

#5 0x00007fffdaa4b8fa in ?? () from /home/user/.lv2/Fluida.lv2/Fluida.so

6 0x00007ffff34d44a3 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6

7 0x00007ffff32a8134 in start_thread (arg=) at ./nptl/pthread_create.c:442

8 0x00007ffff33287dc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

and at the end of the bt:

Thread 1 (Thread 0x7ffff0e5dc40 (LWP 18343) "ArdourGUI"):

0 __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:283

1 0x00007ffff450ac09 in g_str_equal () from /lib/x86_64-linux-gnu/libglib-2.0.so.0

2 0x00007ffff450970a in g_hash_table_lookup () from /lib/x86_64-linux-gnu/libglib-2.0.so.0

3 0x00007ffff452cbf4 in g_intern_static_string () from /lib/x86_64-linux-gnu/libglib-2.0.so.0

4 0x00007fffcf37ff8d in ?? () from /lib/x86_64-linux-gnu/libinstpatch-1.0.so.2

5 0x00007fffcf3802e5 in ipatch_base_get_type () from /lib/x86_64-linux-gnu/libinstpatch-1.0.so.2

6 0x00007fffcf3db0a2 in ipatch_init () from /lib/x86_64-linux-gnu/libinstpatch-1.0.so.2

7 0x00007fffcf55dfa4 in new_fluid_synth () from /lib/x86_64-linux-gnu/libfluidsynth.so.3

#8 0x00007fffdaa52341 in ?? () from /home/user/.lv2/Fluida.lv2/Fluida.so #9 0x00007fffdaa4af49 in ?? () from /home/user/.lv2/Fluida.lv2/Fluida.so

10 0x00007ffff3d4ef93 in lilv_plugin_instantiate () from /lib/x86_64-linux-gnu/liblilv-0.so.0

11 0x00007ffff728c24e in ARDOUR::LV2Plugin::init (this=0x5555af39f4c0, c_plugin=0x55555b0c7540, rate=48000) at ../libs/ardour/lv2_plugin.cc:694

12 0x00007ffff728a494 in ARDOUR::LV2Plugin::LV2Plugin (this=0x5555af39f4c0, engine=..., session=..., c_plugin=0x55555b0c7540, rate=48000, __in_chrg=, __vtt_parm=) at ../libs/ardour/lv2_plugin.cc:463

13 0x00007ffff729d9e6 in ARDOUR::LV2PluginInfo::load (this=0x55556041aee0, session=...) at ../libs/ardour/lv2_plugin.cc:3683

14 0x00007ffff6f02304 in ARDOUR::find_plugin (session=..., identifier=..., type=ARDOUR::LV2) at ../libs/ardour/plugin.cc:263

15 0x00007ffff6efbbe3 in ARDOUR::PlugInsertBase::find_and_load_plugin (this=0x55557aacc0c0, s=..., node=..., type=@0x7fffffff2e5c: ARDOUR::LV2, unique_id=..., any_vst=@0x7fffffff2e2f: false) at ../libs/ardour/plug_insert_base.cc:113

16 0x00007ffff6f1d796 in ARDOUR::PluginInsert::set_state (this=0x55557aacbab0, node=..., version=7003) at ../libs/ardour/plugin_insert.cc:2652

17 0x00007ffff7021ed3 in ARDOUR::Route::set_processor_state (this=0x5555a6a434f0, node=..., version=7003, prop=0x5555b7191260, new_order=..., must_configure=@0x7fffffff59ff: false) at ../libs/ardour/route.cc:3353

18 0x00007ffff7210df6 in ARDOUR::Track::set_processor_state (this=0x5555a6a434f0, node=..., version=7003, prop=0x5555b7191260, new_order=..., must_configure=@0x7fffffff59ff: false) at ../libs/ardour/track.cc:910

19 0x00007ffff7020913 in ARDOUR::Route::set_processor_state (this=0x5555a6a434f0, node=..., version=7003) at ../libs/ardour/route.cc:3227

20 0x00007ffff701dadd in ARDOUR::Route::set_state (this=0x5555a6a434f0, node=..., version=7003) at ../libs/ardour/route.cc:2822

21 0x00007ffff720d56d in ARDOUR::Track::set_state (this=0x5555a6a434f0, node=..., version=7003) at ../libs/ardour/track.cc:214

22 0x00007ffff6e61f7a in ARDOUR::MidiTrack::set_state (this=0x5555a6a434f0, node=..., version=7003) at ../libs/ardour/midi_track.cc:182

23 0x00007ffff7150378 in ARDOUR::Session::XMLRouteFactory (this=0x5555c1c0d800, node=..., version=7003) at ../libs/ardour/session_state.cc:2214

24 0x00007ffff714f906 in ARDOUR::Session::load_routes (this=0x5555c1c0d800, node=..., version=7003) at ../libs/ardour/session_state.cc:2137

25 0x00007ffff714de00 in ARDOUR::Session::set_state (this=0x5555c1c0d800, node=..., version=7003) at ../libs/ardour/session_state.cc:1991

26 0x00007ffff7141403 in ARDOUR::Session::post_engine_init (this=0x5555c1c0d800) at ../libs/ardour/session_state.cc:284

27 0x00007ffff7078d93 in ARDOUR::Session::Session (this=0x5555c1c0d800, eng=..., fullpath=..., snapshot_name=..., bus_profile=0x0, mix_template=..., unnamed=false, sr=0, __in_chrg=, __vtt_parm=) at ../libs/ardour/session.cc:450

28 0x0000555555db6ce7 in ARDOUR_UI::load_session_stage_two (this=0x55555758a9a0, path=..., snap_name=..., mix_template=...) at ../gtk2_ardour/ardour_ui_session.cc:410

29 0x0000555555db69b7 in ARDOUR_UI::load_session (this=0x55555758a9a0, path=..., snap_name=..., mix_template=...) at ../gtk2_ardour/ardour_ui_session.cc:379

30 0x0000555555db6275 in ARDOUR_UI::session_dialog_response_handler (this=0x55555758a9a0, response=-3, session_dialog=0x5555c2fe2b00) at ../gtk2_ardour/ardour_ui_session.cc:312

31 0x0000555555dc4a15 in sigc::bound_mem_functor2<void, ARDOUR_UI, int, SessionDialog*>::operator() (this=0x55555e873af0, _A_a1=@0x7fffffff9cb4: -3, _A_a2=@0x55555e873b10: 0x5555c2fe2b00) at /usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:2143

32 0x0000555555dc3d7f in sigc::adaptor_functor<sigc::bound_mem_functor2<void, ARDOUR_UI, int, SessionDialog> >::operator()<int const&, SessionDialog&> (this=0x55555e873ae8, _A_arg1=@0x7fffffff9cb4: -3, _A_arg2=@0x55555e873b10: 0x5555c2fe2b00) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:108

33 0x0000555555dc2eb3 in sigc::bind_functor<-1, sigc::bound_mem_functor2<void, ARDOUR_UI, int, SessionDialog>, SessionDialog, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::operator()<int const&> (this=0x55555e873ae0, _A_arg1=@0x7fffffff9cb4: -3) at /usr/include/sigc++-2.0/sigc++/adaptors/bind.h:1136

34 0x0000555555dc2293 in sigc::internal::slot_call1<sigc::bind_functor<-1, sigc::bound_mem_functor2<void, ARDOUR_UI, int, SessionDialog>, SessionDialog, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, void, int>::call_it (rep=0x55555e873ab0, a_1=@0x7fffffff9cb4: -3) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:170

35 0x00007ffff48bd9d0 in sigc::slot1<void, int>::operator() (this=0x5555bc63ef08, _A_a1=@0x7fffffff9cb4: -3) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:665

36 0x00007ffff48bcb36 in (anonymous namespace)::Dialog_signal_response_callback (self=0x555557c0be30, p0=-3, data=0x5555bc63ef00) at ../libs/tk/ytkmm/dialog.cc:85

37 0x00007ffff3f4e3b0 in g_closure_invoke () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0

38 0x00007ffff3f61344 in ?? () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0

39 0x00007ffff3f67bf5 in g_signal_emit_valist () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0

40 0x00007ffff3f67dbf in g_signal_emit () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0

41 0x00007ffff40d137c in IA__gtk_dialog_response (dialog=0x555557c0be30, response_id=-3) at ../libs/tk/ytk/gtkdialog.c:932

42 0x00007ffff48bd6af in Gtk::Dialog::response (this=0x5555c2fe2b00, response_id=-3) at ../libs/tk/ytkmm/dialog.cc:306

43 0x00005555569278f4 in SessionDialog::open_button_pressed (this=0x5555c2fe2b00, ev=0x5555c27ac300) at ../gtk2_ardour/session_dialog.cc:560

44 0x0000555556932084 in sigc::bound_mem_functor1<bool, SessionDialog, _GdkEventButton*>::operator() (this=0x5555ba4bdfd8, _A_a1=@0x7fffffffa210: 0x5555c27ac300) at /usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:2066

45 0x00005555569306ef in sigc::adaptor_functor<sigc::bound_mem_functor1<bool, SessionDialog, _GdkEventButton> >::operator()<_GdkEventButton const&> (this=0x5555ba4bdfd0, _A_arg1=@0x7fffffffa210: 0x5555c27ac300) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:89

46 0x000055555692f504 in sigc::internal::slot_call1<sigc::bound_mem_functor1<bool, SessionDialog, _GdkEventButton>, bool, _GdkEventButton>::call_it (rep=0x5555ba4bdfa0, a_1=@0x7fffffffa210: 0x5555c27ac300) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:170

47 0x00007ffff49859bc in sigc::slot1<bool, _GdkEventButton*>::operator() (this=0x55555ef3cce8, _A_a1=@0x7fffffffa210: 0x5555c27ac300) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:665

48 0x00007ffff497643c in (anonymous namespace)::Widget_signal_button_press_event_callback (self=0x5555c6c36590, p0=0x5555c27ac300, data=0x55555ef3cce0) at ../libs/tk/ytkmm/widget.cc:1157

49 0x00007ffff417b39b in _gtk_marshal_BOOLEAN__BOXED (closure=0x5555be977020, return_value=0x7fffffffa3e0, n_param_values=2, param_values=0x7fffffffa440, invocation_hint=0x7fffffffa3c0, marshal_data=0x0) at ../libs/tk/ytk/gtkmarshalers.c:84

50 0x00007ffff3f4e3b0 in g_closure_invoke () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0

51 0x00007ffff3f61076 in ?? () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0

52 0x00007ffff3f6742d in g_signal_emit_valist () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0

53 0x00007ffff3f67dbf in g_signal_emit () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0

54 0x00007ffff42ff987 in gtk_widget_event_internal (widget=0x5555c6c36590, event=0x5555c27ac300) at ../libs/tk/ytk/gtkwidget.c:5010

55 0x00007ffff42ff483 in IA__gtk_widget_event (widget=0x5555c6c36590, event=0x5555c27ac300) at ../libs/tk/ytk/gtkwidget.c:4807

56 0x00007ffff4179303 in IA__gtk_propagate_event (widget=0x5555c6c36590, event=0x5555c27ac300) at ../libs/tk/ytk/gtkmain.c:2446

57 0x00007ffff4177bad in IA__gtk_main_do_event (event=0x5555c27ac300) at ../libs/tk/ytk/gtkmain.c:1602

58 0x00007ffff529f4c9 in gdk_event_dispatch (source=0x5555575bcd90, callback=0x0, user_data=0x0) at ../libs/tk/ydk/x11/gdkevents-x11.c:2425

59 0x00007ffff451c7a9 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0

60 0x00007ffff451ca38 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0

61 0x00007ffff451ccef in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0

62 0x00007ffff41772cc in IA__gtk_main () at ../libs/tk/ytk/gtkmain.c:1213

63 0x00007ffff48efecd in Gtk::Main::run_impl (this=0x55555758a5c0) at ../libs/tk/ytkmm/main.cc:537

64 0x00007ffff48efcd5 in Gtk::Main::run () at ../libs/tk/ytkmm/main.cc:480

65 0x00007ffff4f89511 in Gtkmm2ext::UI::run (this=0x55555758a9a0, old_receiver=...) at ../libs/gtkmm2ext/gtk_ui.cc:305

66 0x00005555563a3980 in main (argc=3, argv=0x7fffffffaf58) at ../gtk2_ardour/main.cc:471

(gdb)

I'll keep the entire bt if there's a need for it.

brummer10 commented 6 months ago

From what I see after some quick tests, Fluida works with Ardour 8.4.0~ds1 from debian repository, but crash with Ardour-8.4.0 from official build. I'll going to debug this, but gime some day's.

x42 commented 6 months ago

As additional datapoint: @mikelupe compiles Ardour himself (no official binary, nor a debian version)

brummer10 commented 6 months ago

@mikelupe could you try the latest release please. There is a prebuild binary here: https://github.com/brummer10/Fluida.lv2/releases/download/v0.9.2/Fluida.lv2-v0.9.2-linux-x86_64.tar.xz

That one works here on debian based Ardour and as well on official binary. I like to know if it works on your build as well.

brummer10 commented 6 months ago

@x42 I run a debugging session with Ardour-8.4.0, I get lilv_lib_open(): error: Failed to open library /home/brummer/.lv2/Fluida.lv2/Fluida.so (/lib/x86_64-linux-gnu/libinstpatch-1.0.so.2: undefined symbol: g_string_free_and_steal)

So it's a incompatible library version. Comes Ardour with fluidsynth build in? Maybe that's why the prebuild binary of Fluida works, as that one using fluidsynth static.

x42 commented 6 months ago

undefined symbol: g_string_free_and_steal)

so the version of glib that comes with Ardour binaries is too old for system-wide fluidsynth.

Comes Ardour with fluidsynth build in?

Depends. Official binaries statically link against libfluidsynth (libardour and ACE Fluidsynth have no external dependencies). Distros (notably Debian) patches this to use system-wide version and dynamically link it.

Maybe that's why the prebuild binary of Fluida works, as that one using fluidsynth static.

OK, so this not a bug, just a @mikelupe is not using a statically linked version of the plugin.

mikelupe commented 6 months ago

As @x42 mentioned, a me is building both from source, Ardour and Fluida.

I'm building Fluida ~like this:

` # PREREQS # sudo apt install libcairo2-dev libx11-dev lv2-dev libfluidsynth-dev

git clone --recursive --recurse-submodules ${DL_SRC} ; cd ${PLG_NAME}.lv2 git submodule init ; git submodule update && time make -j16 && make install
` Don't question the steps too much, it's based on a build-template I have.

I'm not adept enough to understand whether having fluidsynth as a submodule would make sense or not. Anyway, thanks for hinting me how to build Fluida using statical fluidsynth.

I can report the result today or tomorrow, but I guess it's already clear where the "issue" was.