Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / DBP crashes while ending

Author
Message
ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 12th Mar 2014 14:14 Edited at: 12th Mar 2014 14:16
I've got a really irritating problem with a project I'm working on.. in certain situations (i.e. not always, but in specific cases - I haven't found out yet when exactly, but I'm able to reproduce the problem), ending the game (no matter if I end it regularly by executing DBPs end command or by pressing ALT+F4) results in that typical Windows Error. I never had that before, and given the code has about 8,000 lines and I have absolutely no idea how to debug this, I'm kind of lost.

All I could do so far is make sure all the arrays have a reasonable size when ending the game, because I assumed freeing a huge amount of memory might cause DBP to be working for quite a while, resulting in Windows suspecting something is wrong, leading to that error. But all the arrays are fine, there doesn't seem to be anything wrong with the memory usage.

I assume it might be possible that one of the 3rd party plugins interferes with DBP in some way. For instance, if I call d3d_starttext but not d3d_endtext (or similarly as begin sprite render without as end sprite render), that might cause trouble. But I'm pretty sure this doesn't happen anywhere in the code, especially because this would most certainly cause problems during the game as well and not just when ending it.

Has anyone had similar experiences? Or do you have any idea how I could find out what exactly causes DBP to crash? Any help would be greatly appreciated.

And before anyone asks - yes, I'm sure it's the end command that leads to the crash and not anything else in the code. The last command before the end definitely gets executed, and the first one after the end does not.

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Mar 2014 15:16 Edited at: 12th Mar 2014 15:23
Quote: "And before anyone asks - yes, I'm sure it's the end command that leads to the crash and not anything else in the code. "


