Page 2 of 2

Re: My bot have lag on internet game.

Posted: 15 Sep 2014, 06:12
by abma
i can reproduce the crash "Failed to allocate memory" now, not sure why it happens atm.

Re: My bot have lag on internet game.

Posted: 03 Oct 2014, 09:33
by playerO1
It may be same "out of bounds" bug in C interface.
What I mean, example: array A from 10 element(0..9), you may write on 10 element A[10]=123; But A[10] may adress on other wariable.

Maybe bug in the next line: https://github.com/abma/spring/blob/dev ... ge.c#L1153 ? I'm not know nice C++/C, but not undestand, what will be doing programm, if it will be using this last element "size_t firstFree = skirmishAiImpl_size;", if bounds on cicle "sai < skirmishAiImpl_size;". Hm... Or whay need do "firstFree = skirmishAiImpl_size;" if this wariable always will be rewrite?
p.s.: AI Interface from Spring 94.0 not have this bug.

Re: My bot have lag on internet game.

Posted: 04 Oct 2014, 19:07
by abma
i've created a bug report about this: http://springrts.com/mantis/view.php?id=4565

but i'm not sure if i / someone else will fix it soon.

when checking code you should use the official source code repository which is here:

https://github.com/spring/spring/blob/d ... ge.c#L1154

this file seems to be different in comparison to the fork of abma.

java ai interface code recently had changed, not sure if related.

i guess this code does reuse existing slots for ais, i don't see a bug there as index is checked for bounds.

Re: My bot have lag on internet game.

Posted: 05 Oct 2014, 09:22
by playerO1
Abma, I today check again cycle (for) on Java, then check on C++. And now I realy see bug on index using.
Example, what you think of result of next code:

Code: Select all

int i;
for (i=0; i<10; i++);
printf("i=%i",i)
You think on terminal you will be see "i=9" or "i=10"?

I see on code at line 1153 variable "sai" using for cycle. After cycle (I see change - no break on spring/spring repository) this variable always will be equals "skirmishAiImpl_size". Then at line 1163 do check on null "if (skirmishAiImpl_className[sai] == NULL)" - it equals as you will be check next index "skirmishAiImpl_className[skirmishAiImpl_size]". I don't read about size "skirmishAiImpl_className", but if array size was limited as skirmishAiImpl_size - then you realy can have problem with out of bounds, and can check other wariables.
The second danger line is 1163, 1191, 1212.
.

Re: My bot have lag on internet game.

Posted: 05 Oct 2014, 10:07
by hoijui
... indeed... good find!
what the heck have i been thinking there? :D
and how can that ever work?
.. much have been someone else coding it! ( dum di dum... :/ )

yeah, both these loops (JavaBridge.c line 1153 and line 1203) seem wrong. they are different, even though they should be doing the same, and neither is correct. should be corrected and moved to a function, i would say.
luckily, i commented the code so one know what the code should be doing. :D
.. me so smart!

.. should i do the commit, or will someone of you do it?

Re: My bot have lag on internet game.

Posted: 05 Oct 2014, 17:46
by abma
hoijui wrote:.. should i do the commit, or will someone of you do it?
if you have still a build env up, it would be great when you do the commit :-)

else i need some hint what needs to be changed. i still don't fully understand what this code should do.

Re: My bot have lag on internet game.

Posted: 10 Oct 2014, 09:50
by hoijui
made 2 small fix commits.
thanks playerO1 and abma!

the commits were not tested, but they are small enough to.. let me think they should work. ;-)
they will be in the develop branch soon, i guess.

Re: My bot have lag on internet game.

Posted: 18 Oct 2014, 20:56
by playerO1
I compile last Engine with AI interface version (17 october from github sources), then paste AI interface into Spring 98 folder (I not see AI interface in Spring 98 Linux 64). And I see 2 bug:
1. Two or more my bot can not work together: one of him have full control, secong do nothink. (Old bug, on Spring 97 it will be fixed, but now...) (See http://springrts.com/mantis/view.php?id=2840 and http://springrts.com/phpbb/viewtopic.ph ... 65#p560565)
2. Spring 98 + Zero-K mod + NullOOJavaAI take crash :(

Re: My bot have lag on internet game.

Posted: 01 Nov 2014, 20:38
by playerO1
I watch that Java AI Interface file on github have 2-3 years old of modify. Only one file have been modifed - it is "JavaBridge.c". Becouse I see, that Java interface from Spring 94.1 work on Spring 96+ZK mod, I copy from github file "JavaBridge.c" from ~Spring 95 version into sources from Spring 98 develop from GitHub.
I modify only one line in old file for compile new AI interface, becouse it was no compiling without it (modify method "void java_establishSpringEnv()").
I test this modifed interface: with TA/BA mod it can work, with ZK it crash again. I think bug can exist on other files, not on "JavaBridge.c". The bug can contain on other Spring files and modules.

Re: My bot have lag on internet game.

Posted: 03 Nov 2014, 21:42
by hoijui
you have a patch for JavaBridge.c?
if so, please make a pull request on github, and it will be checked out. also include a description of what exactly this is supposed to fix.

Re: My bot have lag on internet game.

Posted: 05 Nov 2014, 18:00
by playerO1
hoijui wrote:you have a patch for JavaBridge.c?
No, I mean that this file can not contain bug.
I try find bug on "JavaBridge.c", but I not found bug on this file. And I am sure that this file not have bug for make this crash.
So, if this file not have bug, and only this file have modifen on last year, it mean that bug can contain only on other Spring modules: on Spring engine, or "ExternalAI/Interface/*.h", "CUtils/*" or "AI/Interfaces/C/src/*" or other.

Re: My bot have lag on internet game.

Posted: 27 Sep 2016, 09:32
by mojjj