[fixed] Linux crash when loading both VST2 and VST3

I’ve been trying to figure out what’s wrong with my Linux builds for days. One of the main problems I’m facing is loading multiple formats of the same plugin, or multiple plugins together. It crashes all the time. It looks like the culprit is a Label, but I’m not sure if there’s something else going on. This happens even with a plain plugin or GainPlugin.

Using CodeBlocks I was able to debug in Reaper, it stops in std: atomic base<int>:operator++ from juce::StringHolderUtils::retain

To recreate the issue, just load the same plugin, first VST2 and then VST3 (or vice versa, the order is not important). Or, load two different plugins.

We have tested this on both Reaper and Bitwig, in two Linux distros, Ubuntu (VM) and Manjaro.
Tested both JUCE 7 master and develop branches, and I’m pretty sure it was the same in JUCE 6.1.5.

I’ve uploaded the test I made just in case, but GainPlugin is also crashing.
This is just a plain plugin with a Label as a member of the Editor (not even used).
SimpleLinuxTest.zip (48.5 KB)

No crashes for me on openSUSE TW (gcc 12.2.1) and Reaper (using Makefile build).
Does it crash in AudioPluginHost for you? I assume that it might be a compiler bug, what if use clang (or bleeding edge gcc) for build?

Ok, so, apparently the issue is with a ton of exposed symbols. Building with cmake seems to be fine. If you want to build with Projucer instead, you need to add these flags:

-fvisibility=hidden
-fvisibility-inlines-hidden
-Wl,--no-undefined

I really think Projucer should add these flags by default…

Thanks @robbert-vdh for the help! I can now finally sleep :smiley:

Keep in mind that -Wl,--no-undefined is not part of the fix, but JUCE should probably still add it anyways since it will save a lot of dev time testing plugins and then trying to figure out why they immediately crash.

1 Like

I believe I’m hitting a similar issue, but on OSX in both VST3 and AU format. I’m compiling with clang so I used “-Wl,-undefined,error” instead of “-Wl,–no-undefined”, but it didn’t clearly make a difference. I have two plugins that both crash immediately in the plugin host. I have a third plugin with no sliders that doesn’t crash (since the slider is specificially in the stack trace).

