# Crash at SetThreadAffinity When Init FMOD in Android

**URL:** <https://qa.fmod.com/t/crash-at-setthreadaffinity-when-init-fmod-in-android/19438>\
**Category:** FMOD Engine\
**Tags:** android, unity, csharp, cpp\
**Created:** [October 21, 2022, 12:31pm UTC](https://qa.fmod.com/t/crash-at-setthreadaffinity-when-init-fmod-in-android/19438 "2022-10-21T12:31:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [October 21, 2022, 12:31pm UTC](https://qa.fmod.com/t/crash-at-setthreadaffinity-when-init-fmod-in-android/19438/1 "2022-10-21T12:31:48Z")

</div>

```auto
0 libutils.so!android::RefBase::incStrong(void const*) const + 0x8
     x0 = 0x000000790b339000 x1 = 0x0000007931a25d90
     x2 = 0x000000790a200000 x3 = 0x0000000000000002
     x4 = 0x00000000000000e7 x5 = 0x0000007955400940
     x6 = 0x000000790a2e7660 x7 = 0x000000790a2e76c0
     x8 = 0x0000000000000000 x9 = 0x0000000000000004
    x10 = 0x00000000000000e7 x11 = 0x0000000000000000
    x12 = 0x000000790a2e7700 x13 = 0x000000790ba4dfe0
    x14 = 0x0000000000000000 x15 = 0x0000000000000000
    x16 = 0x00000079578fce48 x17 = 0x0000007956b6b674
    x18 = 0x00000079385ac834 x19 = 0x000000790b339000
    x20 = 0x0000007931a25d90 x21 = 0x0000000000000000
    x22 = 0x0000007931a25d90 x23 = 0x0000000000000000
    x24 = 0x0000000000000000 x25 = 0x0000000000000104
    x26 = 0x0000000000000003 x27 = 0x0000000000000000
    x28 = 0x000000790b339000 fp = 0x0000007909717780
     lr = 0x00000079578d4808 sp = 0x0000007909717760
     pc = 0x0000007956b6b67c
    Found by: given as instruction pointer in context
 1 0x79578d4804
     fp = 0x0000007909717860 lr = 0x000000794d95cb60
     sp = 0x0000007909717790 pc = 0x00000079578d4808
    Found by: previous frame's frame pointer
 2 libaaudio.so + 0x19b5c
     fp = 0x00000079097178a0 lr = 0x000000794d95af04
     sp = 0x0000007909717870 pc = 0x000000794d95cb60
    Found by: previous frame's frame pointer
 3 libaaudio.so + 0x17f00
     fp = 0x00000079097178d0 lr = 0x000000794d95b214
     sp = 0x00000079097178b0 pc = 0x000000794d95af04
    Found by: previous frame's frame pointer
 4 libaaudio.so + 0x18210
     fp = 0x0000007909717910 lr = 0x00000076d450e524
     sp = 0x00000079097178e0 pc = 0x000000794d95b214
    Found by: previous frame's frame pointer
 5 libfmod.so!FMOD_Android_SetThreadAffinity + 0x534
     fp = 0x0000007909717970 lr = 0x00000076d448a394
     sp = 0x0000007909717920 pc = 0x00000076d450e524
    Found by: previous frame's frame pointer
 6 libfmod.so!FMOD::SystemI::setInternalCallback(int, FMOD_RESULT (*)(FMOD_SYSTEM*, unsigned int, void*, void*, void*), void*) + 0xd38
     fp = 0x00000079097179f0 lr = 0x00000076d448b464
     sp = 0x0000007909717980 pc = 0x00000076d448a394
    Found by: previous frame's frame pointer
 7 libfmod.so!FMOD::SystemI::setInternalCallback(int, FMOD_RESULT (*)(FMOD_SYSTEM*, unsigned int, void*, void*, void*), void*) + 0x1e08
     fp = 0x0000007909717b40 lr = 0x00000076d4502e48
     sp = 0x0000007909717a00 pc = 0x00000076d448b464
    Found by: previous frame's frame pointer
 8 libfmod.so!FMOD::System::init(int, unsigned int, void*) + 0x4c
     fp = 0x0000007909717bb0 lr = 0x00000076d4368b38
     sp = 0x0000007909717b50 pc = 0x00000076d4502e48
    Found by: previous frame's frame pointer
 9 libfmodstudio.so + 0x55b34
     fp = 0x0000007909717d00 lr = 0x00000076d43bd2e0
     sp = 0x0000007909717bc0 pc = 0x00000076d4368b38
    Found by: previous frame's frame pointer
10 libfmodstudio.so!FMOD::Studio::System::initialize(int, unsigned int, unsigned int, void*) + 0x54
     fp = 0x0000007909717d70 lr = 0x0000007914e3bd70
     sp = 0x0000007909717d10 pc = 0x00000076d43bd2e0
    Found by: previous frame's frame pointer
11 libil2cpp.so!System_FMOD_Studio_System_Initialize_m57978C4B62838790392E22D20F71D73F1409ACFB [Game.Runtime95.cpp : 45968 + 0x14]
     fp = 0x0000007909717eb0 lr = 0x0000007914f97404
     sp = 0x0000007909717d80 pc = 0x0000007914e3bd70
    Found by: previous frame's frame pointer
12 libil2cpp.so!RuntimeManager_Initialize_mAD4966D9471977F2EE3A955A23179B7E91D15E58 [Game.Runtime76.cpp : 35023 + 0x18]
     fp = 0x0000007909717f00 lr = 0x0000007914f95d10
     sp = 0x0000007909717ec0 pc = 0x0000007914f97404
    Found by: previous frame's frame pointer

```

According to the dump, App crashed when fmod called FMOD\_Android\_SetThreadAffinity in android.  
Is there anyone knows why this happens?

---

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [October 27, 2022, 2:15am UTC](https://qa.fmod.com/t/crash-at-setthreadaffinity-when-init-fmod-in-android/19438/2 "2022-10-27T02:15:18Z")

</div>

It should be mentioned that the CPU is a Snapdragon 845

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [October 27, 2022, 4:01am UTC](https://qa.fmod.com/t/crash-at-setthreadaffinity-when-init-fmod-in-android/19438/3 "2022-10-27T04:01:52Z")

</div>

Hi,

Apologies about the delayed response.

Could I grab some info:  
What version of Studio and integration are you using?

Are there any other logs you could pass on? FMOD Debug logs that might give us some insight to what is happening?

Are there repro steps that can cause the crash consistently or is it random?

---

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [October 27, 2022, 12:16pm UTC](https://qa.fmod.com/t/crash-at-setthreadaffinity-when-init-fmod-in-android/19438/4 "2022-10-27T12:16:06Z")

</div>

> [@Connor\_FMOD](#):
>
> Are there repro steps that can cause the crash consistently or is it random?

Thank you for your response!  
1、Version:2.00.04  
2、Unfortunately, there is no log for Debug Callback.  
3、This crash always happens when I initialize the studio system in android( CPU Snapdragon 845 ), it seems something wrong happend when setting thread affinity.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [November 1, 2022, 11:37pm UTC](https://qa.fmod.com/t/crash-at-setthreadaffinity-when-init-fmod-in-android/19438/5 "2022-11-01T23:37:56Z")

</div>

Hi,

Unfortunately, we no longer support major versions under 2.01. I would suggest migrating your version, the process of which is explained here: [FMOD Studio | Advanced Topics](https://fmod.com/docs/2.02/studio/advanced-topics.html#migrating-fmod-studio-projects), and hopefully that might solve the issue. In the meantime, I will try to reproduce the issue in 2.01 and see if I can find a resolution.
