AUv3 Auido Units can crash / freeze host

Number:rdar://FB7741306 Date Originated:18 June 2020
Status:Open Resolved:
Product:CoreAudio / macOS Product Version:10.15
Classification:crash Reproducible:always
Since AUv3 Audio Units run in a separate process, one would think that crashes of the AudioUnit can be handled gracefully by the host. This appears not to be the case due to a bug in CoreAudio which causes the renderBlock to never return if the Audio Unit crashes. You can reproduce this with the  CreatingCustomAudioEffects (AUv3Filter) and IncorporatingAudioEffectsAndInstruments (AUv3Host) sample codes: 
- Build and install the sample Audio Unit.
- Launch the sample host and select AUv3FilterDemo in the list of effects
- Click "Play" in the host
- Open "Activity Monitor" and use it to force-quit the process called "AUv3FilterExtension (AUv3Host)" to simulate a crash of the plug-in.
As soon as one then tries to change Audio Unit, this freezes the host. The reason is that [AVAudioEngine disconnectNodeInput:] gets deadlocked as it waits for the renderBlock to return, which never happens. 

What I don't understand is that the notification kAudioComponentInstanceInvalidationNotification is precisely designed to give the host the opportunity to handle a crash gracefully. The fact that renderBlock blocks indefinitely and causes deadlocks for any subsequent call to the AudioUnit makes this impossible since one is forced to choose between a memory leak and a deadlock.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!