I get that from time to time as well - and I'm sure it's something other than "end" in the code that causes it. It may only happen when I "end" the program (haven't actually tested that myself) - but only because something else is present in the code.

I vaguely recall Lee mentioning a bug in the way DBPro exits in some circumstances. With luck it'll be one of things that gets fixed while he works on FPS(R).

I haven't seen it for a while - although because it only happens on exit I don't really care so I might not notice it I agree it's annoying if you're trying to produce a commercial project or a demo for other people.

Edit If you're sure it's execution of the end statement that causing this why not exit some other way? [Actually my recollection is that it's the act of ending the program not the presence of the end statement that causes this. I'll try to remember to check when I next encounter the issue.]

Do you have a simple short snippet which shows the problem?



Powered by Free Banners
ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 12th Mar 2014 15:57
Thank you Gandalf.

Indeed the end itself probably isn't the problem. The cause has to be something else, I just wanted to point out that the crash occurs exactly when the end statement is executed.

Quote: "If you're sure it's execution of the end statement that causing this why not exit some other way?"


What other way is there to end the program? But as I said, ALT-F4ing out of the game still leads to the same crash, so it's probably not the command itself but simply DBP trying to end the application in general.

Quote: "Do you have a simple short snippet which shows the problem?"


Unfortunately not... this is the first time ever I've experienced this, and it would be very hard to reduce the 8000 lines of code to a minimal reconstruction of the problem. Especially because I can't even always reproduce the error with the current code. It happens after I've played for a while and passed a certain (seemingly arbitrary) point - it almost never happens before (just rarely), and it almost always happens after that point (but not every time). So it's really hard to tell what factors might be responsible.

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Mar 2014 16:11
Quote: "What other way is there to end the program?"


Esc key?

Anyway, I'll keep an eye out for this and see if I can narrow it down when I next encounter it.

Quote: "But as I said, ALT-F4ing out of the game still leads to the same crash"


Missed that, sorry.

Quote: "so it's probably not the command itself but simply DBP trying to end the application in general."


That's been my impression too but then I haven't checked this out systematically yet.

I'll also keep a look out for other comments on this issue. I'm sure I've seen some somewhere.



Powered by Free Banners
tiffer
19
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 12th Mar 2014 20:10
If it's a windows error it might be an issue with your installation of Direct X. I had some really severe windows error messages not long ago and it was fixed by reinstalling direct x.

Cwatson
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 12th Mar 2014 21:10 Edited at: 12th Mar 2014 21:11
Are you using DarkNet and running on Windows XP?

Edit: Actually, it would help if you could identify all the 3rd party DLLs you are using

ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 12th Mar 2014 22:01
I'm running DBP 1.0761 on Windows 7 Professional 64 Bit. The DLLs I'm using include d3d_func, Image Kit, Matrix1 Utils (only the draw to image command) and Advanced Sprites. I believe that's it.
I've used all of these plugins in similar ways in other projects though, without any problems whatsoever (apart from a few instances where d3d_func seemed to cause occasional seemingly random crashes during startup (before even the first command of the code was executed), but never when ending the program).

Actually DarkNet was involved in an earlier build of the game, but all darkNet commands are commented out currently (which really is the case, as the code compiles despite me not having the darkNet dll in the respective directory atm), so I doubt there is a relation. However, are there known cases of DarkNet causing such behaviour?


@tiffer - while I assume this is possible, the same problems exist on the machines of three different testers so far, and for all of us this is the only executable showing the described behaviour. So even if a DX reinstallation really fixed the problem - there surely must be a way to solve the problem in DBP. At least I hope so.

Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 13th Mar 2014 02:06
You could check to see if it render related by waiting before you exit/end. Since rendering is asynchronous, it doesn't actually start/stop when you push the job down the line to the driver (d3d_starttext -> d3d_endtext), rather it gets done sometime after the close. You would hope sooner rather than later, but ya never know. So it might be possible it's trying to complete some render task, while the main program is ending.


Also, if you're using any sub-classing (hooking into) of the DbP window, or backgound threading then this could also be another cause..

GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 13th Mar 2014 02:49
Perform these steps:

Open your control panel
Choose "Action Center"
On the right, find the "Maintenance" section, and click the arrow on the right to show the details below it
Click "View Reliability History"
Click on today's date, and it will show all errors and program crashes.
Find your app and double click it. It will open the event viewer and show the details for that crash. It should also specify a "Fault Module Name" which should narrow down the problem.

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Mar 2014 10:42
@GIDustin

Interesting. I didn't know you could do that. I've bookmarked it. Thanks.



Powered by Free Banners
ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 13th Mar 2014 11:30 Edited at: 13th Mar 2014 11:37
Interesting indeed! It sais the module is DBProImageDebug.dll.

@Kevin Picone, you mean a simple wait command before ending the program? I'll try that.
Edit: Just added a loop that waits for three seconds just before the end command, but that doesn't seem to affect the crash unfortunately. Furthermore I made sure to call draw to bitmap 0 before, just in case. Still the same.

GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 13th Mar 2014 14:07
If I had to make a random guess, which is pretty much all we can do without the entire source, I would guess it is something with Image Kit or Advanced Sprites. The DBPro image DLL, although it uses more memory than it should, has never been an issue with me and I have made several 2D applications running on every Windows OS. I don't use Advanced Sprites or Image Kit, so it is easy for me to throw the blame there.

Would it be a huge hassle to REM out all commands from each of those plugins one at a time and have the game still work long enough for a test drive?

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Mar 2014 14:35
Quote: "I don't use Advanced Sprites or Image Kit, so it is easy for me to throw the blame there."


I don't have those plugins but I sometimes get the same problem ShellfishGames has. Unfortunately I can't recall which of my hundreds of demos has that problem. But I'm on the lookout now.



Powered by Free Banners
tiffer
19
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 13th Mar 2014 15:00 Edited at: 13th Mar 2014 15:01
If you're really desperate you could try using resource monitor to record what threads are being used by what.

Edit: possibly only on win 7 pro

Cwatson
ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 13th Mar 2014 15:44
Quote: "Would it be a huge hassle to REM out all commands from each of those plugins one at a time and have the game still work long enough for a test drive?"


Certainly worth a try, I'll do that tomorrow.

Quote: "I don't have those plugins but I sometimes get the same problem ShellfishGames has."


Are you using the d3d plugin or matrix1? Given d3d caused some trouble before in a few of my earlier projects, maybe it plays a role here as well.

If these things don't help, maybe DBP 7.7 does, so I might give it a shot.

GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 13th Mar 2014 15:45 Edited at: 13th Mar 2014 15:55
I do use D3D and Matrix 1. What version of D3D are you using? The only real way to see that is to view the properties of the DLL file.

Edit: Here is the d3d DLL I am using. It was one I custom made using Cloggy's source. You can try it to see if it helps, but backup your old version first.

Attachments

Login to view attachments
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Mar 2014 16:34
I tried downgrading to U7.61 to see if that helped reproduce the problem. I've just spent a merry hour testing loads of old demos, both mine and TGC, fixing a few bugs/improvements left over from the past and have so far failed to reproduce the problem.

The only crash I encountered was nothing to do with the end statement - the demo didn't get that far and I never did find the cause because I found a better way of doing the same thing anyway. For those who are interested the Action Centre stuff says this:



I've no idea what the offending DLL (igdumd32.dll) does - and there seem to be several different versions of it on my machine (including two inside C:/Windows/SysWOW64 ). Anyway, that has nothing to do with the present problem .



Powered by Free Banners
ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 14th Mar 2014 14:55 Edited at: 14th Mar 2014 15:19
It really does seem to be d3d causing these problems. I commented out all d3d commands and wasn't able to reproduce the error since.
I'll try to narrow it down further now.. whether it's a certain type of command, or if a d3d_init before ending the program maybe prevents the crash.
Thanks for the DLL GIDustin, I'll try your DLL, too.

And thanks as well GG, I hope you're not wasting too much of your valuable time on this issue.


Update: It's still quite mysterious. It does indeed seem to be d3d_starttext/d3d_endtext (which seem to be called correctly throughout the whole code) - strangely enough though, the game also crashes when these commands are used only in the game's main menu, and I end the game after playing for a while - but still, it only crashes in certain parts of the level (although this should have zero relevance for d3d, as the d3d commands are only called within the main menu).
Anyway, it seems that GIDustin's dll solves the problem, I've run a few tests with it and the game didn't crash. If I find out anything more, I'll let you know...

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Mar 2014 16:04
Quote: "I hope you're not wasting too much of your valuable time on this issue"


No problem. We all encounter these weird problems from time to time and we happily try to help each other out. Besides, there's nothing like a challenge - or an excuse to dust off some old demos.

It's interesting that D3D is involved. Although I have that I've hardly ever used it which may explain why I haven't seen this problem for a while (assuming it's the only culprit of course).



Powered by Free Banners
ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 17th Mar 2014 16:34
Unfortunately I was wrong, the problem's still there, the game just crashes less frequently and seemingly in other places than before.
Weird..

Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 17th Mar 2014 18:24
Oh dear. I experienced something like this when working on Terrain AI. When running Dark AI in debug mode; displaying any debug information; I get a windows error on exit.

Most likely not your fault; something going on in a plugin.

GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 18th Mar 2014 00:51
Quote: "Unfortunately I was wrong, the problem's still there, the game just crashes less frequently and seemingly in other places than before.
Weird.. "


Does the error message in the Action Center still state the same DLL?

ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 18th Mar 2014 01:32
Quote: "Does the error message in the Action Center still state the same DLL?"


Yes, it's still the DBProImageDebug.dll.

CSL
16
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 18th Mar 2014 01:55
It's a longshot but try registering the dll using regsvr32.exe

For a 64-bit Win OS:
%systemroot%\System32\regsvr32.exe DBProImageDebug.dll

or

For 32-bit
%systemroot%\SysWoW64\regsvr32.exe DBProImageDebug.dll

CSL

Login to post a reply

Server time is: 2025-05-15 04:12:49
Your offset time is: 2025-05-15 04:12:49