like the others reporting in this forum, I’ve suffered the error (crash) when calling FMOD::System::release().
It always failed at the same location. With your latest dev build, I’ve been able to trace with more details the location of the problem (thanks to your debug libs):
in this function, there are a number of calls to (in order):
then a series of tests on variables rooloffscale, distancescale, dopplerscale
then erase the struct dsListenerParams
then a call to a function (virtual function?) that leads to an error message if failed:
"IDirectSoundListener::SetAllParameters returned errcode %08X"
then call FMOD::ChannelPool::getNumChannels
then call FMOD::ChannelPool::getChannel (in a loop)
right after the loop that call getChannel above, there is a call to a function (in the debugger, this+0x244 seems to be a pointer to a class, which seems to have a vTbl and the function calls this vTbl+0x44). The vTbl seems to be pointing to 0! maybe an error (a class without a virtual destructor somewhere)??
So the code fails at this exact location everytime!
with fmodexD.dll, this is happening at 006C8F97 (DLL base listed at 006C0000 in the debugger).
Hope this helps!
- CptLucky asked 11 years ago
[quote:yoyquus8]it is unfortunate we don’t have new report from Billp who’s experiencing the same issue[/quote:yoyquus8]
Apologies… I tried to update to a newer version, it didn’t "just work" so there was a delay, which was just enough time for a "high priority interrupt" to drag me to another project 😡
Side note for one second… The "didn’t just work" was that Eventsystem::getGroup returns an "Invalid Parameter" with the newer versions, and it used to just work. Now that I’m back into this, I found that EventSystem::load has changed and has a 3rd argument, the EventProject pointer.
If I use Event[b:yoyquus8]Project[/b:yoyquus8]::getGroup, my code is back to operational.
OK, let me first admit that I haven’t looked through the forum for an answer, but let me just ask: Does EventProject now [i:yoyquus8]supercede [/i:yoyquus8] EventSystem::getGroup()? Or should BOTH still work?
I am now using 4.04.51
Back to the DLL issue…
[quote:yoyquus8]It turns out after experimenting for a month with this that the root of the issue is this: when FMOD is used (init/loop/release) from a DLL code, which DLL is used by an application .exe, then, it exhibit this crashing issue. [/quote:yoyquus8]
I am just now back to getting my code working under 4.04.51, but I noted that the very first run of this code as a DLL failed in the same place… Sound::release().
I am using VC++ Express, FWIW. The non-DLL version of the code runs fine (basically my previous report, all over again), and the DLL version runs FINE, but just is not happy with release().
I will experiment some more and report any findings.
does anyone have a simple project that reproduces this issue? When we do this with our tests there are no crashes, so there is something you guys are doing different to us, though i’m trying everything.
edit: i may have reproduced it i’ll keep you posted.
now if I call again FMOD::update(), it still crash of course, but back at the same location as initialy posted, right before the call to direct sound CommitDeferredSettings
I’ve forgotten to add: the windows message I get is:
Unhandled exception at 0x00708f8a (fmodex.dll) in myapplication.exe: 0xC0000005: Access violation reading location 0x02b37640.
I’ve no doubt all is fine for everyone, but it seems I’ve found a code path for at least any FMOD DLL for the past 2 months to lead to a crash ALWAYS at the SAME LOCATION, right before the call to CommitDeferredSettings.
I hope all this information will help you track it down. It seems I use pretty much standard init code?!?
Hope this helps!
On your side note, with the addition of EventProject, EventSystem::getGroup paths now need to include their EventProject name as well e.g.
Same goes for EventSystem::getEventGroup.
our error reportting system shows a crash like this, too. I haven’t been able to locate where fmod crashes in these situations and we are not able to reproduce it on our developing and testing machines as well. It’s just some sheldom effect that occours on systems of our users. The only thing I know is that we got no such reports from Linux and Mac users only on Windows.
- slajar answered 11 years ago
Yeah, Brett that appears to have fixed the problem I was having. I had a way I could reproduce the crash, and it didn’t happen once in the 10 times I tried it with v37.
Sorry I couldn’t have been more help with an example project, but it would have been very difficult to extract something meaningful for you for this one.
Thanks again Brett, much appreciated, and great work!
it is still crashing with .37 and it looks like it is the same error. It will be hard to provide a "sample/test" project though as our soundmanager class is tied up with many other things in our project.
Is there any "trace enabled" "debug" version I could try for you? from the "trace" I’ve done in the debugger, it should be quite "locatable" in your code: either your code is calling a virtual function for class, which pointer to its vtable in the other class is 0, or, you are calling a pointer that has been set to 0 before. For the later, a simple test of the pointer before calling the function should help trap the issue, in the former I suspect a destructor called too soon somewhere like this:
m_ptr_to_my_class = 0; <—- missing line leaving something not expected.
Hope this helps!
no, not from a different thread, the same thread. I was mentioning "thread" as the update loop of the application is in a thread. BUT, when I don’t call FMOD:Update() at all, so just starting it, and when the application quits closing it with the C++ code above, it crashes as well, in the same function, just at a different location (right in the code block before the other one).
This is all taking place in a code of yours that call "direct sound update" when it closes.
Let me explain the software architecture as it is implemented right now in order to make sure all is correct thread wise for you:
1) application.exe binds to an application.dll
2) application.dll contains the code to create 1 instance of our main class
3) the main class uses 1 instance of our soundclass
4) our sound class init the FMOD (code above) in a function "init" called by our main class when the main class is called to init from the DLL which is called to init from the .exe
5) the sound class play sounds, and closes FMOD in its destructor
6) the application tells the DLL to create a thread, and this thread will call an "update" in our main class, that will also call the sound class update which call the FMOD::update(). NB: EVEN WITHOUT calling FMOD update() at all, it crashes on system->release() BUT at a different location
7) instead of asking the DLL to create an update thread, the application can call an update() function in the DLL that directly calls update of the main class that will call update of the sound class that will call update of FMOD. Usually done from a windows timer in the .exe. In this case, FMOD ALSO CRASHES (no additional thread involved)
8 ) the exe can tell the DLL to close, and then the DLL closes the main class which call the sound class to close which call system->release()
I think it is safe to say there is no thread pbm in this architecture, but you certainly have more experience in the matter.
Obviously, again, cannot you add a simple "if (my_variable !=0) before calling the function of your class? because it looks like it is the issue. I don’t have YOUR source code, but does it makes sense when I read the information I have that I assume there is a realchannel class in your code, with virtual functions? it looks like the vfptr table is pointing to "non valid" memory for the code somewhere.
I’m quite stuck. However, maybe I don’t need to call ->release() at all? question: when the .exe call the .DLL to tell it to close, it delete the instance of our main class, and the DLL unloads and the .exe exits. At this stage, I would assume FMOD DLL also unloads from memory and your destructors properly delete all allocated memory? so if I don’t call ->release() at all, there shouldn’t be any memory anyhow nor locked ressources isn’t it?
Just let me know how the best I could help.
The best way you could help is to find out what it is you are doing that makes that crash happen. It sounds like you can reproduce it easily, so there is something inbetween the init and release causing it.
Putting some if statement around a realchannel pointer is -not- a solution when 99% of the time it works. You make it sound like it always does this by simply calling init and release after each other, but this is not the case. So what in between causes it? You should be able to comment out your whole application inbetween the init and release until you find the cause.
[quote:3unmbt2x]like the others reporting in this forum, I’ve suffered the error (crash) when calling FMOD::System::release()[/quote:3unmbt2x]
I’m not sure if this will help or confuse the issue, but here goes.
I’ve been working on & off with a demo I’m doing which loads & plays a couple sounds and does some mic recording. Well-behaved, no crashes.
I was compiling it as a stand-alone WIN console app.
I wanted to call the demo from a larger app, so I added __declspec(dllexport) to my classes and made a DLL out of it.
When exercised from the parent app, it works fine – just like it did with the static compile. Except…
It crashes on Sound->release().
And if I comment that out, it crases on EventSystem->release().
I ran to the forum to see what’s up and came across this thread… this seems related.
If I leave ALL my code intact and just compile it stand-alone, it’s fine. But as a DLL it crashes at the release() points.
I’m using 4.03.30.
I’ve been getting problems when calling release recently too (technically through EventSystem::release, but that calls system::release anyway IIRC). I can get it to crash fairly often with a specific sequence of actions in my code (not really possible to extract an example to send though I’m afraid), although if I do a Sleep(someSmallTime) or such like before the release, it doesn’t crash.
Of course the sleep could be hiding any number of sins, but is it necessary to have a delay between stopping and unloading sounds/events and calling release?
the error is still at the same location, but I have a couple more info to trace! Here is a dump of the debugger. The error is at 00708F8A with the mov eax, dword ptr [esi] with esi in this session beeing 0x02C97640.
00708F39 call FMOD::ChannelPool::getNumChannels (757CEBh)
00708F3E cmp eax,ebx
00708F40 je FMOD::OutputDSound::update+200h (708F47h)
00708F42 jmp FMOD::OutputDSound::update+278h (708FBFh)
00708F44 mov dword ptr [numchannels],ebx
00708F47 xor edi,edi
00708F49 cmp dword ptr [numchannels],ebx
00708F4C jle FMOD::OutputDSound::update+23Ch (708F83h)
00708F4E mov ecx,dword ptr [esi+3Ch]
00708F51 lea eax,[channelreal]
00708F54 push eax
00708F55 push edi
00708F56 call FMOD::ChannelPool::getChannel (757D5Ch)
00708F5B cmp eax,ebx
00708F5D jne FMOD::OutputDSound::update+278h (708FBFh)
00708F5F mov ecx,dword ptr [channelreal]
00708F62 cmp ecx,ebx
00708F64 je FMOD::OutputDSound::update+272h (708FB9h)
00708F66 cmp dword ptr [numlisteners],1
00708F6A jg FMOD::OutputDSound::update+22Dh (708F74h)
00708F6C test word ptr [ecx+46h],420h
00708F72 je FMOD::OutputDSound::update+236h (708F7Dh)
00708F74 mov eax,dword ptr [ecx]
00708F76 call dword ptr [eax+60h]
00708F79 cmp eax,ebx
00708F7B jne FMOD::OutputDSound::update+278h (708FBFh)
00708F7D inc edi
00708F7E cmp edi,dword ptr [numchannels]
00708F81 jl FMOD::OutputDSound::update+207h (708F4Eh)
00708F83 mov esi,dword ptr [esi+244h]
00708F89 push esi
00708F8A mov eax,dword ptr [esi]
00708F8C call dword ptr [eax+44h]
00708F8F test eax,eax
00708F91 je FMOD::OutputDSound::update+276h (708FBDh)
00708F93 push dword ptr [hr]
00708F96 push offset string "IDirectSoundListener::CommitDefe"... (790ED0h)
00708F9B push offset string "OutputDSound::update" (790F14h)
00708FA0 push 5CDh
00708FA5 push offset string "c:\pc\src\sound\fmod4\win32\src\"... (790B88h)
00708FAA push 1
00708FAC call FMOD::Debug (70ED5Eh)
In short, it is in your outputDSound::Update, there is a call to get the number of channels, and then a loop to check each channel and if the channel is "real", then it must do something prior calling IDirectsoundListener::CommitDeferedSettings().
Also interesting, the debuger locals show a "this" points of type FMOD::OutputDSound * const with a value of 0x3F800000 which in fact does not look to be a pointer (it is 1.0f float in IEEE hexa).
Another debugger hint makes me think the issue is with the class "channelreal" wich is has virtual functions, and with a __frptr which cannot be evaluated (so my hinch in my previous post could proove to be the reason of what is happening).
NB: I’m not using 3D sound, just normal sound.
Hope this helps! this is so very well located in the code that I see no reason we can’t solve it once for all!
And the call stack to go to this error is:
FMOD::SystemI::release() Line 3470
FMOD::SystemI::close() Line 5086
FMOD::SystemI::closeEx(unsigned char calledfrominit = 0x00) line 5142
FMOD::SystemI::update() Line 5480
FMOD::OutputDSound::updateCallback(FMOD_OUTPUT_STATE* output=0x003586b0) Line 2441
FMOD::OutputDSound::update() Line 1483 + 0x7 bytes
Hope this helps!
I’m using 4.03.30.
That is an extremely old version so unfortunately that doesnt help at all, it could be any manner of things that were fixed. The current version is 4.04.35
Please login first to submit.