# Crash at FMOD\_Sound\_GetOpenState process

**URL:** <https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [October 30, 2020, 6:12am UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383 "2020-10-30T06:12:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![LemonTree](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@LemonTree](https://qa.fmod.com/u/LemonTree)\
**Post date:** [October 30, 2020, 6:12am UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/1 "2020-10-30T06:12:36Z")

</div>

my program used “FMOD\_NONBLOCKING” flag to create Sounds,Attach my program to gflags(WinDug) check memory error , But always detect failed at FMOD\_Sound\_GetOpenState Crash the program.My FMOD version : 31/01/18 1.10.03 - Studio API minor release (build 93157)

 ![CoreAndAddress](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/5/57f6e8102d2a47002c1c9a611c4ed0f4a95bc9a9.png)  
 ![FmodLog](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/9/9c339dd5b6961de3304dbca55cea072a16397949.png)

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 1, 2020, 11:12pm UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/2 "2020-11-01T23:12:40Z")

</div>

Are you able to reproduce this crash by modifying one of our examples?

---

<div class="post-metadata">

**Author:** ![LemonTree](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@LemonTree](https://qa.fmod.com/u/LemonTree)\
**Post date:** [November 6, 2020, 11:28am UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/3 "2020-11-06T11:28:25Z")

</div>

Thank your reply  
I unable to reproduce this crash by your examples, But I Encounter other Crash at Release Sound. My code as follows, it changes form the examples.( Core API Version 20013)  
[SoundReleaseCrash.txt](https://qa.fmod.com/uploads/short-url/riGbTYZW6L4ZP7ra1XUk7W8aVFo.txt) (5.6 KB)

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 9, 2020, 4:33am UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/4 "2020-11-09T04:33:26Z")

</div>

Thanks for providing your code, the key issue is when you perform a non-blocking createSound using a memory pointer, that memory needs to remain available to FMOD until the asynchronous operation is complete.

---

<div class="post-metadata">

**Author:** ![LemonTree](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@LemonTree](https://qa.fmod.com/u/LemonTree)\
**Post date:** [November 9, 2020, 9:07am UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/5 "2020-11-09T09:07:02Z")

</div>

thank your reply  
I reproduce FMOD\_Sound\_GetOpenstate crash by your examples today, My code as follows, The must use gfalgs.exe attache the program  
code:  
[load\_from\_memory.txt](https://qa.fmod.com/uploads/short-url/bSJcQdH9YNSRs4GN3G4Y2g0liWe.txt) (3.8 KB)  
log:  
[log.txt](https://qa.fmod.com/uploads/short-url/yO5CumnLCauJvSJsecky2yPuJd4.txt) (41.9 KB)

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 9, 2020, 11:19pm UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/6 "2020-11-09T23:19:53Z")

</div>

Thanks for the example code, I can see the crash here too. Unfortunately there is no workaround for C, for C++, calling Sound::getOpenState without the percentbuffered / starving / diskbusy arguments should avoid it. We’ll aim to patch this for our release in ~1 month.

Another possible workaround that just occurred to me that would be compatible with C is to use the FMOD\_CREATESOUNDEXINFO::nonblockcallback, when that callback fires it should be safe to call FMOD\_Sound\_GetOpenState.

---

<div class="post-metadata">

**Author:** ![LemonTree](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@LemonTree](https://qa.fmod.com/u/LemonTree)\
**Post date:** [November 10, 2020, 11:23am UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/7 "2020-11-10T11:23:29Z")

</div>

my program will release in a late month, so I hope early to get your release lib, thank you so much.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 10, 2020, 9:50pm UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/8 "2020-11-10T21:50:14Z")

</div>

If you have time pressure I strongly recommend using the nonblockcallback workaround in case there are delays in getting the fix out.

---

<div class="post-metadata">

**Author:** ![LemonTree](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@LemonTree](https://qa.fmod.com/u/LemonTree)\
**Post date:** [November 11, 2020, 12:30pm UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/9 "2020-11-11T12:30:57Z")

</div>

I am now trying to use nonblockcallback workaround, I want to know if the crash has a big impact on the mobile platform?

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 11, 2020, 10:09pm UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/10 "2020-11-11T22:09:37Z")

</div>

> [@LemonTree](#):
>
> I want to know if the crash has a big impact on the mobile platform?

I’m not sure I follow what you are asking?

---

<div class="post-metadata">

**Author:** ![LemonTree](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@LemonTree](https://qa.fmod.com/u/LemonTree)\
**Post date:** [November 16, 2020, 6:01am UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/11 "2020-11-16T06:01:15Z")

</div>

thanks for your reply, I use nonblockcallback no reproduce this crash after. now I profile my program in mobile platform, discover FMOD Threads often steal CPU core because it has high priority. How make FMOD Threads to Normal priority?

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 16, 2020, 10:01pm UTC](https://qa.fmod.com/t/crash-at-fmod-sound-getopenstate-process/16383/12 "2020-11-16T22:01:08Z")

</div>

FMOD thread priorities are set relative to each other to ensure all threads cooperate well together. If you are using FMOD 2.01 you can override this with [Thread\_SetAttributes](https://fmod.com/resources/documentation-api?version=2.1&page=core-api-common.html#thread_setattributes) however care should be taken to ensure FMOD works well with your changes. Previous versions of FMOD cannot override priority without modification to our source code.
