0
0

has anyone had problems or know of a fix for fmod hanging on shutdown? it happens rarely when debugging, when it hangs all threads only show an address on the stack, and one thread will be in my shutdown routine stuck in a call to fmod.dll, i’ll post the full stack when it happens again. i’m using v3.71.

  • You must to post comments
0
0

In my app if I break I end up in this region:

FMOD! 01322497()

From VC++ Call Stack, there is no caller for that location or it can’t trace.

Here is some disassembly from that area:

0132245B push eax
0132245C push ecx
0132245D call 01322353
01322462 add esp,0Ch
01322465 inc dword ptr [esi+28h]
01322468 cmp dword ptr [esi+28h],ebx
0132246B jl 01322471
0132246D and dword ptr [esi+28h],0
01322471 mov eax,[0135387C]
01322476 push 5Ah
01322478 add eax,74h
0132247B push eax
0132247C call 01321E5E
01322481 mov eax,[0135387C]
01322486 pop ecx
01322487 pop ecx
01322488 fstp dword ptr [eax+24h]
0132248B cmp dword ptr [esi+28h],ebp
0132248E jne 0132243F
01322490 push 0Ah
BREAK POINT -> 01322492 call 01321F46
01322497 pop ecx
01322498 mov ecx,dword ptr ds:[135387Ch]
0132249E cmp byte ptr [ecx+6Ch],0
013224A2 je 0132241E
013224A8 pop ebp
013224A9 mov byte ptr [ecx+6Eh],1
013224AD pop ebx
013224AE pop edi
013224AF xor eax,eax
013224B1 pop esi
013224B2 ret

From what I can tell FMOD is waiting for some event. I am in debug mode (obviously) and maybe there is a problem between FMOD shutdown and debug. This is the best info I can give without more fully debugging the assembly.

  • You must to post comments
0
0

Okay, I didn’t play any streams with it yet. It is just initializing and shutting down right now. As for trying 0 on Init, that changed nothing. I’m digging into it deeper, but if you have anymore ideas what it could be, let me know.

  • You must to post comments
0
0

Only time I ever had it was when streams had not been stopped before closing FMOD but that was with earlier versions.

  • You must to post comments
0
0

(bump)

Did anyone figure this out? It “suddenly” started happening to me. No idea what I changed in the code to make this start happening… maybe a Windows update is responsible or something. It hangs even if I don’t play any sounds.

I tried a bunch of things. No software channels in FSOUND_Init — this made sound not play at all — I don’t know a lot about audio sw/hw so I’m not sure what this implies. I also tried FSOUND_INIT_STREAM_FROM_MAIN_THREAD (which, incidentally, is not listed in the help index), calling FSOUND_Update from an OnRender function, and called FSOUND_Stream_Close from my end callback function. That worked fine for playing, but FSOUND_Close still hangs. BTW, before this problem manifested, I wasn’t calling FSOUND_Stream_Close, and the system used to shutdown OK anyway.

Some context. None of this should matter, I guess, but you never know.

My sound module is in a DLL, which wraps FMOD. The module/DLL class is a subclass of a base class declared in another module — most of the functions are implemented virtuals. The DLL/module class is instantiated as a static instance in the source file — created when the DLL is loaded with LoadLibrary, and destroyed when it is freed by FreeLibrary. Pretty straightforward. I had the FSOUND_Close call in the class’ dtor initially. Thinking this might be the problem, I put it in a Close() function which I called before FreeLibrary, but this didn’t work either.

Any suggestions?

  • You must to post comments
0
0

FMod is definitely hanging for me, 60% of the time. The irony about the streams is that I never play any with it, I just create it and shut it down when the program is done, mostly because I havn’t gotten to the multimedia part yet. I know fmod is multithreaded, so maybe there is a problem with it’s thread timing.

  • You must to post comments
0
0

Hi Brett,

Over night, the hang turned into an access violation. (?) I noticed a similar report in the forums, but no resolution. I tried the 3.72 DLL you pointed me at, with the same problem. Anyway, if you want to put up a debug version I’d be happy to report my results.

Thanks for your help.

  • You must to post comments
0
0

I used FMOD with mt appz with no pb, it could be something wrong with your code ?

  • You must to post comments
0
0

I’m finally in beta and doing release testing. It takes a bit longer to hang in release mode but it still does, my test basically inits fmod, plays a sound, then closes, it does this many times in a row, but this is all still in my game. It also hangs on close if I play a music file (.it) rather than a wav file.

My next step will be to create a barebones app and see if it acts similiarly, after reading your previous post I also need to check how its being initialized for the first time, I am pretty sure its not in a static constructor, but I’ll double check. I’ve installed debug symbols so the stacks below are pretty good.

While digging for more info I noticed something strange, each time I init then close fmod the number of Handles (as reported by Task Manager) my game uses increases by 2, I must not be freeing something correctly. Does fmod use 1 handle per sound loaded? And would eating up handles cause FSOUND_Close to hang? It doesn’t seem like its related because the last 5 hangs the number of init/closes it takes to hang it seems random, for example here is the number of init/closes to hang it during my last 5 tests in debug mode: 62,50,18,2,47.

