Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug We are seeing crashes EXC_BAD_ACCESS KERN_INVALID_ADDRESS on FMOD::SoundGroupI::getNumPlaying

Discussion in 'Audio & Video' started by kaushik_pba, Feb 6, 2023.

  1. kaushik_pba

    kaushik_pba

    Joined:
    Mar 19, 2018
    Posts:
    3
    We are using Unity 2021.3.5f1 and on iOS we are seeing these crashes on Firebase Crashlytics, which we are not able to reproduce on our end.

    This is the full stack trace:
    Crashed: com.apple.main-thread
    0 UnityFramework 0x1256a1c FMOD::SoundGroupI::getNumPlaying(int*) + 3741116
    1 UnityFramework 0x1266c4c FMOD::SystemI::playSound(FMOD_CHANNELINDEX, FMOD::SoundI*, bool, FMOD::ChannelI**) + 3807212
    2 UnityFramework 0x125c840 FMOD::System::playSound(FMOD_CHANNELINDEX, FMOD::Sound*, bool, FMOD::Channel**) + 3765216
    3 UnityFramework 0x88f9d0 SoundHandle::Instance::CreateChannel(SoundHandle&, bool) + 397 (SoundManager.cpp:397)
    4 UnityFramework 0x882530 SampleClip::AllocateChannel(bool, unsigned long long) + 130 (WeakPtr.h:130)
    5 UnityFramework 0x8719e0 AudioSource::Play(double) + 145 (WeakPtr.h:145)
    6 UnityFramework 0x4a1e44 AudioSource_CUSTOM_PlayHelper(ScriptingBackendNativeObjectPtrOpaque*, unsigned long long) + 1379 (AudioBindings.gen.cpp:1379)
    7 UnityFramework 0x14a68f8 UnityEngine.U2D.SpriteShapeGenerator.TessellateContour(UnityEngine.U2D.SpriteShapeGenerator* this) -> void_f7c830754110dc9aeb9050443cd2a04b.cold.10 + 4404193528
    8 UnityFramework 0x1d218b8 UnityEngine.U2D.SpriteShapeGenerator.TessellateContour(UnityEngine.U2D.SpriteShapeGenerator* this) -> void_f7c830754110dc9aeb9050443cd2a04b.cold.10 + 4413085880
    9 UnityFramework 0x1307e80 il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**) + 576 (Runtime.cpp:576)
    10 UnityFramework 0x1307cc8 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) + 570 (Runtime.cpp:570)
    11 UnityFramework 0x6acd00 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) + 292 (ScriptingApi_Il2Cpp.cpp:292)
    12 UnityFramework 0x6b9130 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) + 298 (ScriptingInvocation.cpp:298)
    13 UnityFramework 0x6c5e5c Coroutine::InvokeMoveNext(ScriptingExceptionPtr*) + 247 (Coroutine.cpp:247)
    14 UnityFramework 0x6c5a10 Coroutine::Run(bool*) + 271 (Coroutine.cpp:271)
    15 UnityFramework 0x6c5ac4 Coroutine::Run(bool*) + 316 (Coroutine.cpp:316)
    16 UnityFramework 0x503aa0 DelayedCallManager::Update(int) + 187 (CallDelayed.cpp:187)
    17 UnityFramework 0x5bc8ec ExecutePlayerLoop(NativePlayerLoopSystem*) + 383 (PlayerLoop.cpp:383)
    18 UnityFramework 0x5bc92c ExecutePlayerLoop(NativePlayerLoopSystem*) + 407 (PlayerLoop.cpp:407)
    19 UnityFramework 0x5bcb88 PlayerLoop() + 514 (PlayerLoop.cpp:514)
    20 UnityFramework 0xd07244 UnityPlayerLoopImpl(bool) + 330 (LibEntryPoint.mm:330)
    21 UnityFramework 0x16d08 -[UnityAppController(Rendering) repaint] + 238 (UnityAppController+Rendering.mm:238)
    22 UnityFramework 0x16c98 -[UnityAppController(Rendering) repaintDisplayLink] + 72 (UnityAppController+Rendering.mm:72)
    23 QuartzCore 0x28f9c CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 756
    24 QuartzCore 0x155edc CA::Display::DisplayLink::dispatch_deferred_display_links(unsigned int) + 380
    25 UIKitCore 0x652740 _UIUpdateSequenceRun + 84
    26 UIKitCore 0xc99fd0 schedulerStepScheduledMainSection + 172
    27 UIKitCore 0xc9919c runloopSourceCallback + 92
    28 CoreFoundation 0xd5f54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
    29 CoreFoundation 0xe232c __CFRunLoopDoSource0 + 176
    30 CoreFoundation 0x66210 __CFRunLoopDoSources0 + 244
    31 CoreFoundation 0x7bba8 __CFRunLoopRun + 836
    32 CoreFoundation 0x80ed4 CFRunLoopRunSpecific + 612
    33 GraphicsServices 0x1368 GSEventRunModal + 164
    34 UIKitCore 0x3a23d0 -[UIApplication _run] + 888
    35 UIKitCore 0x3a2034 UIApplicationMain + 340
    36 UnityFramework 0x1683c -[UnityFramework runUIApplicationMainWithArgc:argv:] + 96 (main.mm:96)


    On launch we are playing audio from asset bundle [LZ4] programatically.

    Any idea what can be the issue.
     
  2. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    305
    What do you mean by "playing audio from asset bundle [LZ4] programatically" ? Are you fetching audio data and decompressing it on your own to generate an AudioClip?

    By any chance, would you have a crash dump available?
     
  3. kaushik_pba

    kaushik_pba

    Joined:
    Mar 19, 2018
    Posts:
    3
    Hi

    To give you the context on Splash screen there is VideoPlayer that plays intro video and also title audio that I play before video. Both get loaded on Splash screen launch.

    Previously I was playing title audio from Asset Bundle programmatically and to load clip I used
    Code (CSharp):
    1. AssetBundle.LoadAsset<AudioClip>()
    method.

    I thought that it could be that audio was not getting loaded from bundle, I removed it from bundle and directly linked it to AudioSource but still seeing the same crash.

    What I am not able to figure out why FMOD is crashing.

    I am not able to reproduce it on my end.

    I am attaching the crash dump from Firebase Crashlytics.
     

    Attached Files:

  4. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    305
    The crash occuring in
    SoundGroupI::getNumPlaying
    is probably due to an invalid sound address/data in the group being dereferenced. The group itself is a thread-unsafe linked-list, so a concurrent alteration of the sound data might cause this. If the bug has a low-frequency (relatively to the total usage on this platform) this might be a race condition thing... fun bug....

    Would you be able to add some checks around the loading of the clip by validating the
    AudioClip.loadState
    ?
     
  5. kaushik_pba

    kaushik_pba

    Joined:
    Mar 19, 2018
    Posts:
    3
    I did put
    AudioClip.loadState
    and that is coming as LOADED and still crashing.
     
  6. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    305
    Then I suggest you file in a bug report. This is the official way to put this in the grinder. It also has more impact in prioritization when it comes from a user. I'm really sorry about the inconvenience.