jatinchowdhury18 / AnalogTapeModel

Physical modelling signal processing for analog tape recording
GNU General Public License v3.0
1.12k stars 64 forks source link

[BUG] Segfault in Ardour7, AnalogTapeModel LV2 v2.11.1 #307

Closed florijanstamenkovic closed 1 year ago

florijanstamenkovic commented 1 year ago

Describe the bug A segfault occurs immediately when inserting the plugin into a channel in Ardour.

To Reproduce

  1. Start Ardour
  2. Add TapeModel
  3. Ardour crashes

Desktop (please complete the following information):

Additional context Stack trace for the thread that had a segfault. Note there is no std::vector access like in https://github.com/jatinchowdhury18/AnalogTapeModel/issues/283#issuecomment-1382912328

Thread 1 (Thread 0x7ffff7a4c900 (LWP 9634) "ArdourGUI"):
#0  0x00007fff408d2813 in ToneStage::processBlock(juce::AudioBuffer<float>&) () from /usr/lib/lv2/CHOWTapeModel.lv2/CHOWTapeModel.so
#1  0x00007fff40934e10 in ChowtapeModelAudioProcessor::processAudioBlock(juce::AudioBuffer<float>&) () from /usr/lib/lv2/CHOWTapeModel.lv2/CHOWTapeModel.so
#2  0x00007fff40902f33 in chowdsp::PluginBase<ChowtapeModelAudioProcessor>::processBlock(juce::AudioBuffer<float>&, juce::MidiBuffer&) () from /usr/lib/lv2/CHOWTapeModel.lv2/CHOWTapeModel.so
#3  0x00007fff409499ac in JuceLv2Wrapper::lv2Run(unsigned int) () from /usr/lib/lv2/CHOWTapeModel.lv2/CHOWTapeModel.so
#4  0x00007ffff6fcee77 in ARDOUR::LV2Plugin::run(unsigned int, bool) () from /opt/Ardour-7.4.0/lib/libardour.so.3
#5  0x00007ffff6fd398e in ARDOUR::LV2Plugin::latency_compute_run() () from /opt/Ardour-7.4.0/lib/libardour.so.3
#6  0x00007ffff6fd8244 in ARDOUR::LV2Plugin::LV2Plugin(ARDOUR::AudioEngine&, ARDOUR::Session&, void const*, long) () from /opt/Ardour-7.4.0/lib/libardour.so.3
#7  0x00007ffff6fd8408 in ARDOUR::LV2PluginInfo::load(ARDOUR::Session&) () from /opt/Ardour-7.4.0/lib/libardour.so.3
#8  0x0000555555f1c795 in ?? ()
#9  0x00007ffff325e868 in Glib::SignalProxyNormal::slot0_void_callback(_GObject*, void*) () from /opt/Ardour-7.4.0/lib/libglibmm-2.4.so.1
#10 0x00007ffff2e0f6b5 in g_closure_invoke () from /opt/Ardour-7.4.0/lib/libgobject-2.0.so.0
#11 0x00007ffff2e22593 in ?? () from /opt/Ardour-7.4.0/lib/libgobject-2.0.so.0
#12 0x00007ffff2e2c364 in g_signal_emit_valist () from /opt/Ardour-7.4.0/lib/libgobject-2.0.so.0
#13 0x00007ffff2e2c7e2 in g_signal_emit () from /opt/Ardour-7.4.0/lib/libgobject-2.0.so.0
#14 0x00007ffff1d0935e in gtk_widget_activate () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
#15 0x00007ffff1b9f882 in gtk_menu_shell_activate_item () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
#16 0x00007ffff1b9fcd6 in ?? () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
#17 0x00007ffff1b918d6 in ?? () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
#18 0x00007ffff1b85d8c in ?? () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
#19 0x00007ffff2e0f6b5 in g_closure_invoke () from /opt/Ardour-7.4.0/lib/libgobject-2.0.so.0
#20 0x00007ffff2e228bd in ?? () from /opt/Ardour-7.4.0/lib/libgobject-2.0.so.0
#21 0x00007ffff2e2bdc8 in g_signal_emit_valist () from /opt/Ardour-7.4.0/lib/libgobject-2.0.so.0
#22 0x00007ffff2e2c7e2 in g_signal_emit () from /opt/Ardour-7.4.0/lib/libgobject-2.0.so.0
#23 0x00007ffff1d0a7ac in ?? () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
#24 0x00007ffff1b8437d in gtk_propagate_event () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#25 0x00007ffff1b84803 in gtk_main_do_event () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
#26 0x00007ffff166fbbc in ?? () from /opt/Ardour-7.4.0/lib/libgdk-x11-2.0.so.0
#27 0x00007ffff2a56a87 in g_main_context_dispatch () from /opt/Ardour-7.4.0/lib/libglib-2.0.so.0
#28 0x00007ffff2a56ce8 in ?? () from /opt/Ardour-7.4.0/lib/libglib-2.0.so.0
#29 0x00007ffff2a57002 in g_main_loop_run () from /opt/Ardour-7.4.0/lib/libglib-2.0.so.0
#30 0x00007ffff1b834c7 in gtk_main () from /opt/Ardour-7.4.0/lib/libgtk-x11-2.0.so.0
#31 0x00007ffff4665215 in Gtkmm2ext::UI::run(Receiver&) () from /opt/Ardour-7.4.0/lib/libgtkmm2ext.so.0
#32 0x000055555589e9de in ?? ()
#33 0x00007fffe8e29d90 in __libc_start_call_main (main=main@entry=0x55555589e560, argc=argc@entry=1, argv=argv@entry=0x7fffffffd138) at ../sysdeps/nptl/libc_start_call_main.h:58
#34 0x00007fffe8e29e40 in __libc_start_main_impl (main=0x55555589e560, argc=1, argv=0x7fffffffd138, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd128) at ../csu/libc-start.c:392
#35 0x00005555558a679a in ?? ()
jatinchowdhury18 commented 1 year ago