Well looks like I’ll have to look for those 2 handle leaks tomorrow, I thought I’d post my info if anyone finds it useful (doubtful I know :))

This is a hang on FSOUND_Close. I am using VC7, XP Pro with latest service packs, DX9.1, SB Audigy 2 ZS Platinum Pro.

5 Threads at hang:
2428 WinMain CSoundEngine::shutdown Normal 0
1460 _MixerCallbackThread@4 7ffe0304 Time Critical 0
4072 CKsTopology::FindRenderPinWithAec 7ffe0304 Time Critical 0
2796 CKsTopology::FindRenderPinWithAec 7ffe0304 Time Critical 0
3792 Win32 Thread _ZwDelayExecution@8 Time Critical 0

Each threads callstack follows

7ffe0304()
ntdll.dll!_NtWaitForSingleObject@12() + 0xc
ntdll.dll!_RtlpWaitForCriticalSection@4() + 0x125
ntdll.dll!_RtlEnterCriticalSection@4() + 0x46
ntdll.dll!_RtlDebugFreeHeap@12() + 0x6a
ntdll.dll!_RtlFreeHeapSlowly@12() + 0x36
ntdll.dll!_RtlFreeHeap@12() + 0xf9
msvcrt.dll!_free() + 0xc3
fmod.dll!1001070d()
Game.exe!CSoundEngine::shutdown() Line 65 C++

7ffe0304()
ntdll.dll!_NtWaitForMultipleObjects@20() + 0xc
kernel32.dll!_WaitForMultipleObjectsEx@20() + 0x8f
kernel32.dll!_WaitForMultipleObjects@16() + 0x17
wdmaud.drv!_MixerCallbackThread@4() + 0x40
kernel32.dll!_BaseThreadStart@8() + 0x37

7ffe0304()
ntdll.dll!_NtWaitForMultipleObjects@20() + 0xc
kernel32.dll!_WaitForMultipleObjectsEx@20() + 0x8f
kernel32.dll!_WaitForMultipleObjects@16() + 0x17
dsound.dll!CList<tagKSDSPROPERTY>::CList<tagKSDSPROPERTY>() + 0x2
dsound.dll!CKsDevice::EnumDrivers() + 0xbb
dsound.dll!CKsTopology::FindCapturePinFromEffectChain() + 0x220
dsound.dll!CKsDevice::Initialize() + 0xea
kernel32.dll!77e94808()
01180000()

7ffe0304()
ntdll.dll!_NtWaitForMultipleObjects@20() + 0xc
kernel32.dll!_WaitForMultipleObjectsEx@20() + 0x8f
kernel32.dll!_WaitForMultipleObjects@16() + 0x17
dsound.dll!CList<tagKSDSPROPERTY>::CList<tagKSDSPROPERTY>() + 0x2
dsound.dll!CKsDevice::EnumDrivers() + 0xbb
dsound.dll!_AhGetCurrentApplicationPath@8() + 0x3
dsound.dll!CKsDevice::GetCertification() + 0xa
kernel32.dll!_BaseThreadStart@8() + 0x37

ntdll.dll!_ZwDelayExecution@8() + 0xc
kernel32.dll!_SleepEx@8() + 0x55
kernel32.dll!_Sleep@4() + 0xb
fmod.dll!10011f5b()

  • You must to post comments
0
0

it could be a problem with my code, it just hung after debugging for a little while. i don’t know if its a bug somewhere or just a side effect from debugging for a while, but debugging shouldn’t cause a hang on shutdown, which leads me to think its a bug somewhere. granted its probably something wrong in my code, but i was just checking to see if its a some common problem that someone might make.

  • You must to post comments
0
0

after making a test app it was still hanging with 3.71 (code below). so then i updated to 3.72 and it seems to be fixed, after 3900 init/closes no hangs, you might still want to check the test app below with 3.71 and catch the hang to make sure its fixed.

[code:1mdrak52]

include <stdio.h>

include <stdlib.h>

include <conio.h>

include <windows.h>

include "fmod.h"

void main()
{
char ch = 0;
int count = 1;

while(ch != 'q')
{
    BOOL bret = FSOUND_Init(44100, 0, 0);
    if(bret == FALSE)
    {
        printf(&quot;FSOUND_Init failed\n&quot;);
        return;
    }

    if(count == 1)
    {
        printf(&quot;FMOD %.2f inited\n%s\nFreq=%dhz samples=%d channels=%d\n&quot;, FSOUND_GetVersion(), FSOUND_GetDriverName(FSOUND_GetDriver()), FSOUND_GetOutputRate(), FSOUND_GetMaxSamples(), FSOUND_GetMaxChannels());
        unsigned int curmem=0,maxmem=0;
        FSOUND_GetMemoryStats(&amp;curmem, &amp;maxmem);
        printf(&quot;memory stats %d / %d\n&quot;, curmem, maxmem);
    }

    FSOUND_Close();

    printf(&quot;FMOD init and closed %d times\n&quot;, count++);

    if(kbhit())
        ch = getch();
}

}[/code:1mdrak52]

  • You must to post comments
