# getUserData android crash

**URL:** <https://qa.fmod.com/t/getuserdata-android-crash/21139>\
**Category:** FMOD Engine\
**Created:** [January 22, 2024, 1:44pm UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139 "2024-01-22T13:44:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [January 22, 2024, 1:44pm UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/1 "2024-01-22T13:44:19Z")

</div>

Hello, we are currently encountering crashes on Android devices. It appears that these issues are not tied to a specific Android OS version or device. Typically, they occur after the application enters the ‘on pause’ mode. Here is the stack trace:

> libc +0x609dc \_\_memcpy\_a53  
> split\_config.armeabi\_v7a.apk +0xb31ec FMOD::Geometry::getUserData

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [January 22, 2024, 10:05pm UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/2 "2024-01-22T22:05:03Z")

</div>

A few questions:

- What version of FMOD (and relevant engine, if you’re using an official integration) are you using?
- Are you making any calls to `FMOD::Geometry::getUserData`, or any calls to `FMOD::Geometry` in general? If so, can you post snippets of these calls?
- If you haven’t already, can you swap to the logging version of the libs (“L” suffix), enable logging with [`Debug_Initialize`](https://www.fmod.com/docs/2.02/api/core-api-common.html#debug_initialize), and see whether this reveals any more information when the crash occurs?
- Can I get you to post the full stack trace and any relevant logs? You can post them here, or upload it to your [FMOD user profile](https://www.fmod.com/profile#uploads).

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [January 23, 2024, 1:51am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/3 "2024-01-23T01:51:55Z")

</div>

1. 2.02.19, we have our custom engine.
2. We have such process to call getUserData():  
at the begining:  
`_eventInstance->setCallback(&SoundEffectFModEvent::EventCallback, mask);`  
later call from your API:

```auto
FMOD_RESULT F_CALLBACK SoundEffectFModEvent::EventCallback(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, FMOD_STUDIO_EVENTINSTANCE* event, void * /*parameters*/) {
FMOD::Studio::EventInstance *eventInstance = reinterpret_cast<FMOD::Studio::EventInstance*>(event);
	SoundEffectFModEvent* soundEffect = nullptr;
eventInstance->getUserData(reinterpret_cast<void**>(&soundEffect));
...

```

1. We can not switch to logging version because we have found these issues only in production logs of the application.
2. It’s full stack trace, we don’t have anything more and there are no usefull logs.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [February 1, 2024, 4:57am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/4 "2024-02-01T04:57:28Z")

</div>

Apologies for the delayed response.

> [@maksimomelyanchuk](#):
>
> We have such process to call getUserData():  
> at the begining:  
> `_eventInstance->setCallback(&SoundEffectFModEvent::EventCallback, mask);`  
> later call from your API:

Are you making any calls to `Geometry`, not just to user data in general?

What’s the latest Android version the crash occurs on? While we don’t use Google’s Oboe API, there is a known issue (which was scheduled for fixing in Android T) with Oboe where other applications can cause a crash when backgrounded, which sounds like it may be what you’re describing. Does anything described here and in the linked github issue line up with your experience? [Fmod crash on android crash stack libaudioclient.so - #12 by jeff\_fmod](https://qa.fmod.com/t/fmod-crash-on-android-crash-stack-libaudioclient-so/18266/12)

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [February 2, 2024, 2:23am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/5 "2024-02-02T02:23:08Z")

</div>

Thank you for continuing the investigation.  
We don’t have any geometry calls.  
We are experiencing such crashes on Android 13. As I understand, it means that it’s not connected to the Oboe issue.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [February 8, 2024, 2:42am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/6 "2024-02-08T02:42:31Z")

</div>

I’ve given it another test on my end with an example project that makes use of user user data and event callbacks, but unfortunately I’ve been unable to reproduce the issue. Could I get you to upload your project and a crash stack to your [FMOD User profile](https://www.fmod.com/profile#uploads) so I can take a look and try to diagnose the issue? Also, can I get you to provide me with the names of the Android devices, or a selection of them, that the crash occurs on?

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [February 12, 2024, 6:35am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/7 "2024-02-12T06:35:39Z")

</div>

We cannot reproduce it ourselves; we only have crash statistics from our crash collector services. So, it’s quite useless to upload any build, I think.  
You can find the names of the devices with the highest crash rates, but there are many more. I think this case is not device-specific.  
Redmi Note 11 5%  
Redmi 10C 2%  
Galaxy A12 2%  
Galaxy A51 2%

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [February 19, 2024, 12:25am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/8 "2024-02-19T00:25:30Z")

</div>

Thanks for the device info, I’d agree that it’s probably not device specific.

Unfortunately, it’s a little difficult to dig into this any further without more information. Given that you’re not making any calls to `Geometry::getUserData`, it’s likely that the symbols aren’t resolving correctly - if you’re able to provide me with a full crash stack/log and your exact NDK version, I should be able to track down the issue.

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [April 3, 2024, 4:57am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/9 "2024-04-03T04:57:21Z")

</div>

We did some research, so I want to share the results with you. I hope it will help you investigate the problem.  
The previous callstack seems to be wrong. The correct one looks like this:

```auto
#0: libfmod.so+0xd73e8 // seems to be OutputRingBuffer::read( 0xb400007155bca800, 0x0, 0x240, true)
#1: libfmod.so+0xe8df8 // seems to be OutputOpenSL::feederThread
#2: libwilhelm.so`audioTrack_handleMoreData_lockPlay(CAudioPlayer_struct*, android::AudioTrack::Buffer const&) + 136
#3: libwilhelm.so`android::AudioTrackCallback::onMoreData(android::AudioTrack::Buffer const&) + 52
#4: libaudioclient.so`android::AudioTrack::processAudioBuffer() + 3048
#5: libaudioclient.so`android::AudioTrack::AudioTrackThread::threadLoop() + 300
#6: libutils.so`android::Thread::_threadLoop(void*) + 428
#7: libandroid_runtime.so`android::AndroidRuntime::javaThreadShell(void*) + 148
#8: libc.so`__pthread_start(void*) + 212
#9: libc.so`__start_thread + 72

```

Recently, we made a change in our code. Now, we call `_lowLevelSystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND)` when the application goes on pause, and `_lowLevelSystem->setOutput(FMOD_OUTPUTTYPE_OPENSL)` when the application resumes. After this change, this occurs more often. As I mentioned before, it seems that the crash occurs after losing the audio context, suggesting a connection between these two things.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 5, 2024, 4:45am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/10 "2024-04-05T04:45:26Z")

</div>

Much appreciated, I’ll consult with the development team and get back to you. Additionally, can I get your exact NDK version from you as well?

> [@maksimomelyanchuk](#):
>
> Recently, we made a change in our code. Now, we call `_lowLevelSystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND)` when the application goes on pause, and `_lowLevelSystem->setOutput(FMOD_OUTPUTTYPE_OPENSL)` when the application resumes. After this change, this occurs more often.

Just to clarify, you’re saying that the crash occurs more often after making this change?

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [April 8, 2024, 12:11pm UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/11 "2024-04-08T12:11:53Z")

</div>

Yes, after we added `setOutput` to `NOSOUND` and back to `OPENSL`, crashes occur more often. But maybe it’s just a coincidence. Also, in this version, we changed the NDK version: `NDK r23b` (`23.1.7779620`) was upgraded to `NDK r25c` (`25.2.9519653`).

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 11, 2024, 3:25am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/12 "2024-04-11T03:25:56Z")

</div>

After consulting with the development team, it appears that a likely culprit is memory used for resampling not being initialized, seemingly after suspending and resuming.

Could I get you to test using various sample rates and see whether you can reproduce the crash? You can set the sample rate with [`System::setSoftwareFormat`](https://www.fmod.com/docs/2.02/api/core-api-system.html#system_setsoftwareformat) - I suspect it’s likely that when no resampling is required (i.e. the FMOD system’s sample rate matches the device’s sample rate), the crash shouldn’t occur.

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [April 15, 2024, 6:05am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/13 "2024-04-15T06:05:00Z")

</div>

We can not reproduce this issue on our side, we have only crash logs from our users. So we are not able to help you with the tests…

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 18, 2024, 3:21am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/14 "2024-04-18T03:21:39Z")

</div>

No problem, I’ll do some more testing on my end. Thanks again for the additional information.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [May 10, 2024, 5:38am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/15 "2024-05-10T05:38:42Z")

</div>

Unfortunately, the issue still hasn’t been reproducible on my end. If you’re currently not, you may wish to try calling [`System::mixerSuspend`](https://www.fmod.com/docs/2.02/api/core-api-system.html#system_mixersuspend) and [`System::mixerResume`](https://www.fmod.com/docs/2.02/api/core-api-system.html#system_mixerresume) when suspending and resuming instead of changing the system output type, and see whether that reduces occurrences of the crash. Otherwise, if you’re find or are able to provide any more information on the crash in the future, please feel free to let me know.

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [May 14, 2024, 6:17am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/16 "2024-05-14T06:17:04Z")

</div>

We have `System::mixerSuspend/System::mixerResume` calls in our code. It goes like this:  
Suspending:

```auto
setOuput(FMOD_OUTPUTTYPE_NOSOUND)
mixerSuspend()

```

Resuming:

```auto
mixerResume()
setOuput(FMOD_OUTPUTTYPE_OPENSL)

```

We were forced to add setOuput() because you have another bug, it appears mostly on Samsung devices. There is a small sound during the termination of application. I’ve uploaded video to my profile, you can check it there.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [May 17, 2024, 2:03am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/17 "2024-05-17T02:03:38Z")

</div>

Thanks for uploading the video, I can see what you’re referring to and it’s not what we’d expect. I’ll give it a test on a Samsung device on my end soon and see whether I’m able to pin down what’s causing the issue.

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [May 17, 2024, 9:24am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/18 "2024-05-17T09:24:55Z")

</div>

Thank you. Also, please check our calls sequence—is it safe, or does it risk causing the initial topic’s crash?

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [May 30, 2024, 5:10am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/19 "2024-05-30T05:10:35Z")

</div>

I haven’t been able to reproduce the behavior in your video on my end, so I suspect it may be an issue with how suspending/resuming is being handled on your engine’s side of things. Could I get you to upload a build of your app to your [FMOD user profile](https://www.fmod.com/profile#uploads) so I can have a look?

> [@maksimomelyanchuk](#):
>
> Also, please check our calls sequence—is it safe, or does it risk causing the initial topic’s crash?

As far as I can tell, no, setting outputs shouldn’t risk causing the initial topic’s crash.

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [May 31, 2024, 3:39am UTC](https://qa.fmod.com/t/getuserdata-android-crash/21139/20 "2024-05-31T03:39:17Z")

</div>

Done, you can check it now.

[Next page](https://qa.fmod.com/t/getuserdata-android-crash/21139.md?page=2)