Thanks for the crash report! Even though the stack trace is slightly different, I would guess that the root cause is the same as what we're seeing in #283. If you're building from source, you should be able to confirm this by modifying the ChowtapeModelAudioProcessor::isBusesLayoutSupported() implementation as in this comment.

More generally, the issue is that ChowTape is intended to support pretty much any channel configuration (so long as the input and output channel configurations are equivalent). Since the LV2 spec requires a "static" channel configuration, that kind of puts us in a tough spot: either we restrict the LV2 version to only support one channel configuration (probably stereo), or we ship like 6 instances of the LV2 plugin (mono, stereo, 5.1, 7.1, first-order ambisonic, second-order ambisonic, ...). Personally, I'd prefer to ship only one instance, just to help minimize the support burden.

Frankly, this is kind of issue is also a reason why I typically direct Linux users to prefer the CLAP format for our plugins (if their host supports it), or VST3, rather than LV2.

florijanstamenkovic commented 1 year ago

Hi, thanks for your response...

I installed it using the .deb package, which installs the LV2. I'm just too busy right now to build and test manually. Ardour doesn't seem to support CLAP (if I understand your nightly builds are in CLAP format), so that's a no-go.

I see your point about LV2 channels, and have seen plugins that come, clutterlignly, in many versions.

Makes sense to ship one instance. Not sure I see the point in shipping an LV2 version (by default, as a Linux download) that's not inline with LV2 specs (causing crashes), even if they're restrictive. So my vote would be: build LV2 to support only stereo (but can work as mono), or mono+stereo.

On Fri, Jun 16, 2023 at 6:02 PM jatinchowdhury18 @.***> wrote:

Thanks for the crash report! Even though the stack trace is slightly different, I would guess that the root cause is the same as what we're seeing in #283 https://github.com/jatinchowdhury18/AnalogTapeModel/issues/283. If you're building from source, you should be able to confirm this by modifying the ChowtapeModelAudioProcessor::isBusesLayoutSupported() implementation as in this comment https://github.com/jatinchowdhury18/AnalogTapeModel/issues/283#issuecomment-1383277308 .

More generally, the issue is that ChowTape is intended to support pretty much any channel configuration (so long as the input and output channel configurations are equivalent). Since the LV2 spec requires a "static" channel configuration, that kind of puts us in a tough spot: either we restrict the LV2 version to only support one channel configuration (probably stereo), or we ship like 6 instances of the LV2 plugin (mono, stereo, 5.1, 7.1, first-order ambisonic, second-order ambisonic, ...). Personally, I'd prefer to ship only one instance, just to help minimize the support burden.

Frankly, this is kind of issue is also a reason why I typically direct Linux users to prefer the CLAP format for our plugins (if their host supports it), or VST3, rather than LV2.

— Reply to this email directly, view it on GitHub https://github.com/jatinchowdhury18/AnalogTapeModel/issues/307#issuecomment-1594914992, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABY5GBAY32E5WOBA7GFNSJTXLR7P7ANCNFSM6AAAAAAZI6PYFY . You are receiving this because you authored the thread.Message ID: @.***>

florijanstamenkovic commented 1 year ago

(closing the issue as it's most likely a duplicate)