Thread 0 Crashed:: JUCE Message Thread Dispatch queue: com.apple.main-thread
0   ???                           	    0x7ff895272a78 ???
1   libsystem_kernel.dylib        	    0x7ff804d847ce __pthread_kill + 10
2   libsystem_pthread.dylib       	    0x7ff804dbcf30 pthread_kill + 262
3   libsystem_c.dylib             	    0x7ff804cdba49 abort + 126
4   libsystem_malloc.dylib        	    0x7ff804be726a malloc_vreport + 885
5   libsystem_malloc.dylib        	    0x7ff804bea6ba malloc_report + 151
6   AudioPluginHost               	       0x100d5a1fa juce::StringHolderUtils::release(juce::StringHolder*) + 90
7   AudioPluginHost               	       0x100d0ea65 juce::StringHolderUtils::release(juce::CharPointer_UTF8) + 37
8   AudioPluginHost               	       0x100d0ea30 juce::String::~String() + 32
9   AudioPluginHost               	       0x100ce5e95 juce::String::~String() + 21
10  AudioPluginHost               	       0x100d5f23d juce::var::VariantType::stringCleanUp(juce::var::ValueUnion&) + 29
11  Constellation                 	       0x11ac4c813 juce::var::operator=(juce::var const&) + 29
12  Constellation                 	       0x11acd184c juce::SimpleValueSource::setValue(juce::var const&) + 46
13  Constellation                 	       0x11accb512 juce::Value::operator=(juce::var const&) + 30
14  Constellation                 	       0x11ad86e13 juce::Label::setText(juce::String const&, juce::NotificationType) + 101
15  Constellation                 	       0x11add9670 juce::Slider::Pimpl::lookAndFeelChanged(juce::LookAndFeel&) + 324
16  Constellation                 	       0x11add8839 juce::Slider::init(juce::Slider::SliderStyle, juce::Slider::TextEntryBoxPosition) + 145
17  Constellation                 	       0x11add8666 juce::Slider::Slider() + 196
18  Constellation                 	       0x11aab0a5d SimpleMappingPanel::SimpleMappingPanel() + 77
19  Constellation                 	       0x11aaae955 MappingEditor::MappingEditor() + 629
20  Constellation                 	       0x11aa5e47d ConstellationAudioProcessorEditor::ConstellationAudioProcessorEditor(ConstellationAudioProcessor&) + 269
21  Constellation                 	       0x11aa62d52 ConstellationAudioProcessor::createEditor() + 34
22  Constellation                 	       0x11abfd8bc juce::AudioProcessor::createEditorIfNeeded() + 80
23  Constellation                 	       0x11af195a1 juce::JuceVST3EditController::JuceVST3Editor::ContentWrapperComponent::createEditor(juce::AudioProcessor&) + 25
24  Constellation                 	       0x11af1869c juce::JuceVST3EditController::JuceVST3Editor::JuceVST3Editor(juce::JuceVST3EditController&, juce::JuceAudioProcessor&) + 172
25  Constellation                 	       0x11af16d6c juce::JuceVST3EditController::createView(char const*) + 160
26  AudioPluginHost               	       0x100761d2c juce::VST3PluginInstance::tryCreatingView() const + 60
27  AudioPluginHost               	       0x10074ece5 juce::VST3PluginInstance::hasEditor() const + 53
28  AudioPluginHost               	       0x1005bcbf5 PluginGraph::getOrCreateWindowFor(juce::AudioProcessorGraph::Node*, PluginWindow::Type) + 341
29  AudioPluginHost               	       0x1005d4baf GraphEditorPanel::PluginComponent::mouseUp(juce::MouseEvent const&) + 303
30  AudioPluginHost               	       0x1009347ab juce::Component::internalMouseUp(juce::MouseInputSource, juce::detail::PointerState const&, juce::Time, juce::ModifierKeys) + 571
31  AudioPluginHost               	       0x100a17db8 juce::detail::MouseInputSourceImpl::sendMouseUp(juce::Component&, juce::detail::PointerState const&, juce::Time, juce::ModifierKeys) + 184
32  AudioPluginHost               	       0x100a17a4e juce::detail::MouseInputSourceImpl::setButtons(juce::detail::PointerState const&, juce::Time, juce::ModifierKeys) + 414
33  AudioPluginHost               	       0x1009b1cf2 juce::detail::MouseInputSourceImpl::handleEvent(juce::ComponentPeer&, juce::Point<float>, juce::Time, juce::ModifierKeys, float, float, juce::PenDetails) + 514
34  AudioPluginHost               	       0x1009b1add juce::MouseInputSource::handleEvent(juce::ComponentPeer&, juce::Point<float>, long long, juce::ModifierKeys, float, float, juce::PenDetails const&) + 173
35  AudioPluginHost               	       0x100917f6c juce::ComponentPeer::handleMouseEvent(juce::MouseInputSource::InputSourceType, juce::Point<float>, juce::ModifierKeys, float, float, long long, juce::PenDetails, int) + 204
36  AudioPluginHost               	       0x100a0244b juce::NSViewComponentPeer::sendMouseEvent(NSEvent*) + 171
37  AudioPluginHost               	       0x100a032a8 juce::NSViewComponentPeer::redirectMouseUp(NSEvent*) + 88
38  AudioPluginHost               	       0x100a018c9 void juce::JuceNSViewClass::callOnOwner<void (juce::NSViewComponentPeer::*)(NSEvent*), NSEvent*&>(objc_object*, void (juce::NSViewComponentPeer::*&&)(NSEvent*), NSEvent*&) + 137
39  AudioPluginHost               	       0x1009fb508 juce::JuceNSViewClass::asyncMouseUp(objc_object*, objc_selector*, NSEvent*) + 56
40  AudioPluginHost               	       0x1009fb5b7 juce::JuceNSViewClass::mouseUp(objc_object*, objc_selector*, NSEvent*) + 55
41  AppKit                        	    0x7ff809094ac2 _routeMouseUpEvent + 138
42  AppKit                        	    0x7ff808566fde -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 424
43  AppKit                        	    0x7ff808566c1b -[NSWindow(NSEventRouting) sendEvent:] + 345
44  AppKit                        	    0x7ff808cf95f6 -[NSApplication(NSEventRouting) sendEvent:] + 346
45  AppKit                        	    0x7ff8088ba0df -[NSApplication _handleEvent:] + 65
46  AppKit                        	    0x7ff8083f8e1f -[NSApplication run] + 640
47  AudioPluginHost               	       0x100cc6c5c juce::MessageManager::runDispatchLoop() + 76
48  AudioPluginHost               	       0x100cc6b8e juce::JUCEApplicationBase::main() + 222
49  AudioPluginHost               	       0x100cc6a4c juce::JUCEApplicationBase::main(int, char const**) + 60
50  AudioPluginHost               	       0x1004dce33 main + 51
51  dyld                          	       0x202ba93a6 start + 1942

If I turn the sliders off, it runs without error, BTW.

Are you using the Projucer or CMake to build?

This bit of the stack trace looks suspicious to me:

10  AudioPluginHost               	       0x100d5f23d juce::var::VariantType::stringCleanUp(juce::var::ValueUnion&) + 29
11  Constellation                 	       0x11ac4c813 juce::var::operator=(juce::var const&) + 29

The plug-in is calling back into the AudioPluginHost from var::operator=. This shouldn’t normally happen, so I wonder whether you’re accidentally building without hidden symbol visibility. This should normally be set up for you by the build system.

I build my plugin with bazel and I use CMake on the AudioPluginHost. Both on the same version of JUCE, though considering the nature of the plugin host I don’t believe using the same build system or JUCE version is expected.

I do build my plugin with this flag, I believe I got that from one of JUCE’s makefiles ages ago:
-fvisibility-inlines-hidden

I added “-fvisibility=hidden”, and it fixes it. I probably removed that by mistake, I’ve been messing with my build files recently.

But seriously. How did you know that? HOW CAN I BUY YOU A BEER?