Camomile icon indicating copy to clipboard operation
Camomile copied to clipboard

Linux LV2 & Ardour: generic controls crash Ardour

Open GModal opened this issue 4 years ago • 23 comments

  1. Describe your environment Debian Buster, stable Carla 2.3.0-alpha1 Ardour 5.12.0 Qtractor 0.9.5 Camomile 1.0.7

  2. Describe the problem or the feature request Changing any LV2 parameters via the generic control interface crash Ardour.

Here is the error msg in Bash (Ardour started from shell):

(ardour-5.12.0:4242): Gdk-CRITICAL **: IA__gdk_window_get_origin: assertion 'GDK_IS_WINDOW (window)' failed

(ardour-5.12.0:4242): Gdk-CRITICAL **: IA__gdk_window_get_origin: assertion 'GDK_IS_WINDOW (window)' failed
Segmentation fault 

The GUI window is not open.

GModal avatar Sep 17 '20 22:09 GModal

V 1.0.8-beta4: Generic controls still crash Ardour (for LV2 -- as noted elsewhere, vst3 plugins are blacklisted). The Camomile GUI window works fine, and the plugin functions normally.

Quirks: -- if the plugin is bypassed, adjusting a generic control doesn't trigger a crash...but the instant the plugin is re-enabled, Ardour crashes. Even if the generic control window is already closed (and the bypass changed on the tiny plugin icon in the mixer column).

-- the small controls that can be shown/hidden below the plugin icon (mixer), all function normally with the Camomile GUI interface uninstantiated (closed). So those generic controls function correctly, strangely enough:

ardourMixerContrls

Those controls are enabled with rt-click (over plugin) menu -> Controls (with various sub-options).

Tested on both:

Debian Buster 4.19.0-13-rt-amd64 Ardour 5.12.0

Ubuntu 20.04.1 5.8.0-36-lowlatency Ardour 5.12.0

GModal avatar Jan 13 '21 22:01 GModal

Do you have the full backtrace or log of the crash? Did you use the pre-compiled binaries? Do you have the same issue with Carla and Qtraktor? If so can you give the backtrace of these crashes? Can you share the patch/plugin?

pierreguillot avatar Jan 15 '21 08:01 pierreguillot

I tested on Ubuntu 20.04.1 LTS - 64bit with Ardour 6.5.0 and there is no problem. Can you test it and confirm? Is there any reason not to update to Ardour 6.5.0?

pierreguillot avatar Jan 21 '21 17:01 pierreguillot

I tested with the Bulgroz and Castafiore plugins (from the examples package Camomile v1.0.8 beta4). Please try with these plugins.

pierreguillot avatar Jan 21 '21 17:01 pierreguillot

OK, I will test later today, and let you know. My Ardour version is from the KXstudio repositories, and those binaries (plugins, apps, etc) usually play well together, and that's a painless path forward to newer versions...not the bleeding edge, but generally current enough. I do, however use the git version of Carla, from the same repos.

If I'm still having issues, I'll send you the debugging info, and my Camomile source. I try to keep the Camomile code as simple as possible, but I might be missing something crucial (although the Ardour crashes are the only major issue I see).

I usually do have an abstraction or two in my code -- but the problem manifests in the simple plugins as well (and your abstractions: param.*.pd are safe, I assume).

Maybe then we can work out if it's just a local system anomaly, and you can close this.

GModal avatar Jan 22 '21 14:01 GModal

Do you know if it's possible to download the Ardour binaries for the older version? Because I can only find Ardour 6.5 on their website. If I can reproduce the bug with an older version and then see if with the latest version this is fixed, it would be helpful.

I also checked the release notes since Ardour 5.12 and it seems that some fixes might be related to this issue. For example, "Fix crashes when editing automation points." on Ardour 6.3.

pierreguillot avatar Jan 23 '21 10:01 pierreguillot

OK, I downloaded & compiled Ardour 6.5.161 from source, and was seeing the same behavior. But I could have saved myself the trouble -- Castafiore & Bulgroz both work just fine with generic control in Ardour.

So the crash issue must be related to my code. I'll attach a zip to this msg with Camomile code I wrote. AUCOP-pingolo.zip

I do try to keep source as simple as possible. Since it doesn't cause problems with generic controls in other hosts (or even in GUI form on Ardour), I'm not sure where I'm messing up. Please let me know!

GModal avatar Jan 24 '21 14:01 GModal

