Crashed: AURemoteIO::IOThread EXC_BAD_ACCESS KERN_INVALID_ADDRESS

Hello! I just got a crash report from Firebase with the following stack trace. I honestly have no idea what could be causing the issue and I was hoping someone might be able to point me in the right direction.


The following line in the Main Thread Stack Trace seems like the most likely candidate:

8  TrainCentric                   0x104d85ca0 specialized MySound.init(url:category:) + 40 (Sound.swift:40)

But line 40 of Sound.swift only allocates an AVAudioFile.

try self.audioFile = AVAudioFile.init(forReading: fileURL.absoluteURL)

I'm quite certain the file exists, and even if it didn't, I tested to see if I could get a similar stack by trying to load an invalid URL and the app did not crash because of the enclosing try statement for this line of code.


OS Version: 13.3.1 (17D50)

Phone: iPhone 6s


Crashing Thread Stack Trace

Crashed: AURemoteIO::IOThread
0  libsystem_pthread.dylib         0x18c3e7f7c pthread_mutex_trylock$VARIANT$mp + 174
1  libc++.1.dylib                  0x18c54c4d4 std::__1::mutex::try_lock() + 12
2  AVFAudio                        0x19920abac invocation function for block in AUGraphNodeBaseV3::AllocateInputBlock() + 88
3  libEmbeddedSystemAUs.dylib      0x1aa234178 AUMultiChannelMixer::MixerCore::RenderInput(unsigned int, AudioTimeStamp const&, unsigned int) + 452
4  libEmbeddedSystemAUs.dylib      0x1aa233264 AUMultiChannelMixer::MixerCore::Mix(InputRenderOrderInfo const*, int, AudioTimeStamp const&, unsigned int) + 1204
5  libEmbeddedSystemAUs.dylib      0x1aa232844 AUMultiChannelMixer::MixerCore::MasterMix(AudioTimeStamp const&, unsigned int) + 2124
6  libEmbeddedSystemAUs.dylib      0x1aa230908 AUMultiChannelMixer::Render(unsigned int&, AudioTimeStamp const&, unsigned int) + 912
7  libEmbeddedSystemAUs.dylib      0x1aa2bcc5c AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 1524
8  libEmbeddedSystemAUs.dylib      0x1aa2400fc AUMethodRender(void*, unsigned int*, AudioTimeStamp const*, unsigned int, unsigned int, AudioBufferList*) + 44
9  AudioToolboxCore                0x1996e30d8 __26-[AUAudioUnit renderBlock]_block_invoke + 200
10 AVFAudio                        0x19920ac68 invocation function for block in AUGraphNodeBaseV3::AllocateInputBlock() + 276
11 libEmbeddedSystemAUs.dylib      0x1aa234178 AUMultiChannelMixer::MixerCore::RenderInput(unsigned int, AudioTimeStamp const&, unsigned int) + 452
12 libEmbeddedSystemAUs.dylib      0x1aa2332d0 AUMultiChannelMixer::MixerCore::Mix(InputRenderOrderInfo const*, int, AudioTimeStamp const&, unsigned int) + 1312
13 libEmbeddedSystemAUs.dylib      0x1aa2322f4 AUMultiChannelMixer::MixerCore::MasterMix(AudioTimeStamp const&, unsigned int) + 764
14 libEmbeddedSystemAUs.dylib      0x1aa230908 AUMultiChannelMixer::Render(unsigned int&, AudioTimeStamp const&, unsigned int) + 912
15 libEmbeddedSystemAUs.dylib      0x1aa2bcc5c AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 1524
16 libEmbeddedSystemAUs.dylib      0x1aa2400fc AUMethodRender(void*, unsigned int*, AudioTimeStamp const*, unsigned int, unsigned int, AudioBufferList*) + 44
17 AudioToolboxCore                0x1996e30d8 __26-[AUAudioUnit renderBlock]_block_invoke + 200
18 AVFAudio                        0x19920ac68 invocation function for block in AUGraphNodeBaseV3::AllocateInputBlock() + 276
19 libEmbeddedSystemAUs.dylib      0x1aa23e5e4 AUInputElement::PullInput(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 176
20 libEmbeddedSystemAUs.dylib      0x1aa2286b0 AUInputFormatConverter2::InputProc(OpaqueAudioConverter*, unsigned int*, AudioBufferList*, AudioStreamPacketDescription**, void*) + 156
21 AudioToolboxCore                0x199628bac AudioConverterChain::CallInputProc(unsigned int) + 436
22 AudioToolboxCore                0x19962a51c AudioConverterChain::FillBufferFromInputProc(unsigned int*, CABufferList*) + 256
23 AudioToolboxCore                0x19960c750 BufferedAudioConverter::GetInputBytes(unsigned int, unsigned int&, CABufferList const*&) + 192
24 AudioToolboxCore                0x199790834 CBRConverter::RenderOutput(CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 112
25 AudioToolboxCore                0x19960c4c4 BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 388
26 AudioToolboxCore                0x19962899c AudioConverterChain::RenderOutput(CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 120
27 AudioToolboxCore                0x19960c4c4 BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 388
28 AudioToolboxCore                0x1996b4b70 AudioConverterFillComplexBuffer + 340
29 libEmbeddedSystemAUs.dylib      0x1aa2270e4 AUConverterBase::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 668
30 libEmbeddedSystemAUs.dylib      0x1aa2a36f4 AURemoteIO::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 136
31 libEmbeddedSystemAUs.dylib      0x1aa2bcc5c AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 1524
32 libEmbeddedSystemAUs.dylib      0x1aa2ae4b4 AURemoteIO::PerformIO(unsigned int, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const*, AudioBufferList*, int&) + 916
33 libEmbeddedSystemAUs.dylib      0x1aa2f27e8 _XPerformIO + 320
34 libAudioToolboxUtility.dylib    0x19788c298 mshMIGPerform + 264
35 libAudioToolboxUtility.dylib    0x19788c6a8 MSHMIGDispatchMessage + 36
36 libEmbeddedSystemAUs.dylib      0x1aa2a67ac AURemoteIO::IOThread::Entry(void*) + 556
37 libAudioToolboxUtility.dylib    0x19788a4f8 CAPThread::Entry(CAPThread*) + 88
38 libsystem_pthread.dylib         0x18c3edd8c _pthread_start + 156
39 libsystem_pthread.dylib         0x18c3f176c thread_start + 8


Main Thread Stack Trace

com.apple.main-thread
0  AudioToolboxCore               0x19971a1f4 AC3PacketParser::IsValid() + 74
1  AudioToolboxCore               0x199781d2c WAVEAudioFile::OpenFromDataSource() + 20
2  AudioToolboxCore               0x1997a242c AudioFileObject::Open(__CFURL const*, signed char, int) + 84
3  AudioToolboxCore               0x1997a6370 AudioFileObject::DoOpen(__CFURL const*, signed char, int) + 36
4  AudioToolboxCore               0x1996fcd60 AudioFileOpenURL + 1880
5  AudioToolboxCore               0x1996c0724 ExtAudioFileOpenURL + 116
6  AVFAudio                       0x19925b814 -[AVAudioFile initForReading:commonFormat:interleaved:error:] + 196
7  TrainCentric                   0x104d84e38 AVAudioFile.__allocating_init(forReading:) + 4340256312 (:4340256312)
8  TrainCentric                   0x104d85ca0 specialized MySound.init(url:category:) + 40 (Sound.swift:40)
9  TrainCentric                   0x104d3433c specialized TrainViewController.init(coder:) + 85 (TrainViewController.swift:85)
10 TrainCentric                   0x104d32b00 @objc TrainViewController.init(coder:) + 4339919616 (:4339919616)
11 UIKitCore                      0x1903f83c0 -[UIClassSwapper initWithCoder:] + 2456
12 UIFoundation                   0x18fce039c UINibDecoderDecodeObjectForValue + 728
13 UIFoundation                   0x18fc7cac8 -[UINibDecoder decodeObjectForKey:] + 316
14 UIKitCore                      0x1903fc3e4 -[UIRuntimeConnection initWithCoder:] + 128
15 UIFoundation                   0x18fce039c UINibDecoderDecodeObjectForValue + 728
16 UIFoundation                   0x18fce05d0 UINibDecoderDecodeObjectForValue + 1292
17 UIFoundation                   0x18fc7cac8 -[UINibDecoder decodeObjectForKey:] + 316
18 UIKitCore                      0x1903f745c -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 488
19 UIKitCore                      0x1903fa04c -[UINib instantiateWithOwner:options:] + 1112
20 UIKitCore                      0x1908acea0 -[UIStoryboard __reallyInstantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 288
21 TrainCentric                   0x104ce28a8 WorkoutTrainingViewController.setupPages() + 90 (TrainViewController.swift:90)
22 TrainCentric                   0x104ce2670 @objc WorkoutTrainingViewController.viewDidLoad() + 4339590768 (:4339590768)
23 UIKitCore                      0x190139448 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 100
24 UIKitCore                      0x19013df58 -[UIViewController loadViewIfRequired] + 936
25 UIKitCore                      0x19013e360 -[UIViewController view] + 28
26 UIKitCore                      0x190068a24 -[_UIFullscreenPresentationController _setPresentedViewController:] + 80
27 UIKitCore                      0x19005c434 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 188
28 UIKitCore                      0x19014dbf8 -[UIViewController _presentViewController:withAnimationController:completion:] + 2528
29 UIKitCore                      0x190150794 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 104
30 UIKitCore                      0x190150c90 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 508
31 UIKitCore                      0x1901506e4 -[UIViewController _presentViewController:animated:completion:] + 196
32 UIKitCore                      0x19015094c -[UIViewController presentViewController:animated:completion:] + 160
33 TrainCentric                   0x104d0d8dc ExerciseSettingsViewController.trainButtonTapped() + 4339767516 (:4339767516)
34 TrainCentric                   0x104d0dab4 @objc ExerciseSettingsViewController.trainButtonTapped() + 4339767988 (:4339767988)
35 UIKitCore                      0x1907599ac -[UIApplication sendAction:to:from:forEvent:] + 96
36 UIKitCore                      0x19018ffbc -[UIControl sendAction:to:forEvent:] + 240
37 UIKitCore                      0x190190320 -[UIControl _sendActionsForEvents:withEvent:] + 408
38 UIKitCore                      0x19018f33c -[UIControl touchesEnded:withEvent:] + 520
39 UIKitCore                      0x190793050 -[UIWindow _sendTouchesForEvent:] + 2324
40 UIKitCore                      0x190794390 -[UIWindow sendEvent:] + 3352
41 UIKitCore                      0x190770a9c -[UIApplication sendEvent:] + 344
42 UIKitCore                      0x1907e8c20 __dispatchPreprocessedEventFromEventQueue + 5880
43 UIKitCore                      0x1907eb17c __handleEventQueueInternal + 4924
44 UIKitCore                      0x1907e3ff0 __handleHIDEventFetcherDrain + 108
45 CoreFoundation                 0x18c650a00 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
46 CoreFoundation                 0x18c650958 __CFRunLoopDoSource0 + 80
47 CoreFoundation                 0x18c6500f0 __CFRunLoopDoSources0 + 180
48 CoreFoundation                 0x18c64b23c __CFRunLoopRun + 1080
49 CoreFoundation                 0x18c64aadc CFRunLoopRunSpecific + 464
50 GraphicsServices               0x1965eb328 GSEventRunModal + 104
51 UIKitCore                      0x19075863c UIApplicationMain + 1936
52 TrainCentric                   0x104c6bcb4 main + 21 (SearchBarCollectionViewCell.swift:21)
53 libdyld.dylib                  0x18c4d4360 start + 4
I'm getting a very similar crash, with no obvious cause—just started today, as well, in a context that was previously stable.
Super weird. Did you ever find out what was up?
Crashed: AURemoteIO::IOThread EXC_BAD_ACCESS KERN_INVALID_ADDRESS
 
 
Q