AudioProcessorValueTreeState Illegal instruction

When testing the plugin we was getting an Illegal instruction problem. I simplified the code in parts, only AudioProcessorValueTreeState remained. Created a new plugin using the template GitHub - Logsod/TheSynth
But we still cannot rule out the problem “pluginval received Illegal instruction: 4, exiting immediately” Entire test log TheSynth/Source/plugval.txt at main · Logsod/TheSynth · GitHub
On Windows everything works fine but on Mac (Monterey 12.7.1) OS I get this error every time. What’s wrong here, can someone help?

Note the build instructions tell you to set -D CMAKE_OSX_DEPLOYMENT_TARGET=10.13 when you run cmake. Make sure the version number is appropriate for the device/environment you’re testing on.

It’s also helpful to add target_compile_options(<target name> PUBLIC "-Wall -Werror") in the CMakeLists.txt to make sure you’re not doing something subtle like forgetting a return statement in a non-void function (which can cause this exact error message).

Running this with Address Sanitizer might help. It sounds like something is getting clobbered and you’re jumping off into a random memory address or you’ve forgotten a return statement as @holy-city suggested.

Thanks for answers.
Just to check, I downloaded the projucer
juce-6.0.0-osx.zip compile AudioPluginExample, pass 2500 tests
juce-7.0.0-osx.zip compile AudioPluginExample, pass ~300-500 tests and crash
if I validate in process, then I see the log when the application crashes.
Maybe the problem is not in the plugin at all but in plugval?

full log here

Thread 0 Crashed:: JUCE Message Thread Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x7ff817962efc _os_unfair_lock_unowned_abort + 23
1 libsystem_platform.dylib 0x7ff81795d33f _os_unfair_lock_unlock_slow + 66
2 libsystem_pthread.dylib 0x7ff81794543a _pthread_cond_check_init_slow + 207
3 libsystem_pthread.dylib 0x7ff8179450a0 pthread_cond_broadcast + 94
4 libc++.1.dylib 0x7ff8178a7d05 std::__1::condition_variable::notify_all() + 9
5 pluginval 0x10bf90ab7 juce::WaitableEvent::signal() const + 39
6 pluginval 0x10c012e2e juce::MessageManager::lock::BlockingMessage::messageCallback() + 62
7 pluginval 0x10c0176e4 juce::MessageQueue::deliverNextMessage() + 52
8 pluginval 0x10c017682 juce::MessageQueue::runLoopCallback() + 50
9 CoreFoundation 0x7ff817a100ab CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
10 CoreFoundation 0x7ff817a10013 __CFRunLoopDoSource0 + 180
11 CoreFoundation 0x7ff817a0fdef __CFRunLoopDoSources0 + 340
12 CoreFoundation 0x7ff817a0e7a8 __CFRunLoopRun + 892
13 CoreFoundation 0x7ff817a0dd6c CFRunLoopRunSpecific + 562
14 HIToolbox 0x7ff8206bb5e6 RunCurrentEventLoopInMode + 292
15 HIToolbox 0x7ff8206bb34a ReceiveNextEventCommon + 594
16 HIToolbox 0x7ff8206bb0e5 _BlockUntilNextEventMatchingListInModeWithFilter + 70
17 AppKit 0x7ff81a448f6d _DPSNextEvent + 927
18 AppKit 0x7ff81a44762a -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1394
19 AppKit 0x7ff81a439cd9 -[NSApplication run] + 586
20 pluginval 0x10c00b0d4 juce::JUCEApplicationBase::main() + 164
21 pluginval 0x10c00afe3 juce::JUCEApplicationBase::main(int, char const**) + 83
22 dyld 0x1185ad52e start + 462

Can you create a minimal viable project/pip that demonstrates the crash, please.

hi Oli

cmake -B Build -G Xcode -D CMAKE_OSX_ARCHITECTURES=arm64;x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=10.13

Apple clang version 14.0.0 (clang-1400.0.29.102)
cmake version 3.27.9
sw_vers
ProductName: macOS
ProductVersion: 12.7.1
BuildVersion: 21G920

and crash

I’m sure that something is going wrong and the problem is not in the juce
but I’ve run out of ideas on what else to try, it looks like magnetic storms in the sun.

I was able to replicate the crash with your repo. I will do some investigating.

1 Like

I also checked on Windows
simplified version 2500 tests pass
and full plugin also pass
it seems like problem only on mac