Question: is the presence of program.get.pd required? Adding that to the project folder does seem to fix this... ... EDIT -- well, it did, for a while.

GModal avatar Jan 24 '21 17:01 GModal

No, none of the patches given in the examples (such as param.get, param.set, program.get, etc.) are required. Can you send the full backtrace of the crash? It would be really helpful to debug!

And by the way, the output signal of your patch is not normalized, the signal is sometimes multiplied by 2 - perhaps this can be the cause of the crash, don't you think?

PS: Some of the graphical objects have send or receive symbols that don't match to anything. And the number boxes don't have any low or high threshold.

pierreguillot avatar Jan 24 '21 17:01 pierreguillot

I tested your plugin on Ubuntu 20.04.1 LTS - 64bit with Ardour 6.5.0 and I had no crash. But perhaps I'm just not able to reproduce the crash. So here is what I've done:

  • Open Ardour (double-click on the Icon)
  • Create a session
  • Create a track
  • Insert the LV2 version of your plugin in the track
  • Close the plugin window
  • Right-click on the plugin slot and show the generic controls
  • Start the playback
  • Changes the parameters (using the generic controls) -> No crash
  • Bypass the plugin
  • Changes the parameters (using the generic controls) -> No crash
  • Re-enable the plugin -> No crash

I admit I don't know what to do now... You should give all the information you can. About your OS, your machine (the CPU and so on), the backtrace, what you did step by step to produce the crash, etc. even it seems not relevant to you.

PS: Are you sure to do things properly while compiling Ardour? Why not using the pre-compiled version?

pierreguillot avatar Jan 24 '21 18:01 pierreguillot

  • I've always used the Kxstudio pre-compiled version, until trying to debug this.
  • Oops, darn that copy-and-paste. I cleaned up the Pd objs, numberbox limits, clipped the output to +/- 0.99, but still have the same issue.

I tried gdb with several variations of ./ardev, ./ardev -D ... ./ardbg and with vargrind. One variation crashed and froze my system for 10 minutes. The rest didn't have any symbols, even with the debug flag.

But I think I've finally got your backtrace, with the ./arcall script:

Set cursor set to default
 loading from /home/dgp/Documents/ardour6/testA6_1 as testA6_1 templ  is_new 0 bp 0
locate to 0 took 45694 usecs for 2 tracks = 22847 per track
locate to 291840 took 46336 usecs for 2 tracks = 23168 per track
locate to 0 took 43950 usecs for 2 tracks = 21975 per track
PluginWindow deleted for 0xb0c4d570

Above msgs are fairly normal.

