Android crash with FMOD 2.0.0.7

#7337 FMOD Studio sample load thread

SIGABRT

解析原始

1 #00 pc 0001d02e /system/lib/libc.so (abort+57) [armeabi-v8]
2 #01 pc 00074f53 /system/lib/libc.so (__fortify_fatal(char const*, …)+26) [armeabi-v8]
3 #02 pc 000746e1 /system/lib/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+20) [armeabi-v8]
4 #03 pc 000745fb /system/lib/libc.so (pthread_mutex_lock+218) [armeabi-v8]
5 #04 pc 0007d73f /system/lib/libc++.so (std::__1::mutex::lock()+2) [armeabi-v8]
6 #05 pc 0000b6ad /system/lib/libandroid.so (AAssetManager_open+36) [armeabi-v8]
7 #06 pc 0009d7c7 /data/app/com.xxxxx.xxxx-OKRBsnJLXmPeKd63U6TkIg==/lib/arm/libfmod.so [armeabi-v7a]

  1. Someone know the reason?
  2. Where to download the symbols file?

Thanks!

PS:The crash is happened in Android system 9 &10 .

If you can reproduce the crash while using the FMOD logging libs, that should provide some useful information.

sorry, we can’t repreduce the crash. do you know the function of "0009d7c7 /data/app/com.xxxxx.xxxx-OKRBsnJLXmPeKd63U6TkIg==/lib/arm/libfmod.so "? may be it can help.

I’ve been looking into your crash call stack, I can see it’s coming from our File I/O routines that deal with opening Android assets packaged into the APK. I can see a potential issue internally however I am unable to reproduce the problem here.

Can you verify that you call org.fmod.FMOD.init(this) in your activity onCreate for the activity and org.fmod.FMOD.close() in the onDestroy? As per the documentation here.

When you call into our init function we cache the Activity context and use it to access the asset manager from our native code. Our examples follow the pattern of initializing the FMOD Java then creating the native FMOD System, mirrored with shutting down the native FMOD System and closing the FMOD Java. Can you check that your application follows that pattern?

we use Unity Integration to access FMOD.
we find the code we init FMOD, can’t find close in Unity Integation.
The code is here.

