AUGraph.start crashes on iOS 14 Beta

Hi,

we are using Audio Graph in our app. When compiled in iOS 14 and run in iOS simulator, the app always crashed when trying to start Audio Graph. I have those lines in logs:

Code Block text
[augraph] 2885: DoMakeDisconnection failed with error -10860
[aurioc] 323: Unable to join I/O thread to workgroup ((null)): 2
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
[aqme] 255: AQDefaultDevice (1): output stream 0: null buffer
[aqme] 1778: EXCEPTION thrown (-50): error != 0
Start: Mach message timeout. Apparently deadlocked. Aborting now.


We’re seeing the exact same issue, minus the logs from augraph and aurioc:

Code Block plain
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
[aqme] 255: AQDefaultDevice (1): output stream 0: null buffer
[aqme] 1778: EXCEPTION thrown (-50): error != 0
Start: Mach message timeout. Apparently deadlocked. Aborting now.
CoreSimulator 725.10.3 - Device: iPad Pro (12.9-inch) (4th generation) - Runtime: iOS 14.0 (18A5301v) - DeviceType: iPad Pro (12.9-inch) (4th generation)


Thanks for raising this issue. Could you please file a bug report?
Submitted FB7761200:

Initializing audio I/O using Xcode 12.0 beta (12A6159) on the iOS Simulator results the app crashing with the following console logs:

HALBIOBufferManagerClient::GetIOBuffer: the stream index is out of range
HALBIOBufferManagerClient::GetIOBuffer: the stream index is out of range
[aqme] 255: AQDefaultDevice (1): output stream 0: null buffer
[aqme] 1778: EXCEPTION thrown (-50): error != 0
Initialize: Mach message timeout. Apparently deadlocked. Aborting now.

This can be easily reproduced e.g. with the "AUV3Filter iOS" app that is part of this sample project:
https://developer.apple.com/documentation/audiotoolbox/audio_unit_v3_plug-ins/creating_custom_audio_effects

Steps to reproduce:
Launch app

Expected results:
App launches

Actual results:
App crashes in AURemoteIO::Initialize()

Backtrace:

Code Block plain
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x000000010515f33a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00000001051bce60 libsystem_pthread.dylib`pthread_kill + 430
frame #2: 0x0000000104eb7c24 libsystem_c.dylib`abort + 120
frame #3: 0x00000001087655c9 AudioToolboxCore`_ReportRPCTimeout(char const*, int) + 90
frame #4: 0x0000000126a08bd9 libEmbeddedSystemAUs.dylib`_CheckRPCError(char const*, int, int) + 92
frame #5: 0x0000000126a054e0 libEmbeddedSystemAUs.dylib`AURemoteIO::Initialize() + 1878
frame #6: 0x0000000126a1eec6 libEmbeddedSystemAUs.dylib`AUBase::DoInitialize() + 36
frame #7: 0x00000001269a547f libEmbeddedSystemAUs.dylib`AUMethodInitialize(void*) + 59
frame #8: 0x000000010885a1bb AudioToolboxCore`-[AUAudioUnitV2Bridge allocateRenderResourcesAndReturnError:] + 77
frame #9: 0x00000001064c5dbf AVFAudio`AUInterfaceBaseV3::Initialize() + 45
frame #10: 0x0000000106469ef9 AVFAudio`AUGraphNodeBase::Initialize() + 29
frame #11: 0x00000001064478a1 AVFAudio`AVAudioEngineGraph::PerformCommand(AUGraphNodeBaseV3&, AVAudioEngineGraph::ENodeCommand, void*, unsigned int) const + 365
frame #12: 0x000000010644f63e AVFAudio`AVAudioEngineGraph::Initialize(NSError) + 1642
frame #13: 0x00000001064c422f AVFAudio`AVAudioEngineImpl::Initialize(NSError) + 201
frame #14: 0x00000001064bf36e AVFAudio`-[AVAudioEngine prepare] + 66
* frame #15: 0x0000000101582aaf AUv3FilterFramework`SimplePlayEngine.init(self=0x0000600002a540c0) at SimplePlayEngine.swift:59:16
...

Thank you! We are working on getting a fix for this ASAP.
If it helps I'd like to note that this occurs:

In Xcode 11 or below and macOS 11
In Xcode 12 and macOS 10 or below

I don't have crash logs but have one system running Big Sur and one running Catalina, and see opposite behavior depending on which version of Xcode I use.


We are also experiencing this similar crash when running the simulator from Xcode 12 beta 3. We had a similar issue with Beta 1, but it was resolved with Beta 2 and now we are seeing this with beta 3.

Code Block
* frame #0: 0x000000010a07133a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x000000010a0cee60 libsystem_pthread.dylib`pthread_kill + 430
frame #2: 0x0000000109dc7c54 libsystem_c.dylib`abort + 120
frame #3: 0x000000010e4ff8c9 AudioToolboxCore`_ReportRPCTimeout(char const*, int) + 90
frame #4: 0x00000001311bbff5 libEmbeddedSystemAUs.dylib`_CheckRPCError(char const*, int, int) + 92
frame #5: 0x00000001311b88fc libEmbeddedSystemAUs.dylib`AURemoteIO::Initialize() + 1878
frame #6: 0x00000001311d234a libEmbeddedSystemAUs.dylib`AUBase::DoInitialize() + 36
frame #7: 0x000000013115888b libEmbeddedSystemAUs.dylib`AUMethodInitialize(void*) + 59
frame #8: 0x0000000123831d81 <redacted>`webrtc::VoiceProcessingAudioUnit::Initialize(double) + 789


This is happening on Catalina 10.15.6 with Xcode Beta 3. The simulator is as follows:

CoreSimulator 732.7 - Device: iPhone 11 Pro (6EC8D05E-BCD2-424F-B321-4DFA2D4FE93B) - Runtime: iOS 14.0 (18A5332e) - DeviceType: iPhone 11 Pro

Submitted FB8192296
This is still an issue as of Xcode 12 Beta 4.
Same issue for me.

AUGraphStop crash on iOS 14 Beta.
Xcode 11.3 (Crash)
Xcode 12.0 beta 4(12A8179i) Crash 

Not able to test on older Xcode version as they are not supporting Beta iOS 14.0.

Code Block Objective-C STKAudioPlayer
-(void) stopAudioUnitWithReason:(STKAudioPlayerStopReason)stopReasonIn
{
OSStatus status;
if (!audioGraph)
    {
        stopReason = stopReasonIn;
        self.internalState = STKAudioPlayerInternalStateStopped;
        return;
    }
    Boolean isRunning;
    status = AUGraphIsRunning(audioGraph, &isRunning);
    if (status)
    {
        [self unexpectedError:STKAudioPlayerErrorAudioSystemError];
    }else if (!isRunning)     {
        stopReason = stopReasonIn;
        self.internalState = STKAudioPlayerInternalStateStopped;
        return;
    }
    status = AUGraphStop(audioGraph); Here is the Crash
    if (status) {
        [self unexpectedError:STKAudioPlayerErrorAudioSystemError];
    }
    [self resetPcmBuffers];
    stopReason = stopReasonIn;
    self.internalState = STKAudioPlayerInternalStateStopped;
}


I just got around to running the integration tests that were experiencing this issue with Xcode 12 beta 5 and am no longer seeing this issue. My Feedback (FB8192296) was marked as having more than 10 reports and the "Potential fix identified - For a future OS update" resolution but has not been marked whether this is the release that fixes it.

Can we get some confirmation from  as to whether this is indeed fixed?
I am Also seeing the same issue on 11.0.1 issue was not seen on Catalina. seems like Big Sur is a Big Mess,
AUGraph.start crashes on iOS 14 Beta
 
 
Q