fix: App Hanging on macOS
Description
Hi, this is almost certainly out of our reach but I decided to file it anyway just in case we see more of these and it turns out to be, in some way, connected to flutter_soloud.
Here's a StackTrace from the wild (using Sentry) that looks like either a mutex lock race condition in CoreAudio (macOS), or simply something taking very long (2 seconds).
libsystem_kernel 0x18ed599c8 __psynch_mutexwait
libsystem_pthread 0x18ed96e38 _pthread_mutex_firstfit_lock_wait
libsystem_pthread 0x18ed94864 _pthread_mutex_firstfit_lock_slow
libsystem_pthread 0x18ed9a164 _pthread_cond_wait
CoreAudio 0x1924a1af0 HALB_Guard::WaitFor
CoreAudio 0x192222ad4 HALB_IOThread::_WaitForState
CoreAudio 0x192222e90 HALB_IOThread::StartAndWaitForState
CoreAudio 0x192095d74 HALC_ProxyIOContext::_StartIO
CoreAudio 0x192095950 HALC_ProxyIOContext::StartIOProc
CoreAudio 0x192050ee4 HAL_HardwarePlugIn_DeviceStart
CoreAudio 0x1921295dc AudioDeviceStart_mac_imp
CoreAudio 0x11c5aade0 <redacted>
CoreAudio 0x11c5aabc4 <redacted>
CoreAudio 0x11c6b7030 <redacted>
AudioToolboxCore 0x191b800b4 AudioOutputUnitStart
flutter_soloud 0x1009645ec <redacted>
flutter_soloud 0x100914994 <redacted>
flutter_soloud 0x10096c0b0 <redacted>
flutter_soloud 0x10096be98 <redacted>
flutter_soloud 0x10091ae10 <redacted>
App 0x111ae1948 <redacted>
App 0x111ff33c4 <redacted>
App 0x111ff3288 <redacted>
App 0x111ff2e1c <redacted>
App 0x111fef0f4 <redacted>
App 0x111b0e59c <redacted>
App 0x111b0e434 <redacted>
App 0x111af441c <redacted>
App 0x111af40cc <redacted>
App 0x111fef4c0 <redacted>
App 0x111b15db4 <redacted>
App 0x111fef0f4 <redacted>
App 0x111ff00fc <redacted>
App 0x111af3ec0 <redacted>
App 0x111af3dbc <redacted>
App 0x111af3d80 <redacted>
App 0x111ae3f2c <redacted>
FlutterMacOS 0x102ebe070 <redacted>
FlutterMacOS 0x102ebe680 <redacted>
FlutterMacOS 0x10302ebdc <redacted>
FlutterMacOS 0x102d9c790 <redacted>
FlutterMacOS 0x102d5bef4 <redacted>
FlutterMacOS 0x102e72874 <redacted>
FlutterMacOS 0x102e657b0 <redacted>
FlutterMacOS 0x10259680c <redacted>
FlutterMacOS 0x1025f0508 <redacted>
FlutterMacOS 0x1025ef568 <redacted>
FlutterMacOS 0x1025ef1bc <redacted>
FlutterMacOS 0x1025ef5b0 <redacted>
CoreFoundation 0x18ee389e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
CoreFoundation 0x18ee38978 __CFRunLoopDoSource0
CoreFoundation 0x18ee386e4 __CFRunLoopDoSources0
CoreFoundation 0x18ee37374 __CFRunLoopRun
CoreFoundation 0x18eef1358 _CFRunLoopRunSpecificWithOptions
HIToolbox 0x19b892764 RunCurrentEventLoopInMode
HIToolbox 0x19b895a8c ReceiveNextEventCommon
HIToolbox 0x19ba1f304 _BlockUntilNextEventMatchingListInMode
AppKit 0x19371cd4c _DPSBlockUntilNextEventMatchingListInMode
AppKit 0x19322be30 _DPSNextEvent
AppKit 0x193bc9744 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
AppKit 0x193bc9450 -[NSApplication(NSEventRouting) nextEventMatchingMask:untilDate:inMode:dequeue:]
AppKit 0x19322477c -[NSApplication run]
AppKit 0x1932106d8 NSApplicationMain
giant_robot 0x1000f1e40 <redacted>
0x18e9d1d54 <redacted>
I am not able to reproduce this.
Additional Context
# App Hanging: App hanging for at least 2000 ms.
**Issue ID:** 6962856949
**Project:** giant_robot
**Date:** 10/21/2025, 2:13:11 PM
## Tags
- **device:** Mac15,6
- **device.family:** macOS
- **dist:** 91
- **environment:** production
- **event.environment:** native
- **event.origin:** mac
- **level:** error
- **mechanism:** AppHang
- **os:** macOS 26.1.0
- **os.build:** 25B5062e
- **os.name:** macOS
- **os.rooted:** no
- **release:** [email protected]+91+Noa
## Exception
### Exception 1
**Type:** App Hanging
**Value:** App hanging for at least 2000 ms.
- Darwin Kernel Version 25.1.0: Sun Oct 5 21:07:37 PDT 2025; root:xnu-12377.40.120~10/RELEASE_ARM64_T6030
- arm64
- memory 18.0 GB
Oh wow, that's weird :)
I could only make a few guesses.
It seems that AudioOutputUnitStart is trying to start initializing the output device, waiting for CoreAudio permission. But the permission isn't coming. Maybe the audio device is locked by some other apps?
Can't tell... Let's leave this issue open for a while and see if anyone else has any clues.