Page 4 of 5

Re: Grimrock.exe stopped working

Posted: Mon Sep 24, 2012 6:37 pm
by cromcrom
It's so weird. I have had a 4 hours crashless session, same dungeaon, same every thing. It might have something to see with Steam and steam cloud ?

Re: Grimrock.exe stopped working

Posted: Mon Sep 24, 2012 7:13 pm
by JohnWordsworth
If there is anything more I can send you Petri, just let me know. I'm happy to install the Windows 7 SDK with the debugging tools and send you any profiling / debugging reports that I can generate from here if it's of any help to you.

Thanks for your perseverance in hunting down these little issues. It's this attention to detail and wonderful support of the community that makes you guys excellent.

Re: Grimrock.exe stopped working

Posted: Tue Sep 25, 2012 9:37 am
by petri
Argh, still haven't found a way to reproduce this. I'm pretty sure it happens only when a dungeon has been loaded, preview has been started and then stopped. I wonder if the bug happens only with a certain dungeon. Can anyone confirm the crash with the default new dungeon?

I.e. does it crash with the following sequence:
1) start grimrock
2) open dungeon editor
3) create a new dungeon
4) start preview
5) stop preview
6) wait

Re: Grimrock.exe stopped working

Posted: Tue Sep 25, 2012 11:13 am
by JohnWordsworth
Hi Petri, I wonder if it only happens with Dungeons that were created using a previous version of the Dungeon Editor? I think I'm still loading up an old Dungeon that I started a couple of versions ago. I can confirm that I made it crash at one point after loading a dungeon but without ever starting preview though.

I'm afraid I'm not working from home today, but I'll test it this evening with a fresh dungeon following your instructions above and let you know what the results are!

Re: Grimrock.exe stopped working

Posted: Tue Sep 25, 2012 11:56 am
by petri
Ok, I got a repro now but unfortunately I still have no clue why the dll gets unloaded. Seems almost like a bug in XAudio2 itself.

Re: Grimrock.exe stopped working

Posted: Tue Sep 25, 2012 12:03 pm
by Shroom
I can get it to crash do nothing except start a new dungeon.

A google of XAudio2 does show that it crashes in other games when the dll is unloaded. I can also set up a number of VM test systems if it would be of any help. :ugeek:

Re: Grimrock.exe stopped working

Posted: Tue Sep 25, 2012 3:09 pm
by petri
I just spent almost the entire day tracking this down. What I found out really surprised me. Apparently there is a bug in XAudio2 or Windows COM system which causes the XAudio2 dll to be seemingly randomly unloaded even when it is still in use! COM has a low priority thread which scans for unused DLLs in the background, and if it finds one it adds it to "clean up list". If the dll remains in the clean up list for 10 minutes, it is unloaded. The problem is that XAudio2 dll should not be cleaned up in the first place because it is used by the app.

Microsoft knows about this bug and one of their people even insists that XAudio2 is not meant to be used on Windows, even when XAudio2 is now a system component in Windows 8 :roll:

More details if you are really interested:
http://social.msdn.microsoft.com/Forums ... 26a3221f91

Luckily there is a nasty workaround which can be used to force the dll to stay in memory. I'll add it to next version so let's hope this fixes those nasty crashes.

Re: Grimrock.exe stopped working

Posted: Tue Sep 25, 2012 4:24 pm
by Komag
NICE! Good hunting there. glad there is at least a workaround, however crappy it may be.

Re: Grimrock.exe stopped working

Posted: Tue Sep 25, 2012 4:26 pm
by petri
The "nasty workaround" is in the just released beta 1.2.10.

Re: Grimrock.exe stopped working

Posted: Tue Sep 25, 2012 6:09 pm
by Shroom
Well 'nasty' or not, it works! Nice Work :)

I have had the editor open longer than ever before and its still going \o/

Am a happy bunny.