GLBasic forum

Main forum => Beta Tests => Topic started by: bigsofty on 2011-Sep-15

Title: Crash test
Post by: bigsofty on 2011-Sep-15
Hil,

Can anyone download this simple demo and let it run on your PC, it crashes after about 7 minutes on my system.

Please report back, with Windows version please and error details.

On my PC it takes 7 mins to crash. Win 7 64bit

2,4,8,6 on the keypad, controls the bird, 'W' for wireframe mode.

Thanks all.

P.S. It needs to be kept on top and hold focus.


[attachment deleted by admin]
Title: Re: Crash test
Post by: Gary on 2011-Sep-15
win xp, about 5 minutes in, no error message.

Dont know if it helps but at the time the bird was flying into a mountain and it was struggling to find a path or angle round it
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-15
That's normal its only doing simple sliding collision.

Can you leave it running a longer please? 11 mins was the max I managed till it crashed, 7 mins usually though.


Title: Re: Crash test
Post by: Minion on 2011-Sep-15
Crashed in under a minute for me.

Win 7 (32 bit)
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-15
Error message?
Title: Re: Crash test
Post by: Gary on 2011-Sep-15
what I meant was mine crashed at 5 mins in, window closed, no error message
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-15
Ah I see, thank you, this error is proving to be a real pain to find.  :S
Title: Re: Crash test
Post by: Minion on 2011-Sep-15
Same here, no message just air.exe has stopped working. The budgie was under water at this point.
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-15
Weird, thanks for the test though.  :)
Title: Re: Crash test
Post by: MrTAToad on 2011-Sep-15
Yes, crash after 5 minutes too - Windows 7 x64

as is usual, ntdll.dll is the faulting module.
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-15
Oops, too quick there. That's may'be invalid pointer, I think.
Title: Re: Crash test
Post by: Kitty Hello on 2011-Sep-15
couple of seconds. STACK OVERFLOW. Are you recursively calling a function?
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-15
Yes, the entity system and the quaternion/matrix functions are all recursive. Strange thing though, if I do the same code, via FreeBasic there is no crash. Very strange indeed.

BTW: The bird is controlled by the keypad Ocean, still 10secs is pretty bad.
Title: Re: Crash test
Post by: Moru on 2011-Sep-15
Deep recursive is not good in GLBasic sadly. I had some recursive code that kept crashing on different places on different computers. Rewrote without recursion and it works fine ever since.
Title: Re: Crash test
Post by: MrTAToad on 2011-Sep-15
Sounds like a small stack area... :)

Recursion does work okay - just need to make sure that it doesn't go too far...
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-15
I don't think there should be a great need for a large stack size in the demo, the recursion is mainly used in the parent child relationship within the entity tree(which is basically quaternions and matrices). As the demo does not use any child entities, I am at a bit of a loss. Still, I see no harm in looking for a stack command line option to try it any-ways.

Thanks for everyone's help and suggestions.

Title: Re: Crash test
Post by: Slydog on 2011-Sep-15
You could add a STATIC recursion count variable in the function to limit how deep it goes.
(Add 1 when enter function, subtract 1 when exit function, if > 30 then . . .)
May not work for a release, but may let you know that is the problem.
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-15
Thanks for the tip. I'll add that to my testing.
Title: Re: Crash test
Post by: Ian Price on 2011-Sep-15
Crashed after about 1min on Win7 64bit.
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-16
OK, this is really strange. I cut code down to almost nothing and I am still getting the same error.

What I have here is a simple IMPORTed call to a C function(which does nothing). A main loop that calls it many times. Its basically a cut down version of how the main project runs.

Yet, if you run Task Manager, there is a memory leak and eventually the same crash occurs as in the larger project.

I can't see the problem, I think my limited C knowledge may be failing me here.  :noggin:

Any-ways, if you could download this project, run it with Task Manger visible, to observe the memory leak and wait for the crash.

Oh, you will need to change the include path in the 'cmp' command line option within the project options (Currently -I"C:\Users\Dad\Desktop\test2\src").

Thanks for your help.

[attachment deleted by admin]
Title: Re: Crash test
Post by: MrTAToad on 2011-Sep-16
From my tests, I think SHOWSCREEN is leaking for some reason - I've emailed Gernot about it...
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-16
I don't think it's SHOWSCREEN as I used my own GL 'flip' as part of the debug process and it had the same result. I believe the problem may lay with the IMPORT command itself leaking. Possibly pushing double return addresses onto the stack before calling?
Title: Re: Crash test
Post by: MrTAToad on 2011-Sep-16
Yes, quite possible

I presume the calling convention is correct ?
Title: Re: Crash test
Post by: Kitty Hello on 2011-Sep-17
your C functions are not declared as "__stdcall", so remove that from the IMPORT or add it to the C functions.
Title: Re: Crash test
Post by: bigsofty on 2011-Sep-17
Aha, I had assumed that the default calling convention was stdcall, this was a mistake.

Thanks to Gernot and everyone who helped me in this thread.  :good: