Weird AU plugin crash

Hi,
I’m seeing this strange crash in the AU version on my synth plugin. I’m on BigSur with an intel Macbook Pro and I’m using JUCE v7.0.7.
It crashes in both AudioPluginHost and Logic Pro X. In the first it gets through the first processBlock call - which does nothing but clearing the buffer - and then crashes. In Logic it crashes as soon as I record enable the track.
The thread crashing is the com.apple.audio.IOThread.client - the same that just went through processBlock. This is the stack trace:

_os_object_retain 0x00007fff206b79be
RenderContextChangeGenerator::checkChange() 0x00007fff21c3d305
AudioUnitRender 0x00007fff21dfbeff
juce::AudioUnitPluginInstance::processAudio(juce::AudioBuffer<float>&, juce::MidiBuffer&, bool) 0x000000010961d7d6
juce::GraphRenderSequence<float>::NodeOp::process(juce::GraphRenderSequence<float>::Context const&) 0x00000001095db386
juce::GraphRenderSequence<float>::perform(juce::AudioBuffer<float>&, juce::MidiBuffer&, juce::AudioPlayHead*) 0x00000001095deeac
juce::AudioProcessorPlayer::audioDeviceIOCallbackWithContext(float const* const*, int, float* const*, int, int, juce::AudioIODeviceCallbackContext const&) 0x000000010959f056
juce::AudioDeviceManager::CallbackHandler::audioDeviceIOCallbackWithContext(float const* const*, int, float* const*, int, int, juce::AudioIODeviceCallbackContext const&) 0x00000001098c7e1f
juce::CoreAudioClasses::CoreAudioInternal::audioIOProc(unsigned int, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*) 0x00000001098c2f27
invocation function for block in HALC_ProxyIOContext::HALC_ProxyIOContext(unsigned int, unsigned int) 0x00007fff221dea8c
HALB_IOThread::Entry(void*) 0x00007fff22379b04
_pthread_start 0x00007fff208628fc
thread_start 0x00007fff2085e443

And this is the instructions leading up to the crash on ud2

_os_object_retain:
	movq   %rdi, %rax               
	movl   0xc(%rdi), %ecx          
	cmpl   $0x7fffffff, %ecx          ; imm = 0x7FFFFFFF
	je     0x7fff201639af             ; <+20>
	lock                            
	incl   0xc(%rax)                
	jle    0x7fff201639b0             ; <+21>
	retq                            
	leaq   0x347ce(%rip), %rcx        ; "API MISUSE: Resurrection of an object"
	movq   %rcx, 0x604d1dca(%rip)     ; gCRAnnotations + 8
-->	ud2                              

So one clue is that “API MISUSE: Resurrection of an object”, but I don’t know what it means and my google search didn’t get me anywhere.

It’s not a small project and there’s plenty of places things could go wrong.
So before I start just commenting out big chunks of code to narrow the scope: has anyone else been here before or have any tips on how to debug this? :slight_smile:

Wait, if I shift to the master branch of JUCE, everything’s fine.
I was on the tip of develop before.
If this a juce bug, I’m not sure when it was introduced - I think it’s been a couple of weeks since I built the plugin last.

Have you updated your PluginHost? I saw that when using an older build earlier today with the develop tip from this morning.

Rail

Yes, first I was using an older build of AudioPluginHost, but during investigating this, I built a fresh one from the master branch. Still crashed the same way.

Maybe related to the new audio workgroup thing ?

Yes. The crash in Logic was related to an audioIO thread but I reverted to an older version of Juce and then back to the develop tip and reexported the project and it seemed to fix itself.

Rail

I’m seeing the same crash with my plugin in Waveform and the ae805ffe3fb03de9c959cd62b0ad3c2903ee7dac Sept 13th version of juce.

Thread 17 Crashed:: com.apple.audio.IOThread.client
0   libdispatch.dylib             	       0x1a7fdae24 _os_object_retain + 64
1   AudioToolboxCore              	       0x1a9e11c8c RenderContextChangeGenerator::checkChange() + 28
2   AudioToolboxCore              	       0x1a9ff958c AudioUnitRender + 692
3   Waveform 12 (64-bit)          	       0x103b5d790 juce::AudioUnitPluginInstance::processAudio(juce::AudioBuffer<float>&, juce::MidiBuffer&, bool) + 1292 (juce_AudioUnitPluginFormat.mm:1432)
4   Waveform 12 (64-bit)          	       0x1039e7bd0 juce::AudioUnitPluginInstance::processBlock(juce::AudioBuffer<float>&, juce::MidiBuffer&) + 48 (juce_AudioUnitPluginFormat.mm:1454)
5   Waveform 12 (64-bit)          	       0x104e56310 tracktion::engine::ExternalPlugin::processPluginBlock(tracktion::engine::PluginRenderContext const&, bool) + 284 (tracktion_ExternalPlugin.cpp:1421)
6   Waveform 12 (64-bit)          	       0x104e55c40 tracktion::engine::ExternalPlugin::applyToBuffer(tracktion::engine::PluginRenderContext const&) + 720 (tracktion_ExternalPlugin.cpp:1329)
7   Waveform 12 (64-bit)          	       0x104e40470 tracktion::engine::Plugin::applyToBufferWithAutomation(tracktion::engine::PluginRenderContext const&) + 672 (tracktion_Plugin.cpp:699)
8   Waveform 12 (64-bit)          	       0x104bb7a94 tracktion::engine::PluginNode::process(tracktion::graph::Node::ProcessContext&) + 1760 (tracktion_PluginNode.cpp:207)
9   Waveform 12 (64-bit)          	       0x104ba44b0 tracktion::graph::Node::process(unsigned int, juce::Range<long long>) + 1112 (tracktion_Node.h:533)

I’m not able to git bisect to see where the crash is, since there appears to be two different AU crashes in develop and bisect gets confused.

Easy to reproduce, build this plugin from this commit and run in juce host and it crashes. Version 0.0.9 · FigBug/Wavetable@1db12a2 · GitHub

@railjonrogut Can you elaborate on the steps taken ?
I am trying to solve the exact same crash, I was on Juce master , switched to develop this morning, and encountered this crash.

I believe this is the same crash as:

1 Like

Thanks @eyalamir :pray: you are correct that is the same crash.

Thanks all for being so patient. This should now be fixed on the latest tip of develop.

3 Likes

Thanks for the fix.