0
0

If you are using vc++, i got some weird things when doing long debugging session like using 100 % of my cpu and waiting 2 mins between each mouse click 😕

  • You must to post comments
0
0

ok i just caught a hang, here are the stacks for each thread

thread 4
7ffe0304() <- hung here
NTDLL! 77f5b2e6()
NTDLL! 77f85010()
NTDLL! 77f58b37()
NTDLL! 77f69456()
NTDLL! 77f69d84()
FMOD! 10011dc4()
CSoundEngine::shutdown() line 56
CGame::~CGame() line 204
$E34() + 19 bytes
doexit(int 0, int 0, int 0) line 353
exit(int 0) line 279 + 13 bytes
WinMainCRTStartup() line 212
KERNEL32! 77e814c7()

some code related to thread 4
7FFE0304 ret
7FFE0305 pushfd
7FFE0306 or dword ptr [esp],100h
7FFE030D popfd
7FFE030E ret
7FFE030F mov edx,esp
7FFE0311 syscall
7FFE0313 ret
7FFE0314 pushfd
7FFE0315 or dword ptr [esp],100h
7FFE031C popfd
7FFE031D ret
7FFE031E ret 8
7FFE0321 add byte ptr [eax],al
7FFE0323 add byte ptr [eax],al
7FFE0325 add byte ptr [eax],al
7FFE0327 add byte ptr [eax],al
7FFE0329 add byte ptr [eax],al
7FFE032B add byte ptr [eax],al
7FFE032D add byte ptr [eax],al
7FFE032F add byte ptr [eax],al
7FFE0331 add byte ptr [eax],al
7FFE0333 add byte ptr [eax],al

10011DC4 push 22Dh
10011DC9 push 1003F50Ch
10011DCE push esi
10011DCF push 0
10011DD1 call 10010A86
10011DD6 add esp,10h
10011DD9 pop esi
10011DDA ret
10011DDB cmp dword ptr [esp+4],0
10011DE0 je 10011DEC
10011DE2 push dword ptr [esp+4]
10011DE6 call dword ptr ds:[1003A05Ch]
10011DEC ret
10011DED cmp dword ptr [esp+4],0
10011DF2 je 10011DFE
10011DF4 push dword ptr [esp+4]
10011DF8 call dword ptr ds:[1003A060h]
10011DFE ret
10011DFF mov eax,[1004387C]
10011E04 cmp dword ptr [eax+4],0Ch
10011E08 jne 10011E0D
10011E0A xor eax,eax

my shutdown func contains a call to
FSOUND_Close(); and some other memory freeing stuff.

thread 1
7ffe0304()
KERNEL32! 77e75faa()
DSOUND! 510bfde5()
DSOUND! 510bf96c()
DSOUND! 510bf9d6()

thread 2
7ffe0304()
KERNEL32! 77e7d33b()

thread 3
7ffe0304()
KERNEL32! 77e75faa()
KERNEL32! 77e7d33b()

thread 5
7ffe0304()
KERNEL32! 77e75faa()
DSOUND! 510a1566()
DSOUND! 510bf9d6()

thread 6
7ffe0304()
KERNEL32! 77e7d33b()

thread 7
7ffe0304()
KERNEL32! 77e61bf5()

thread 8
7FFE0304 ret

  • You must to post comments
0
0

i’m not sure that it only happens in debug and not release as i am still developing and haven’t run it many times in release mode. i might be able to start release testing in a few weeks, and I’ll post more info if i find any.

i have no repro case as it doesn’t even happen all the time in debug, sorry.

it very well might be a debug only problem, to ensure this i’ll set up a script to continually load my game and exit with a release build once i start testing. then if i do find something, i’ll see if i can repro it with a barebones app to ensure its not a problem in my code.

  • You must to post comments
0
0

I am also having a ‘hang on shutdown’ issue…..

I am running (up to) three streams sequentially, with the end callback set (and reset after each stream plays)….

The program is supposed to end once all the streams (if they are valid) have played sequentially. Strange thing: It hangs on shutdown (both debug AND release) if there is only one valid stream (ie, it plays it fine, then goes and closes the stream, posts the WM_CLOSE msg to the window, and calls FSOUND_Close()….The window closes, and the application appears to exit, but the process is still running, and has to be terminated via the Task Manager.

Attaching the debugger shows it strictly in FMOD.DLL, and apparently in an infinite loop? In Release, the CPU usage quickly falls to ~0, but the Debug version almost hangs the machine it slows things down so much.

Any ideas on what could be happening?

\HP//

  • You must to post comments
0
0

I found my problem…..my callback was calling a routine that attempted to stop the streams…..So my callback was getting called in a recursive loop.

😳

\HP//

  • You must to post comments
Showing 15 results
Your Answer

Please first to submit.