static RuntimeManager Instance
        {
            get
            {
                if (initException != null)
                {
                    throw initException;
                }

                if (instance == null)
                {
                    FMOD.RESULT initResult = FMOD.RESULT.OK; // Initialize can return an error code if it falls back to NO_SOUND, throw it as a non-cached exception

                    var existing = FindObjectsOfType(typeof(RuntimeManager)) as RuntimeManager[];
                    foreach (var iter in existing)
                    {
                        if (existing != null)
                        {
                            // Older versions of the integration may have leaked the runtime manager game object into the scene,
                            // which was then serialized. It won't have valid pointers so don't use it.
                            if (iter.cachedPointers[0] != 0)
                            {
                                instance = iter;
                                instance.studioSystem.handle = ((IntPtr)instance.cachedPointers[0]);
                                instance.coreSystem.handle = ((IntPtr)instance.cachedPointers[1]);
                            }
                            DestroyImmediate(iter);
                        }
                    }

                    var gameObject = new GameObject("FMOD.UnityIntegration.RuntimeManager");
                    instance = gameObject.AddComponent<RuntimeManager>();

                    if (Application.isPlaying) // This class is used in edit mode by the Timeline auditioning system
                    {
                        DontDestroyOnLoad(gameObject);
                    }
                    gameObject.hideFlags = HideFlags.HideAndDontSave;

                    try
                    {
#if UNITY_ANDROID && !UNITY_EDITOR
                        // First, obtain the current activity context
                        AndroidJavaObject activity = null;
                        using (var activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                        {
                            activity = activityClass.GetStatic<AndroidJavaObject>("currentActivity");
                        }

                        using (var fmodJava = new AndroidJavaClass("org.fmod.FMOD"))
                        {
                            if (fmodJava != null)
                            {
                                fmodJava.CallStatic("init", activity);
                            }
                            else
                            {
                                UnityEngine.Debug.LogWarning("[FMOD] Cannot initialize Java wrapper");
                            }
                        }
#endif

                        RuntimeUtils.EnforceLibraryOrder();
                        initResult = instance.Initialize();
                    }
                    catch (Exception e)
                    {
                        initException = e as SystemNotInitializedException;
                        if (initException == null)
                        {
                            initException = new SystemNotInitializedException(e);
                        }
                        throw initException;
                    }

                    if (initResult != FMOD.RESULT.OK)
                    {
                        throw new SystemNotInitializedException(initResult, "Output forced to NO SOUND mode");
                    }
                }
                return instance;
            }
        }

    void OnDestroy()
    {
        if (studioSystem.isValid())
        {
            studioSystem.release();
            studioSystem.clearHandle();
        }
        initException = null;
        instance = null;
    }

Thank you for the information.

I have a fix in mind that I will put in 2.00.09, please retest when that becomes available.

We have similar crashes occurring in our Unity game using FMOD 2.00.08 – the offset into libfmod.so with version .08 is different but maybe this can correlate with the previous report using .07

We have not reproduced locally but it occurs with some frequency in the real world, with similar reports collected via Google Play, Unity Cloud, and Bugsnag.

It is sometimes corresponding with ad-viewing, although I am not able to say that with certainty. Many breadcrumb report state that an ad was viewed near the time of the crash. We use Unity Ads and IronSource if that matters. Unfortunately I don’t have any more information at this time.

Can you provide an ETA for 2.00.09? We could probably have that integrated and out in the world to many users very quickly.

Here is an example:

SIGABRT Abort program 
    /system/lib64/libc.so:139008 abort
    /system/lib64/libc.so:546596 pthread_once
    /system/lib64/libc.so:544368 0x7546606e70
    /system/lib64/libc.so:544000 pthread_mutex_lock
    /system/lib64/libc++.so:629704 _ZNSt3__15mutex4lockEv
    /system/lib64/libandroid.so:56488 AAssetManager_open
    /data/app/com.offfgames.android.free.baseballbattle-DgshmntJJnRsaPR2qIwIGg==/lib/arm64/libfmod.so:814448 0x747f55ed70

Thanks!

May I ask when the 2.00.09 is expected to come out?

We are aiming for 2.00.09 to be released early next week, please report back how it goes once integrated into your applications.

Okay, we’ll integrate it first.

Really hoping this is fixed in 2.00.09. We have found a case that repros 100% locally and have managed to capture a log with Logging library. There was no relevant output in logcat but this is possibly a more description stack trace. Captured with FMOD 2.00.08 Unity integration:

05-07 14:31:40.374  7596  7812 E CRASH   : signal 6 (SIGABRT), code -6 (?), fault addr --------
05-07 14:31:40.374  7596  7812 E CRASH   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-07 14:31:40.374  7596  7812 E CRASH   : Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
05-07 14:31:40.374  7596  7812 E CRASH   : Build fingerprint: 'samsung/jackpotltevl/jackpotltecan:9/PPR1.180610.011/A530WVLUACTB2:user/release-keys'
05-07 14:31:40.374  7596  7812 E CRASH   : Revision: '7'
05-07 14:31:40.374  7596  7812 E CRASH   : pid: 7596, tid: 7812, name: FMOD Studio sam  >>> com.hotheadgames.android.free.hydrostone <<<
05-07 14:31:40.374  7596  7812 E CRASH   :     x0   0000000000000000  x1   0000000000001e84  x2   0000000000000006  x3   0000000000000008
05-07 14:31:40.374  7596  7812 E CRASH   :     x4   0000000000008080  x5   0000000000008080  x6   0000000000008080  x7   0000000000000038
05-07 14:31:40.374  7596  7812 E CRASH   :     x8   0000000000000083  x9   fef1652add54f8d9  x10  0000000000000000  x11  fffffffc7ffffbdf
05-07 14:31:40.374  7596  7812 E CRASH   :     x12  0000000000000001  x13  000000005eb47e3a  x14  00353a14b95fd880  x15  00005726189c7e20
05-07 14:31:40.374  7596  7812 E CRASH   :     x16  0000006fbbdb32a0  x17  0000006fbbcf26c8  x18  0000000000000001  x19  0000000000001dac
05-07 14:31:40.374  7596  7812 E CRASH   :     x20  0000000000001e84  x21  0000006f20febe9e  x22  0000006f09fec870  x23  0000000000000000
05-07 14:31:40.374  7596  7812 E CRASH   :     x24  0000000000000000  x25  0000006f06b56fc4  x26  0000006f13243588  x27  0000006f0d934c28
05-07 14:31:40.374  7596  7812 E CRASH   :     x28  0000000000000002  x29  0000006f13242e30  x30  0000006fbbce5ecc
05-07 14:31:40.374  7596  7812 E CRASH   :     sp   0000006f13242df0  pc   0000006fbbce5ef4  pstate 0000000060000000
05-07 14:31:40.374  7596  7812 E CRASH   : 
05-07 14:31:40.374  7596  7812 E CRASH   : backtrace:
05-07 14:31:40.389  3603  3755 D InputReader: Input event(1): value=0 when=137046.465429
05-07 14:31:40.390  3603  3755 D InputReader: Input event(1): value=0 when=137046.465429
05-07 14:31:40.390  3603  3755 I InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=137046.465429
05-07 14:31:40.421  7596  7812 E CRASH   : 	#00  pc 000000000000068c  [vdso] ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#01  pc 0000000000021ef0  /system/lib64/libc.so (abort+112)
05-07 14:31:40.421  7596  7812 E CRASH   : 	#02  pc 0000000000084cd4  /system/lib64/libc.so (_ZL15__fortify_fatalPKcz+120)
05-07 14:31:40.421  7596  7812 E CRASH   : 	#03  pc 0000000000084390  /system/lib64/libc.so (_ZL25HandleUsingDestroyedMutexP15pthread_mutex_tPKc+52)
05-07 14:31:40.421  7596  7812 E CRASH   : 	#04  pc 0000000000084240  /system/lib64/libc.so (pthread_mutex_lock+256)
05-07 14:31:40.421  7596  7812 E CRASH   : 	#05  pc 0000000000099cb8  /system/lib64/libc++.so (_ZNSt3__15mutex4lockEv+8)
05-07 14:31:40.421  7596  7812 E CRASH   : 	#06  pc 000000000000dca4  /system/lib64/libandroid.so (AAssetManager_open+64)
05-07 14:31:40.421  7596  7812 E CRASH   : 	#07  pc 00000000000df1e0  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#08  pc 00000000001777a8  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodstudioL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#09  pc 0000000000020294  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodstudioL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#10  pc 0000000000170448  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodstudioL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#11  pc 000000000016f7b0  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodstudioL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#12  pc 0000000000170330  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodstudioL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#13  pc 000000000016ed6c  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodstudioL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#14  pc 0000000000179c34  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodstudioL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#15  pc 000000000017a8c0  /data/app/com.hotheadgames.android.free.hydrostone-E8WyZ8ZuF6eF0muGP5rNbg==/lib/arm64/libfmodstudioL.so ()
05-07 14:31:40.421  7596  7812 E CRASH   : 	#16  pc 0000000000083650  /system/lib64/libc.so (_ZL15__pthread_startPv+196)
05-07 14:31:40.421  7596  7812 E CRASH   : 	#17  pc 0000000000023b34  /system/lib64/libc.so (__start_thread+68)

I do see this near the crash:

05-07 14:31:38.931  7596  8195 F libc    : FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x6f3308ef40)

I’m glad you have a 100% repro, please test with 2.00.09 (available now).
If you are still having issues I can work with you to get it resolved.

We have this same crash issue with Fmod 1.10.02 on Android 9 and 10 so really looking for if the 2.00.09 fixes the problem. Please if possible, keep posting your findings to this thread to keep us all with the same problem informed for possible fixes. Thank you all.

This problem seems to have been solved. I haven’t seen the crash for a few days.
Thanks! @mathew

Can confirm that the issue have been solved by the update, our project just developed other issue from the update but that´s different story and can be followed in here: Crash on FMOD Studio Update thread, Fmod Version: 2.00.09