==14935== 
==14935== Process terminating with default action of signal 11 (SIGSEGV)
==14935==  Access not within mapped region at address 0xE1
==14935==    at 0x15DF6EE: boost::shared_ptr<ARDOUR::AutomationControl>::shared_ptr(boost::shared_ptr<ARDOUR::AutomationControl> const&) (shared_ptr.hpp:422)
==14935==    by 0xE0: ???
==14935==    by 0x2300459: LV2PluginUI::write_from_ui(void*, unsigned int, unsigned int, unsigned int, void const*) (lv2_plugin_ui.cc:67)
==14935==    by 0xB5BBB208: JuceLv2UIWrapper::audioProcessorParameterChanged(juce::AudioProcessor*, int, float) (in /home/dgp/.lv2/AUCOP-pingolo.lv2/AUCOP-pingolo.so)
==14935==    by 0xB5BC81A4: juce::AudioProcessorParameter::sendValueChangedMessageToListeners(float) (in /home/dgp/.lv2/AUCOP-pingolo.lv2/AUCOP-pingolo.so)
==14935==    by 0xB5B57B3C: CamomileAudioProcessor::receiveMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<pd::Atom, std::allocator<pd::Atom> > const&) (in /home/dgp/.lv2/AUCOP-pingolo.lv2/AUCOP-pingolo.so)
==14935==    by 0xB5B7DD13: pd::Instance::processMessages() (in /home/dgp/.lv2/AUCOP-pingolo.lv2/AUCOP-pingolo.so)
==14935==    by 0xB5B4378F: CamomileAudioProcessor::processBlock(juce::AudioBuffer<float>&, juce::MidiBuffer&) (in /home/dgp/.lv2/AUCOP-pingolo.lv2/AUCOP-pingolo.so)
==14935==    by 0xB5BBB88D: JuceLv2Wrapper::lv2Run(unsigned int) (in /home/dgp/.lv2/AUCOP-pingolo.lv2/AUCOP-pingolo.so)
==14935==    by 0x612E78F: lilv_instance_run (lilv.h:1704)
==14935==    by 0x61412F6: ARDOUR::LV2Plugin::run(unsigned int, bool) (lv2_plugin.cc:3240)
==14935==    by 0x613EE06: ARDOUR::LV2Plugin::connect_and_run(ARDOUR::BufferSet&, long, long, double, ARDOUR::ChanMapping const&, ARDOUR::ChanMapping const&, unsigned int, long) (lv2_plugin.cc:2899)
==14935==    by 0x5E392C4: ARDOUR::PluginInsert::connect_and_run(ARDOUR::BufferSet&, long, long, double, unsigned int, long, bool) (plugin_insert.cc:1083)
==14935==    by 0x5E3AAC2: ARDOUR::PluginInsert::run(ARDOUR::BufferSet&, long, long, double, unsigned int, bool) (plugin_insert.cc:1291)
==14935==    by 0x5F08FA8: ARDOUR::Route::process_output_buffers(ARDOUR::BufferSet&, long, long, unsigned int, bool, bool) (route.cc:530)
==14935==    by 0x5F0A080: ARDOUR::Route::run_route(long, long, unsigned int, bool, bool) (route.cc:716)
==14935==    by 0x5F1E7DD: ARDOUR::Route::no_roll_unlocked(unsigned int, long, long, bool) (route.cc:3945)
==14935==    by 0x5F1E69D: ARDOUR::Route::no_roll(unsigned int, long, long, bool) (route.cc:3915)
==14935==    by 0x5A45EB9: ARDOUR::Graph::process_one_route(ARDOUR::Route*) (graph.cc:670)
==14935==    by 0x5A4B45D: ARDOUR::GraphNode::process() (graphnode.cc:80)
==14935==    by 0x5A46148: ARDOUR::GraphNode::run(int) (graphnode.h:62)
==14935==    by 0x5A4383B: ARDOUR::Graph::run_one() (graph.cc:442)
==14935==    by 0x5A44048: ARDOUR::Graph::main_thread() (graph.cc:523)
==14935==    by 0x5A4ABD8: boost::_mfi::mf0<void, ARDOUR::Graph>::operator()(ARDOUR::Graph*) const (mem_fn_template.hpp:49)
==14935==    by 0x5A4A36C: 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)
==14935==    by 0x5A49779: boost::_bi::bind_t<void, boost::_mfi::mf0<void, ARDOUR::Graph>, boost::_bi::list1<boost::_bi::value<ARDOUR::Graph*> > >::operator()() (bind.hpp:1294)
==14935==    by 0x5A48E00: 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)
==14935==    by 0x15BFF9E: boost::function0<void>::operator()() const (function_template.hpp:763)
==14935==    by 0x2289A2F6: ARDOUR::JACKAudioBackend::_start_process_thread(void*) (jack_audiobackend.cc:953)
==14935==    by 0x839B608: start_thread (pthread_create.c:477)
==14935==    by 0x8B3E292: clone (clone.S:95)
==14935==  If you believe this happened as a result of a stack
==14935==  overflow in your program's main thread (unlikely but
==14935==  possible), you can try to increase the size of the
==14935==  main thread stack using the --main-stacksize= flag.
==14935==  The main thread stack size used in this run was 8388608.
==14935== 
==14935== Events    : Ir sysCount sysTime
==14935== Collected : 0
==14935== 
==14935== I   refs:      0
Segmentation fault (core dumped)

GModal avatar Jan 24 '21 19:01 GModal

Another note: Ardour 6.5.x does have VST3 support. Unfortunately (again -- here on this install), both Bulgroz and Castafiore VST3 plugins crash Ardour instantly when trying to open a generic control window.

They both seem to work fine as LV2 plugins. The other Camomile LV2 plugins that DO crash Ardour, do so only when dragging a control.

Other unusual behavior, maybe not significant: Ardour opens a small window, with the plugin GUI embedded within. Sometimes the Camomile plugins are centered in that window, sometimes they are left-aligned.

With the VST3 versions, controls are left-aligned, but any background image (if present) isn't drawn within the original plugin dimensions. The image fills the whole window container.

GModal avatar Jan 24 '21 20:01 GModal

