Darwinbots Forum

Code center => Bugs and fixes => Bug reports => Topic started by: Jez on December 23, 2006, 01:36:45 PM

Title: league out of memory error
Post by: Jez on December 23, 2006, 01:36:45 PM
I reran the F1 league for 2 1/2 days before it crashed, then I realised I hadn't updated DB from .9o.  

Downloaded DB .9r...

This time it all seemed to run a bit faster and after only ~6hrs, match 12, DIN2 v Kyushu I got an error, out of memory message. (run-time error 7, out of memory then appeared when I closed first error message)(then I got a send this to MS? error message after closing second message)

Round 1 of 5
DIN2 0 - 11
Kyushu 0 - 7

Error.sim attached in case it provides any clues. I'll rerun the league tonight to see if it happens again.
Title: league out of memory error
Post by: EricL on December 23, 2006, 05:25:01 PM
yea, I've been chasing this one for a while now.  I've got a slow memory leak somewhere.  I don't think it is specific to leagues.  It takes days to hit when running in the debugger, which I am doing now.   Hopefully, I can get it to crash this weekend...
Title: league out of memory error
Post by: Jez on December 23, 2006, 08:19:44 PM
Good to know you have a handle on this problem already.

Took 9 bot entries this time btw, interupted S. Conquistador's climb to the top. I'll do it one more time, in case it is something that leaks more when rerunning the leagues and you have trouble tracing it. I figure if I can get the problem three times in less than six hours each time then an F1 league rerun might be a quicker way to find.

I'm sure I have asked and had an answer to this before    but is there a way I can run this debugger as well and provide you with more specific fault finding info than I am atm? Seems a shame to leave you spending days to find the info needed to fix faults if there is a way to (even partially) share out the workload in some way.
Title: league out of memory error
Post by: EricL on December 23, 2006, 11:41:27 PM
Quote from: Jez
I'm sure I have asked and had an answer to this before    but is there a way I can run this debugger as well and provide you with more specific fault finding info than I am atm? Seems a shame to leave you spending days to find the info needed to fix faults if there is a way to (even partially) share out the workload in some way.
Sure, if you like.  All you really need to do is download the source code and install a copy of VB6.  VB6 is an IDE - an Integrated Development Evironment, the precursor to today's Visual Studio - that means it includes an editor, debugger, compiler, etc. all in one.  So when I say I'm running DB "in the debugger" or "in the IDE" what I mean is that I'm running the program "inside" Visual Basic using the VB interpreter to interpret  the basic source code in real time instead of instead of running the compiled executable like most people do.  This real-time source code interpretation is one reason running "in the IDE" is perhaps 10X slower than running the compiled code and why it can take so damn long to find certain kinds of problems.

All you need to do is use VB to open and load up the DB VB project file (called Iersera.vbp) and hit the play button (or F5) in VB6.  This will start DB like normal, just running "within" VB6.  Now when there's a crash, VB will catch it (usally) and tell you on what source code line the problem is occurring (though often the actual root cause of the problem lies somewhere else and takes soem analysis to determine just why the code is doing what it is doing.)

There are a few additional things to be aware of.  In particular, there are a few places where exception handling logic in the source code should be disabled when running in VB so as to let VB handle the problems instead of the code itself.  Makes for cleaner debugging.  Then there are the many tips and tricks to debugging - breakpoints, watch expressions, etc. - but just getting VB6 installed and the source code running is the big hurdle and the first main step.  Let me know if/when you want more info on the rest of the details.  Cheers.
Title: league out of memory error
Post by: Jez on December 24, 2006, 08:49:47 AM
Where do I find the latest source code pls, only seem to be able to find it for C++
Title: league out of memory error
Post by: Griz on December 24, 2006, 10:14:19 AM
Quote from: Jez
Where do I find the latest source code pls, only seem to be able to find it for C++

source code for 2.42.9r
http://www.darwinbots.com/FTP/Darwinsource2.42.9r.zip (http://www.darwinbots.com/FTP/Darwinsource2.42.9r.zip)

thanks eric ... these are most helpful to have.

if you still need VB6:
http://www.darwinbots.com/FTP/VB6.zip (http://www.darwinbots.com/FTP/VB6.zip)
you may get some error messages when installing ...
ignore them ... it's stuff you don't need.


attempted to get a Debugging page happening on the WIki ...
hoping to have a place where 'seasoned' debuggers could give some
tips to we newbies ...
help us finger out some tricks using VB ...
so we could then help debug ...
but nothing ever came of it.
the page is still there ...
and still a good idea, imo.
http://www.darwinbots.com/WikiManual/index...title=DeBugging (http://www.darwinbots.com/WikiManual/index.php?title=DeBugging)
Title: league out of memory error
Post by: Jez on December 24, 2006, 12:38:24 PM
Thanks Griz

