AudioOutputUnitStart crash on iOS 12 with JUCE 6.1.2 (DemoRunner example)

Hi,

When I try to run DemoRunner (JUCE 6.1.2) project on iPhone 6 (iOS 12.4) simulator, application crash (signal SIGABRT) when call AudioOutputUnitStart (audioUnit);

Callstack;

#0 0x000000011212492e in __pthread_kill ()
#1 0x00000001121a35bd in pthread_kill ()
#2 0x0000000111ee701d in abort ()
#3 0x000000010cf2b5e2 in _ReportRPCTimeout(char const*, int) ()
#4 0x000000010cb8918b in _CheckRPCError(char const*, int, int) ()
#5 0x000000010cb8e6a7 in AURemoteIO::Start() ()
#6 0x000000010cf403b5 in AUMethodStart(void*) ()
#7 0x00000001097ea0fb in juce::iOSAudioIODevice::Pimpl::open(juce::BigInteger const&, juce::BigInteger const&, double, int) at /Users/thiagoguimaraes/Projects/JUCE/modules/juce_audio_devices/native/juce_ios_Audio.cpp:475
#8 0x00000001097e9dc6 in juce::iOSAudioIODevice::open(juce::BigInteger const&, juce::BigInteger const&, double, int) at /Users/thiagoguimaraes/Projects/JUCE/modules/juce_audio_devices/native/juce_ios_Audio.cpp:1357

Dump;

2021-11-16 12:30:13.606609-0300 DemoRunner[7330:147091] [AudioHAL_Client] HALB_IOBufferManager.cpp:226:GetIOBuffer: HALB_IOBufferManager::GetIOBuffer: the stream index is out of range

2021-11-16 12:30:13.607500-0300 DemoRunner[7330:147091] [AudioHAL_Client] HALB_IOBufferManager.cpp:226:GetIOBuffer: HALB_IOBufferManager::GetIOBuffer: the stream index is out of range

2021-11-16 12:30:13.653811-0300 DemoRunner[7330:147091] [aqme] 254: AQDefaultDevice (1): output stream 0: null buffer

2021-11-16 12:30:13.663050-0300 DemoRunner[7330:147091] [aqme] 1640: EXCEPTION thrown (-50): -

2021-11-16 12:30:21.843937-0300 DemoRunner[7330:146848] RPCTimeout.mm:55:_ReportRPCTimeout: Start: Mach message timeout. Apparently deadlocked. Aborting now.

CoreSimulator 776.4 - Device: iPhone 6 (3EC4315C-DE56-40B9-A26F-5C6412765439) - Runtime: iOS 12.4 (16G73) - DeviceType: iPhone 6

I have the same problem with my app, when it’s running on iPhone 6. If anyone can help me, I appreciate it. I’m not sure which version of JUCE this problem started from.

Thanks for reporting, I’m able to reproduce the issue. I’m currently investigating, and I’ll update this thread once I know more.

It looks like I can successfully run the DemoRunner in the iPhone 6 (12.4) simulator on Xcode 12.4, macOS 10.15 (Intel). However, the exact same code crashes in the way you describe in the iPhone 6 (12.4) simulator on Xcode 13.1, macOS 12.0.1 (Arm). In addition the crash doesn’t seem to be consistent. I got it to work a couple of times on the macOS 12.0.1 machine, but I’m not sure what I did to allow it to work. It ran successfully just after I’d adjusted the audio I/O settings for the simulator, so perhaps that’s related. However, I carried on adjusting the audio settings after that, and the app crashed on all subsequent runs.

Apparently other people are seeing similar issues in non-JUCE code so I think there’s a reasonable chance this is a Simulator bug.

https://developer.apple.com/forums/thread/667921

https://developer.apple.com/forums/thread/651353

Thank you @reuk.

I believe that the same problem that happens in the simulator also happens in the device. But right now, I don’t have the device to be able to test it. When I can test directly on an iPhone 6 device, I’ll send information.

I downloaded the JUCE 6.0.8 version, opened the DemoRunner iOS project, using Xcode 13.1 and macOS Big Sur, I compiled and ran it in the iPhone 6 simulator and the problem happened the same way. I believed this bug could have started after JUCE 6.0.8, but now I’m not sure when this issue might have started.

It looks like I can successfully run the DemoRunner in the iPhone 6 (12.4) simulator on Xcode 12.4, macOS 10.15 (Intel). However, the exact same code crashes in the way you describe in the iPhone 6 (12.4) simulator on Xcode 13.1, macOS 12.0.1 (Arm).

As for the behavior you described, using different development environments; The released version of this application, when it was published on the Apple Store (around 3 months ago), was compiled and archived using Xcode 12.4 running on macOS Catalina 10.15.7 with JUCE 6.1.2.

I think the issue might depend on the Xcode/Simulator version. Are you able to download an older Xcode (11 or 12) and check whether your app runs correctly when running it on an older version of Simulator?

Asap, I’ll try with Xcode 12.3 and report to you the result.