Is there a git for beta4? I know several submodules (JUCE, Pd, libpd, etc) are needed, and it's much easier to get those via git.

If the plugins work with a local build, it could be related to the older libraries used in KXstudio (most of my plugins are from KXstudio packages).

GModal avatar Jan 25 '21 14:01 GModal

This is the git ;) Check that https://github.com/pierreguillot/Camomile/tree/v1.0.8-beta4. I'll try to investigate your backtrace in the meantime, thank you!

pierreguillot avatar Jan 25 '21 17:01 pierreguillot

What surprises me in the backtrace is that the method CamomileAudioProcessor::receiveMessage effectively perform something even if the plugin window is closed. Based on your patch, this should not happen. In your patch, messages are sent ot Camomile only when interacting the GUI - that is obviously not possible if the plugin window is closed. Can you try a few things:

  • Remove the [param.set] and [param.change] abstractions and test the plugin
  • Remove the sliders and number boxes and test the plugin
  • Remove the [param.get] abstractions and test the plugin

At this stage, onyl the DSP part of the patch remains. If the plugin stops to crash and it will facilitate the localization of the problem.

pierreguillot avatar Jan 25 '21 17:01 pierreguillot

OK, I'll try eliminating those objs (and alternately try send and receive to the camomile obj directly).

Sorry, I can't find the git at that link...

GModal avatar Jan 25 '21 20:01 GModal

OK, this LV2 plugin doesn't crash Ardour, in either the GUI or generic. Only param.get.pd is included, with a snippet of param.set.pd added.

mAmp_Pd

It doesn't update the slider when switching to the GUI, but it's a start.

Interesting Note: The Camomile GUI window is left-aligned in the window when opening the plugin. Clicking the disable / enable button centers the GUI in that window. Probably not related to our problem, just a quirk, maybe because most GUIs are larger than the minimum plugin window size in Ardour...

GModal avatar Jan 25 '21 22:01 GModal

Sorry, I can't find the git at that link...

On the main page o the repository, click on the green Code button and select the address HTTPS (https://github.com/pierreguillot/Camomile.git) or SSH ([email protected]:pierreguillot/Camomile.git).

pierreguillot avatar Jan 26 '21 13:01 pierreguillot

OK, it's the main repo.

Sorry for my confusion, I thought beta4 was another branch, or a private repository. Thanks.

GModal avatar Jan 26 '21 14:01 GModal

No there is a tag at the specific commit on the branch dev/v1.0.8

pierreguillot avatar Jan 26 '21 15:01 pierreguillot

Here's a backtrace of Castafiore VST3, on Beta4, Ardour 6.5.x

Camomile: Castafiore
JUCE v6.0.1
locate to 0 took 46760 usecs for 2 tracks = 23380 per track
locate to 0 took 44055 usecs for 2 tracks = 22028 per track
locate to 0 took 41896 usecs for 2 tracks = 20948 per track

Castafiore functions normally, with the GUI window.

Now GUI window closed. Selected "Edit with generic controls"

PluginWindow deleted for 0xc53217e0
==26038== 
==26038== Process terminating with default action of signal 11 (SIGSEGV)
==26038==  Bad permissions for mapped region at address 0x7C7481474C085
==26038==    at 0x7C7481474C085: ???
==26038==    by 0x73FEE8D: g_main_context_dispatch (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.3)
==26038==    by 0x73FF23F: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.3)
==26038==    by 0x73FF532: g_main_loop_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.3)
==26038==    by 0x761A091: gtk_main (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.32)
==26038==    by 0x700732A: Gtkmm2ext::UI::run(Receiver&) (gtk_ui.cc:310)
==26038==    by 0x1C1AC99: main (main.cc:410)
==26038== 
==26038== Events    : Ir sysCount sysTime
==26038== Collected : 0
==26038== 
==26038== I   refs:      0
Segmentation fault (core dumped)

GModal avatar Jan 26 '21 18:01 GModal

The dev/v1.0.8 git branch builds very smoothly; no issues compiling on Ubuntu. Unfortunately I'm seeing the same behavior with generic controls in both versions of Ardour (packaged 5.12 & local build 6.5.161).

I stripped the symbols from the libraries, but kept the originals just in case that helps with future debugging.

GModal avatar Jan 27 '21 14:01 GModal

Any update on this issue?

pierreguillot avatar Oct 30 '21 14:10 pierreguillot