Didn't know we had a wiki page for debugging, I was thinking of collating all the info I get on doing it myself, seeings as I'll need most of it explained to me. I'll try to add the info to that page. How do I get to the place where the source is available? Otherwise I'll have to ask for link for each update.

Eric,

I have VB and source now, have managed to get DB to run in debugging mode and even found one bug, which didn't seem worth bothering you with so ignored it.

Any more tips would be welcome now...  

Edit
Link on how to Bug Report (http://www.darwinbots.com/Forum/index.php?showtopic=874) when you find bug

Edit
Just noticed Ieserva is running .9q not .9r as well. Hope that won't matter.
Title: league out of memory error
Post by: EricL on December 24, 2006, 02:08:04 PM
Cool.  Glad to have you helping out!

The link to the source code download page is at the bottom of the main Downloads Page (http://www.darwinbots.com/WikiManual/index.php?title=Main_FTP).

Please tell me about the bug you found.  Every little fix helps.

So, search the entire source for the string 'error.sim'.  You will find it about 6 times, but there are two lines where the comment portion of the source code line indicates that line should be commented out when running under the debugger.  Just put a single apostrophe at the beginning of the line.  This way, the source code won't try to handle the exception (an 'exception' is just a fancy name for a crash, a divide by 0 or something like that) and VB will get the error.  When an exception does happen, you should get a pop-up dialog that offers to let you debug the problem.  When you hit the debug button, it should hightlight the source code line where the exception is occurring.

Not much difference between 2.42.9q and 2.42.9r.  Pretty sure the memory leak is in both.

Setting a breakpoint on a specific line (the F9 button) and then stepping through the code line by line using F8 can be very useful in learning what is going on.  You can take a look at varible values in the watch window by adding 'watches' or execute your own source on the fly when VB is paused (e.g. print foo) in the immediate window.

Have fun playing around.  Feel free to ask questions!  Happy holidays.
Title: league out of memory error
Post by: Griz on December 24, 2006, 03:11:25 PM
Quote from: EricL
So, search the entire source for the string 'error.sim'.  You will find it about 6 times, but there are two lines where the comment portion of the source code line indicates that line should be commented out when running under the debugger.  Just put a single apostrophe at the beginning of the line.  This way, the source code won't try to handle the exception (an 'exception' is just a fancy name for a crash, a divide by 0 or something like that) and VB will get the error.  When an exception does happen, you should get a pop-up dialog that offers to let you debug the problem.  When you hit the debug button, it should hightlight the source code line where the exception is occurring.
two lines?
I know of one here:

in MDIForm1 (code)
in Private Sub simload
~~~
Code: [Select]
Private Sub simload(Optional path As String)
  Dim I As Integer
  Dim path2 As String
  
 On Error GoTo fine ' Uncomment this line in the compiled version error.sim
~~~
comment this 'On Error' out when using VB and Debugger ...
or it will abort and go save the error.sim.

then remember to uncomment it once you have
located and fixed an error and want to recompile ...
or the recompiled prog won't do it's 'save error.sim'
[not that this has ever happened.  lol]

also ... once the debugger has sent you to the break ...
'hovering' the mouse over variables in the code will
give you their value at that time and place in the execution.
this is helpful in finding overflows or variables out of range.
using this, even I have been able to locate errors on occasion.

again ...
I urge those with VB and Debugging knowledge to use the Wiki
page to document some of the basics in this area.
the advantage of the wiki being ...
it can be continually updated/edited by any of us ...
and is always in the same place ...
not getting lost somewhere in the archive of posts here at
the forum.

I used to have a lot of pages there listing the codes
for various moduals and bug fixes when we were
trying to help out PY debug version 2.37.
they are now out of date ...
but still exist.
here's a couple of them to give you an idea of how
I started to go about it ...
just couldn't get anyone else to use them!
http://www.darwinbots.com/WikiManual/index...tle=Bug_Reports (http://www.darwinbots.com/WikiManual/index.php?title=Bug_Reports)
http://www.darwinbots.com/WikiManual/index.php?title=Senses (http://www.darwinbots.com/WikiManual/index.php?title=Senses)
http://www.darwinbots.com/WikiManual/index.php?title=Robots (http://www.darwinbots.com/WikiManual/index.php?title=Robots)

the idea was to put the code out there so people could
ask questions about it, begin to see how it works ...
and perhaps get interesting in debugging/writing themselves ...
to perhaps start an interactive  VB and/or DB tutorial.
that was the plan anyway.

so maybe something like this would be useful ...
or perhaps someone has a better idea.
like I said, this can all be edited and changed to
make it whatever we want to make it ...
whatever works.
so check it out ...
see what you think ...
see what you can come up with ...
and if people are actually interested ...
then I could see getting behind it again and
investing more time and energy.
Title: league out of memory error
Post by: Jez on December 24, 2006, 03:41:59 PM
You were certainly right about it running slower in VB debugger; watching it reminds me of the old days!  

Bug; (let's see if the reporting is done right

Not having league folder ready when you try to run rerun league, choosing NO when it asks if you want to set up new league folder: Runtime error 5

Forms/LeagueForm(LeagueForm.frm)

Private Sub Write_Challenger()
  If Attacker >= 0 Then
->    Robname1(30).Caption = Left(LeagueEntrants(Attacker).Name, Len(LeagueEntrants(Attacker).Name) - 4)

****

When you say
Quote
search the entire source for the string 'error.sim'.
do you mean search all those windows (that nearly gave my finger RSI closing before I figured out I hadn't made a mistake and there was an easier way to close them) ??  
That's 20k lines of code if I remember right, I'm sure that's not what you meant...  

Quote
Setting a breakpoint on a specific line (the F9 button) and then stepping through the code line by line using F8 can be very useful in learning what is going on. You can take a look at varible values in the watch window by adding 'watches' or execute your own source on the fly when VB is paused (e.g. print foo) in the immediate window.
Causes me lots of problems in the understanding dept, sry but I might need a pre-school prep ABC before getting to grips with what you meant. On the other hand, perhaps when I have played about with it a bit more, I.e. locating watch window, I might get struck by lightning and be granted by the gift of many tongues, you never can tell.

2BH I have a 'learn VB in 21 days' book and a VB v4.0 disc but I never got past chapter 3 'cause my pc got a fresh install and I misplaced the disc for a year or two.   Never did get round to doing it again.  So that, and a little bit of basic C64 programming is the full extent of my experience.

***

If you peeps in the states (or elsewhere) are already into Xmax then Happy Xmas! If, like me, you have a few more hours to wait then Happy Xmas soon!!
(I'm having a happy holiday keeping Santa's glass topped up and taste testing it now and then to make sure nobody poisoned it while I wasn't looking.)  
Title: league out of memory error
Post by: Jez on December 24, 2006, 04:07:12 PM
Griz,

(seeing as you ninja posted me!   )

Thanks for providing a guide to finding one of the error.sim bits, I shall go find that, can't see me wanting to recompile the code so I can forget about it then till next source drop.  

This wiki thingy; I have to admit that when I last returned to DB that updating the wiki was one of the top things on my to do list. Since then it has been buried under lots of other DB related to do things.
People like Eric or PY or Nums, while being the best people to do this, have lots of other things to do as well. It's like the first bestiary list, the one I am now trying to integrate into the existing bestiary, I created it by spending time surfing the old forums and collecting all the posted bots into one place.
While I would love to drag Eric away from his endless bug fixing to do a wiki update; I would also hate the time he spent updating the wiki as time lost for improving the game. (I.e. league improvements)
I think our programming clique are spending their time well, by improving DB, and that the more menial record keeping tasks are something that we can help with. (part of the reason I have offered to help with the bug location, seems silly for us to spend a day or two running a sim only to find a bug if Eric then has to spend the next 4 days locating the same bug so he can fix it!)

If you are volunteering to garner relevant bug location 'how to' advice and, even if it's just a copy/paste to begin, drop it into the wiki page you mentioned then you have my support, we can link it from the forum as well. I hope you do this, it would be cool to have all the advice in one place, even if someone has to come along after and do some minor editing it is quicker than them writing something from scratch.

If we ask the relevant, amateur questions, (in the forum which peeps who know will answer) then I think we are in the best postion to create an amateur 'how to' guide.
If there is anything I can do to help, as a non programming dude, then just say, I would be happy to assist.

Edit
Can I edit the source code while I am running a DB debugger? Or would I have to stop or pause DB first? (few hrs into F1 league rerun under debugger so quick answer appreciated if I have to stop it.)

Edit
What is the immediate window for?
Title: league out of memory error
Post by: Griz on December 24, 2006, 05:19:45 PM
for searching ...

click on the 'binocular' icon on the VB toolbar ...
select what you want to search ... in this case 'project'.
that will step you thru all the moduals.

I found 5 error.sims ...
don't think I missed any ...
the only one seems relevant is the one I posted.

I haven't yet been able to sus out setting breakpoints either.

I hear ya about pulling PY/Nums/Eric away from what they are doing.
it would be great to be able to give them a hand debugging ...
but I'm certainly not any good at tracing back a problem to
it's source.
about all I can contribute is to locate where a variable is out
of range or some such thing ...
take that data and document in which modual and sub and
line it shows up.

the wiki idea was about keeping everything in one place ...
where everybody would have access to it ...
to the code and the changes made ...
which would then allow them to edit the code and recompile
themselves ...
in addition to being introduced to thr DB code and how it works.

how we want to do that ...
is up for grabs ...
I just started in hoping I would get some feedback as to how
we might go about it ...
but I don't think anyone ever even looked at any of it.
there were never any comments or anything ...
and it was a lot of work.
so I just gave it up.

how about this:
seeing we are playing with leagues right now ...
what if I go ahead and put the league code on the wiki?
then we can go thru it and have a place to ask questions
about the code, document bug fixes, ect ...
just as a way to perhaps begin ...
to see what kind of format we might be able to come up
with for debugging ...
as in the process I'm certain we will begin to pick up how
both VB and DB works.
that's what I'm interested in.
and hopefully eric/nums/py/others ...
might also give us some VB/Debugging tips on some page
there as well to get us started.

well ... that's the plan ...
in addition to the Debug page that's already there ...
http://www.darwinbots.com/WikiManual/index...title=DeBugging (http://www.darwinbots.com/WikiManual/index.php?title=DeBugging)
where we can ask debugging questions ...
I'll do a page for League Code ...
http://www.darwinbots.com/WikiManual/index.php?title=Leagues (http://www.darwinbots.com/WikiManual/index.php?title=Leagues)
and we will see where it goes from there, eh?

If nothing else ...
'I' intend to learn something about VB/DB.

ah ... editing ... I would think you have to stop VB to do that.

immediate window and other windows?
I ain't got a clue.

all this can go on the wiki  on the Debugging page ...
I'll put it there as we find out.
and/or anyone who knows can go there and put it in ...
or raise any other questions.
doesn't matter what one puts there ...
it can all be edited.

so yeah jez ...
you can be a big help at the wiki ...
play with learning the wiki code/editing ...
I recall making a 'sandbox' page there for just such 'playing around'.
http://www.darwinbots.com/WikiManual/index.php?title=Sandbox (http://www.darwinbots.com/WikiManual/index.php?title=Sandbox)
Title: league out of memory error
Post by: Jez on December 24, 2006, 06:49:02 PM
Quote
for searching ...
click on the 'binocular' icon on the VB toolbar ...
Honest guv, I knew there was a way to do this and Eric wasn't telling me to hand search 20k lines of code.  

We don't need to trace a problem back to its source, just give them a better starter point. They are the programmers and that's all, hopefully, they need to shorten their job.    (As the estate agents say "Location location location")  

I am all for having a Wiki, that is the first thing I referred to when I wrote my last bots, unfortunately I had to update some of the information and surf the forum's for the updated info before it was useful.
Everything in one place, as I tried to do with the original bestiary, is a great goal. Unluckily we don't have someone who is willing to spend time keeping the 'newbie info' upto date. It was a goal I set myself, upon my return, that I failed to live up to, especially when I got made a mod and got my sticky fingers into the bestiary!  

I think part of the reason your page never got any hits/feedback was that it wasn't linked via a sticky or whatever in a relevant part of the forum. There is a sticky on debugging that I think I linked to earlier, it doesn't contain the info contained in all the links we have had in this topic though. (Can be changed)
I never noticed it when I was searching the forums for 'how to debug' info for instance.

Personally I wouldn't bother with a 'how to understand the code' we can't expect to provide peeps with a VB tutorial. Just give us the info, in one place, of how to provide the most relevant debugging info to the programmers. Understanding VB code is another topic, (should you be brave enough).

I have gave up, long agoe. expecting recognition for the time I have spent modifiying the forums or information, you may have noticed how thankful our programmers are for recognition of the effort they have spent fixing stuff, they don't get much and they spend a lot of time, behind the scenes, fixing it.
I sort of expected to get lots of extra post credits as well, re-sorting the bestiary/leagues, but instead most of my effort has been editing other peeps posts and running ...days long sims that crash before they finish!

Think carefully before you offer to do something for the DB experience, what I volunteered for has already proved to be 10X more work than I expected. An amateur guide to running the debugger is magnitudes different to getting untrained peeps to understand what the code means.

I would love to know that someone took an active interest in adding forum info to the wiki though. I really am hoping that you take an interest in this, so far unfufilled, goal.

Wiki has never seemed a sucessful place to ask questions or discuss things, that has always been more evident on the forums and lacked the proper feedback into the Wiki.

I will play more with the VB debugger, I am running a F1 rerun sim atm, hope that not removing the error.sim bits won't handicap me locating the bugs.

'though the effort might seem vain
it would not be the same
if the people in the wings
did not do their magic things
fix the broken stuff
make it work 'oh well enough'
rescue the idea
make it all more plain'
Title: league out of memory error
Post by: Griz on December 24, 2006, 09:42:28 PM
the wiki stuff is my idea for learning DB/VB myself ...
a place to ask questions as they arise ...
to have it documented/archived, if you will ...
so that would then benefit anyone else who happened
along wondering the same thing.
in fact, wiki's are all about that ...
group participation.
but I'm a novice at it VB and debugging ...
so I need to have a little feedback ...
a little help, ie ... someone with answers
to the questions ...
or I don't get to learn anything either.
so that just never happened there ...
sometimes I don't think anyone knows the wiki exists.
I've linked to it many times in the past ...
but you'd be hard pressed to find them here ...
and never had any indication that anyone ever
even went to look.
a lot of folks did a lot of work there documenting
robot DNA and all the commands ...
Ollj was a major contributor ...
but I don't know if anyone actually used any of it ...
or that people even know it's there.

so I have no problem doing the grunt work of getting
the wiki pages set up so they can be a good source
of information ... and organizing that info ...
but if no one is going to participate in that ...
if no one is going to use it ...
then there's really not much point.

another thing was ...
it was mostly about VB code ...
and as soon as it was decided to go to C++ or whatever ...
interest in VB seemed to end ...
at least up until Eric began sorting it out.
that's what brought me back ...
otherwise it was going to be a dead end for me.

anyway ...
if I can get someone to answer some of the questions
as they come up ... to help some of us get up to speed
on debugging so we can lend a hand there ...
great.

we will see.

we need to get PY interested in 2.4.X ...
I don't think he liked abandoning 2.47 ...
and all of the bots he had worked so hard on.

so it goes
Title: league out of memory error
Post by: Griz on December 24, 2006, 09:46:59 PM
oh yeah ...
1st problem I encountered with looking at
the code for leagues ...
man ... it's all over the place!
so I'm still searching to find where it lives
in the moduals ...
to see if I can get some idea of how it does
everything it does.

so any code snippets you find ... please add them to: http://www.darwinbots.com/WikiManual/index.php?title=Leagues (http://www.darwinbots.com/WikiManual/index.php?title=Leagues)
and I'll try to sort it out as we go.
Title: league out of memory error
Post by: Numsgil on December 24, 2006, 11:29:50 PM
I still use the wiki from time to time to look up things about the DNA.  I definately think a wiki works best as a way to post the final summary of a long discussion instead of as an avenue for discussion.  Forums are very much the other way around.

League code is messy, and it's my fault, and I take full responsibility   It was the first really major enhancement I made to the source code.  Thankfully I've learned alot about software engineering in the interem.

A little off topic, but one of the reasons I like C# so much is that it makes error handling alot nicer.  You can post the call stack for a bug right in the error message.  I could never figure out how to do that in VB, C++, or any other languages I've programmed in.
Title: league out of memory error
Post by: Jez on December 25, 2006, 06:22:41 AM
Quote from: Numsgil
I still use the wiki from time to time to look up things about the DNA.  I definately think a wiki works best as a way to post the final summary of a long discussion instead of as an avenue for discussion.  Forums are very much the other way around.

That's how I use the Wiki as well. I have never used it for discussion and only edited it, usually following questions in the forum, when there was a definitive piece of text I could add. (plus a couple of errors I corrected in the writing 1G bots bit when I was writing a 1G bot). Part of the problem, for me, is that I only surf the wiki when I am looking for a bit of information that I know should be there.
I guess it is the best source for newbies to the game to use, it is clearer and easier to locate info there than here on the forum.

I personally would much prefer if you started a couple of topics in the forum to use as a discussion base, I can link them from the existing, relevant, stickies or make them into stickies in their own right if you prefer.

PY, btw, used to get paid to play with DB because he was so efficient at doing his job and had lots of free time, unfortunately, I think they spotted how good he was and have given him lots of other things to do. I'm sure if he ever gets enough free time again he will return.

Quote
League code is messy, and it's my fault, and I take full responsibility   It was the first really major enhancement I made to the source code.  Thankfully I've learned alot about software engineering in the interem.
Code: [Select]
  'this little snippet insures that Numsgil can run his code alright
  If Left(MDIForm1.MainDir, 15) = "C:\darwinsource" Then _
    MDIForm1.MainDir = "C:\DarwinbotsII"
    
  ' Here's another hack like the above so that EricL can run in VB
  If Left(MDIForm1.MainDir, 51) = "C:\Documents and Settings\Eric\Desktop\DB VB Source" Then _
    MDIForm1.MainDir = "C:\Program Files\DarwinBotsII"
Just made me laugh.  


Plus a little snippet of code I presume is relevant to leagues for Griz (removed as already in wiki)

You missed a chance to tell me what the immediate window does btw Nums' I'm gonna be forced to find out for myself soon.

Edit

Nice work Griz, I've just been browsing the wiki links you gave and noticed you have already started updating.  
Title: league out of memory error
Post by: Griz on December 25, 2006, 12:39:50 PM
Jez ...
left you some messages at http://www.darwinbots.com/WikiManual/index...e=User_talk:Jez (http://www.darwinbots.com/WikiManual/index.php?title=User_talk:Jez)
you should be alerted as to any new messages there when you log in ...
but just in case ... now you know.
Title: league out of memory error
Post by: EricL on December 25, 2006, 03:46:24 PM
Some quick responses:

You can make *some* changes to the source code while DB is running, but you have to pause VB first, either with the pause button or by hitting a breakpoint.  What changes you are able to make may not make sense without a programming background, but basically, while paused, you can change or add things to the source code as long as it doesn't mess up the VB interpreter's state.  It will tell you if it it does.  You can generally do all sort of things to routines that arn't on the call stack, but only certain things to routines that are.  You can't declare a new variable for example in a routine on the stack without halting the program's exectuion in VB but you can make other changes, add lines, new routines, etc..

The immediate window is a mostly a place where you can execute code you write on the fly while debugging - code that is not part of the program, but code you want to execte right then for help in debugging.  Say you hit a breakpoint and want to step through from there, but with a certain set of variables having a certain set of values, say to reproduce a bug further down the line.  Well, instead of waiting for the program to happen upon those values, you can change those varaible values manually in the immediate window e.g. x = 5, y = 10, etc. and then proceed.  The code you type in the immediate window is, well, immediate.  It does not become part of the DB source code - it only executes right there and then is gone.  Also useful for things like printing variable values at breakpoints.

I agree with the discussion of wiki v.s forum.  Wiki is for static, long lived information.  Forum is for dynamic discussion.

Most of the league code is in the F1mode module though some is in with the options form code and a few other places.

Any assistance that helps narrow down a bug is totally appreciated.  The ones with the long repro times are the worst.  If someone catches one of these in the debugger, that is gold since they are so hard and time intensive to reproduce.  Even just telling me what line it occurs on and nothing else helps tremendously.  Non-programmers who are willing to run under VB can really be tremendously helpful even without any understanding of the source code or programming skills.  Some bugs can be environment specific and hard to reproduce execpt on a specific machine.  Getting someone to run DB under VB on that machine can be serious money and save days of debugging elsewhere.  Many thanks!
Title: league out of memory error
Post by: Jez on December 25, 2006, 05:00:15 PM
Thanks for the head up Griz, I wouldn't have seen that for a while if you hadn't mentioned it. Will check it after this post.

Also thanks for the reply Eric, I have located the pause button (VB newbs   ) edited the code as per the location Griz identified and restarted the sim. Hope it didn't need to be saved first. Also hope that is the only line of the code I had to amend.

I am so much more in awe of the work you have done Eric/PY/Nums, having run the sim in VB debugger now, the last league match round took over 8hrs to finish. It is a time waste and a half X10 tracking these niggling little bugs down.

I think I have identified what you mean by 'breakpoint'; Run/break I guess. Still not sure how it would be used. (I surfed the VBv4.0 book and missed any info on using it  ) I don't think I am par for the course when it comes to using the immediate window yet.

Your thanks are appreciated, (new leaue: bug spotting  ) but should I be able to email you a bottle of your favourite tipple (it is xmas) then I would. Plus a bottle to all the others that have contributed to the creation and evolution of DB!  
Title: league out of memory error
Post by: EricL on December 25, 2006, 05:29:36 PM
The two lines I was referring to where exception handling should commented out when running in the debugger are the first list of simload() in MDIForm1.frm and the 6th line of main() in main.frm.  Both lines can be found by searching (Ctlf+F) for the string 'error.sim' and have the form On Error Goto...

You don't need to save before running - your changes will be picked up and respected by the interpreter - but they will be lost if the power goes out or VB itself crashes (happens sometimes).

A breakpoint is simply a place - a specific program line - or certain condition under which you want exectuion to stop.  Put the cursor on a line in the source and hit F9.  Presto, instant breakpoint.  It can be as simple that, which is basically stop here if you ever get to this line" or as complicated as a watch expression e.g. "stop wherever you are if this variable or complicated expression ever has this specific value".  Happy debugmas!
Title: league out of memory error
Post by: Jez on December 25, 2006, 06:07:17 PM
Quote
the 6th line of main() in main.frm

Can't find that .frm, search also only gave me the one reply.

have ' the one line in;
'On Error GoTo fine ' Uncomment this line in the compiled version error.sim
  If path = "" Then
    optionsform.Visible = False
    CommonDialog1.DialogTitle = MBLoadSim

That is all I had to do I hope, not ' the subset.

I reckon another few days before  I hit the overlow bug so no rush

Here's hoping my chipset fan, which resisted both the vacuum cleaner and cotten buds before a good puff sorted it, holds out a little longer...
(/me listens for nasty girinding soundings that preceeded last two graphics crashes)
Title: league out of memory error
Post by: EricL on December 25, 2006, 06:27:52 PM
Quote from: Jez
Can't find that .frm, search also only gave me the one reply.
Also called Form1


Quote from: Jez
have ' the one line in;
'On Error GoTo fine ' Uncomment this line in the compiled version error.sim
  If path = "" Then
    optionsform.Visible = False
    CommonDialog1.DialogTitle = MBLoadSim

That is all I had to do I hope, not ' the subset.
That's it.
Title: league out of memory error
Post by: Griz on December 25, 2006, 06:31:18 PM
Quote
The immediate window is a mostly a place where you can execute code you write on the fly while debugging - code that is not part of the program, but code you want to execte right then for help in debugging.  Say you hit a breakpoint and want to step through from there, but with a certain set of variables having a certain set of values, say to reproduce a bug further down the line.  Well, instead of waiting for the program to happen upon those values, you can change those varaible values manually in the immediate window e.g. x = 5, y = 10, etc. and then proceed.  The code you type in the immediate window is, well, immediate.  It does not become part of the DB source code - it only executes right there and then is gone.  Also useful for things like printing variable values at breakpoints.

good to know. thanks. I'll try to put this all into a Debugging Guide ...
so any other hints/techniques you can share will be appreciated.
you just got to put them somewhere where I can find and gather them.
hmmmm ... I know of such a place.

Quote
Wiki is for static, long lived information.  Forum is for dynamic discussion.
that sounds like a pretty good guideline. however, finding things here on the forum
still leaves something to be desired ...
esp if one, such as a newbie, doesn't already know it exists.
I still have a hard time tracking down messages/topics I KNOW are here somewhere ...
they tend to end up being scattered about in different threads ...
and even then have spent a great deal of time searching for them, sometime unsuccessfully.
so I'm still for making it as easy as possible for those folks who haven't been in on all the
discussions from the beginning, to be able to find their way around ...
and hopefully have them aware that there is also such a thing as the wiki available to them.
some may find it easier and less confusing to work there. I certainly do.
at least the search function here seems to now at least sorta work.
there is a search function on the wiki as well.
 
Quote
Most of the league code is in the F1mode module though some is in with the options form
code and a few other places.
ok. thanks. I'll keep looking.

Quote
Any assistance that helps narrow down a bug is totally appreciated.  The ones with the long repro times are the worst.  If someone catches one of these in the debugger, that is gold since they are so hard and time intensive to reproduce.  Even just telling me what line it occurs on and nothing else helps tremendously.  Non-programmers who are willing to run under VB can really be tremendously helpful even without any understanding of the source code or programming skills.  Some bugs can be environment specific and hard to reproduce execpt on a specific machine.  Getting someone to run DB under VB on that machine can be serious money and save days of debugging elsewhere.  Many thanks!

for those running/searching for those errors in long sims ...
if you run the compiled version and do an occasional save ...
[this can be automatically done, yes?]
then hopefully when an error is encountered and an error.sim
file produced ...
you can then fire it up in VB, ensuring the error trapping is
commented out, load in the error sim or ideally, the save that
you captured which occurred just prior to the error ...
and then run it from there using the debugger.
this may not always work, as there seem to be many varialbles ...
but I have had it do exactly this for me in the past ...
even using the generated error.sim ...
the error still existing ...
which can certainly save a great deal of time debugging.
[remember to save/rename the error.sim to keep on file
for continued debugging, so it isn't overwritten]

onward
Title: league out of memory error
Post by: Jez on December 26, 2006, 05:39:32 AM
Quote
finding things here on the forum
still leaves something to be desired ...

As would finding things on wiki if we moved the discussions over there. It is the act not the arena that causes the chaos!

EDIT

Oh well, I have managed to get an error of sorts, I got fed up with 12 hour long rounds and used the win button, it didn't like that and after declaring one of the bots as winner the competitors disappeared and I am left with just veg.  
Nm, I needed to turn pc off today so I could get at its innards. Will restart this later.
Title: league out of memory error
Post by: Jez on December 26, 2006, 07:26:03 AM
Stopped DB via VB and restarted, tried to rerun league again, it asked where file \ was so I cancelled it, got run time error 75 Path/File access error - Caused by me not adding veg to (empty) bot list before I started league I think

DNATokenizing (Code)

  ->    FileCopy path2, path
    End If
    path = path2
    GoTo inizio
Title: league out of memory error
Post by: Griz on December 26, 2006, 11:17:22 AM
Quote from: Jez
Here's one I caught though, error 76 subscripts out of range IIRC

Was just rerunning the league and clicking the win button to see how easy it was to get the competitors to disapear again

HDRoutines (Code)

-> Open path For Binary As 1

    Put #1, , numOfExistingBots
   
    For t = 1 To MaxRobs
      If rob(t).exist Then

Debug even offers me breakpoints now, solves that issue.

error sim attached although I doubt it's of any use
this is where 'hovering' the mouse over the variables
to see their values can show you one that is out of range.
iow ... numOfExistingBots or MaxRobs or rob(t).exist or even 't'.
if you also report these values, that can help Eric or someone
familiar with what the ranges of the variable should be ...
to see if there is a problem with one of them.

also ... if you zip the error.sim first ... it will only be a few KB ...
much less than the 500+kb you've attached.
that makes it easier to download for me ...
using my *TCAAS isp
[*two-cans-and-a-string which at times is 28kbbs!!!
one, of only a couple, downside to living in the boonies.  ]

will load in your error.sim and poke around a bit.
don't hold your breath.
Title: league out of memory error
Post by: Jez on December 26, 2006, 12:27:53 PM
File zipped, sry didn't think about it.

You'd probably have better luck just re-running the league under debugger and clicking win repeatedly, error sims for leagues don't hold the relevant league info. Only took me a couple of minutes to reproduce. you may notice, specially if you start clicking as soon as the sim starts, the number of wins going up by two for every click.

Anyway, am having go at hovering mouse stunt:

t = 0


    Put #1, , Len(SimOpts.AutoRobPath) =""
    Put #1, , SimOpts.AutoRobPath =""
    Put #1, , SimOpts.AutoRobTime =0
    Put #1, , Len(SimOpts.AutoSimPath) =""
    Put #1, , SimOpts.AutoSimPath =""
    Put #1, , SimOpts.AutoSimTime =0
    Put #1, , SimOpts.BlockedVegs =FALSE
    Put #1, , SimOpts.Costs(SHOTCOST) =23
    Put #1, , SimOpts.CostExecCond =0.004

Hmm, there are lots of these, oops, it didn't want to give me these at first but I think these are the ones you were talking about:  

Num of existing bots =15
MaxRobs  =16

How do you decide what is relevant? Is it just the next few values after highlighted line?
Title: league out of memory error
Post by: EricL on December 26, 2006, 12:56:10 PM
Quote from: Jez
How do you decide what is relevant? Is it just the next few values after highlighted line?
This is where knowing the code and having some programming background starts to be important.  Bascially, VB will detect an exception on a specific line.  That is, something "illegal" is happenign on that line as far as VB is concerned such as an attempt to devide by 0 or in this case, an attempt to reference an array element outside the bounds of the declared arrray size.  If you report the values of the variables on the line in which VB indicates there is a problem, that should be sufficient.  I will also point out that a set of repro steps as you indicate above (e.g. pressing win a ton of times, etc. ) is just as good or better casue it lets me quickly reproduce the problem in the debugger on my machine where I can explore the root cause of the problem interactivly.  A lot of the time, the root cause isn't where the "illegal" operation is being attempted.  Its way back down the line.  

I will look at this as soon as I can.  Right now, I'm still trying to catch that memory leak...
Title: league out of memory error
Post by: Griz on December 26, 2006, 01:01:07 PM
Quote
You'd probably have better luck just re-running the league under debugger and clicking win repeatedly, error sims for leagues don't hold the relevant league info. Only took me a couple of minutes to reproduce. you may notice, specially if you start clicking as soon as the sim starts, the number of wins going up by two for every click.
I had noticed in the past that unless one is VERY quick on clicking ... it jumps up by 2 or 3 wins. need a bit of delay built in there somewhere, eh?

Quote
How do you decide what is relevant? Is it just the next few values after highlighted line?
well, IN the line the debug brought you to, eh? the error occurred/was found ... there, yes?
if the problem can be seen there ...
then troubleshooting is about going back 'upstream' to see where it may have come from ...
but that quickly gets into PY/Num/Eric territory, eh?
seeing/knowing what is out of place, is not quite right , is too ...
but sometimes it might be obvious.
ie ... if  'Num of existing bots' is greater than 'MaxRobs' ...  
or if in a 'from t = 1 to 10 loop, you see t is 0 or 11 ... that might be a hint.
or if a variable is >32768 ... and is defined as a single integer ... than there is a problem.
those are really the only one's I've spotted in the past ... only the most obvious.

but reporting these values for the variables in the offending line ...
is all good data for those who have a chance of knowing what it might mean.

this is the value of having a discussion and/or page on Debugging ...
where those with knowledge/experience can help those of us who do
not yet possess those skills but who are willing to learn ... do so ...
so we can then return the favor and help out on some level.
you know ... make it a real cooperative effort ...
sharing as much info as possible.

in fact ... that might be a good idea ...
to have a thread here just on Debugging ...
which I will also then mirror on the wiki ...
archiving the relevant info.
Title: league out of memory error
Post by: Jez on December 26, 2006, 01:22:59 PM
Quote from: EricL
I will look at this as soon as I can.  Right now, I'm still trying to catch that memory leak...

Np there, I was hoping that using the win button would allow me to track it down a bit quicker. I'll redo the league debug rerun again now my pc has stopped creaking and groaning.

Griz, if you want to start a thread with the info you have gathered so far I'll sticky it for you.
Title: league out of memory error
Post by: Griz on December 26, 2006, 04:00:17 PM
Quote from: Jez
Np there, I was hoping that using the win button would allow me to track it down a bit quicker. I'll redo the league debug rerun again now my pc has stopped creaking and groaning.

Griz, if you want to start a thread with the info you have gathered so far I'll sticky it for you.

I don't know what that means?

there is already page on the wiki ...
where I'm gathering debugging info as I find it:
http://www.darwinbots.com/WikiManual/index...title=DeBugging (http://www.darwinbots.com/WikiManual/index.php?title=DeBugging)
it's just a work in progress ...
anyone is free to add to it right now ...
will see how to organize it once I see what we have to work with.
suggestions welcome.