View Issue Details

IDProjectCategoryView StatusLast Update
0001980AIAIpublic2010-07-18 23:05
Reporterhoijui Assigned ToKloot  
PrioritynormalSeveritycrashReproducibilityhave not tried
Status resolvedResolutionfixed 
Summary0001980: crash in KAIK
Descriptionan assertion got triggered after some time in-game.
Game was on latest master, BA 7.13 beta, Evergreen_Haven-v04, me & 5 * KAIK.
I guess this happens very seldomly, did not have KAIK crash since ages.
Additional Informationimportant stack trace part (more in attached infolog):
[ 39226] AI/Skirmish/KAIK/UnitHandler.cpp:757
[ 39226] AI/Skirmish/KAIK/UnitHandler.cpp:228
[ 39226] AI/Skirmish/KAIK/KAIK.cpp:133
[ 39226] AI/Wrappers/LegacyCpp/Event/AIUnitIdleEvent.h:33
TagsNo tags attached.
Attached Files
infolog.txt (Attachment missing)
20100712_000054_unnamed_0.81+.0.sdf (Attachment missing)
infolog_KAIK_crash_2.txt (Attachment missing)
screen00025.png (Attachment missing)

Activities

Kloot

2010-07-12 19:14

developer   ~0005079

Last edited: 2010-07-12 19:15

I don't see how this could even have happened:

1. only CUnitHandler::UnitCreated allocs and registers new BuilderTracker instances (and only for CAT_BUILDER units)
2. only CUnitHandler::UnitDestroyed frees these trackers again (and only for CAT_BUILDER units)
3. the crash originated in CUnitHandler::IdleUnitAdd (called on UnitIdle events), which looks up the tracker for the corresponding unit *if* the unit is a CAT_BUILDER

Therefore the assertion in CUnitHandler::GetBuilderTracker can only be triggered if a UnitIdle event arrives *before* a UnitCreated or *after* a UnitDestroyed event, both of which should be ruled out by the engine (if it wasn't, this crash should be showing up all the time).

I'll investigate when I can reproduce it, but that might be a while. ;)

SirMaverick

2010-07-12 20:23

reporter   ~0005080

> if a UnitIdle event arrives *before* a UnitCreated or *after* a UnitDestroyed event, both of which should be ruled out by the engine

side note to that:
An earlier version of CA's factory plop ("instant build") set the factory to build = 100% in UnitCreated. Result was that every gadget/widget/AI saw the UnitFinished before the UnitCreated for that factory.
Maybe there's something similar in KAIK's code. Or somewhere else.

hoijui

2010-07-12 21:16

reporter   ~0005081

a vague idea:
maybe it is about units being built, that get killed (eg, as nano-frame). as there were changes in that code, it makes it a bit more likely for thinks like this to happen (eg, UnitIdle called after UnitDestroyed).

hoijui

2010-07-16 21:15

reporter   ~0005108

has an other game where it happend. i added the infolog and a screenshot from that game. the screenshot is from 10 frames before the crash. it shows the only relevant portion of the map at that time. the yellow tam is played by KAIK, and we see the commander plus a near by (within explosion range) con veh. the com is at 2% health, and a horde of tanks is shooting at him. this all happens in an allies base (RAI controlled) -> no other KAIK units around.

so in short:
it looks like it is either the coms death, or the con it took with him, that causes the crash.
if i am in the mood, i will do some experiments.

hoijui

2010-07-16 21:31

reporter   ~0005109

how to reproduce:
1. start a game against a KAIK
2. pause (when game has started)
3. /cheat
4. /give corcom (next to the enemy com)
5. /give corca 0 (con-airplane to enemy/KAIKs team; make sure it is close to the enemy com (in explosion range))
6. unpause the game
7. D-gun the enemy commander.
-> crash

without the constructor, it does not happen.

Kloot

2010-07-16 21:44

developer   ~0005110

Yep, just confirmed that (commander destroyed ==> crash). Checking it out now.

hoijui

2010-07-17 00:00

reporter   ~0005111

i have seen your commit (thanks :-) )

you said that a UnitIdle events can arrive after a UnitDead event.
Is this considered Ok, or rather a bug?
not knowing more about it, it sounds like something that should be fixed. Are you looking into that?

Kloot

2010-07-17 00:22

developer   ~0005112

Last edited: 2010-07-17 00:23

I'm leaning toward "bug" too, so it's still on my list. Fixing KAIK was the short-term solution. :)

Kloot

2010-07-18 23:05

developer   ~0005120

Actually also the long-term fix, KAIK itself was sending CMD_STOP orders for dead units that made it seem the engine triggered this.

Issue History

Date Modified Username Field Change
2010-07-12 00:30 hoijui New Issue
2010-07-12 00:30 hoijui File Added: infolog.txt
2010-07-12 00:31 hoijui File Added: 20100712_000054_unnamed_0.81+.0.sdf
2010-07-12 19:14 Kloot Note Added: 0005079
2010-07-12 19:15 Kloot Note Edited: 0005079
2010-07-12 20:23 SirMaverick Note Added: 0005080
2010-07-12 21:16 hoijui Note Added: 0005081
2010-07-16 16:51 hoijui File Added: infolog_KAIK_crash_2.txt
2010-07-16 21:10 hoijui File Added: screen00025.png
2010-07-16 21:15 hoijui Note Added: 0005108
2010-07-16 21:31 hoijui Note Added: 0005109
2010-07-16 21:44 Kloot Note Added: 0005110
2010-07-17 00:00 hoijui Note Added: 0005111
2010-07-17 00:22 Kloot Note Added: 0005112
2010-07-17 00:23 Kloot Note Edited: 0005112
2010-07-18 23:05 Kloot Note Added: 0005120
2010-07-18 23:05 Kloot Status new => resolved
2010-07-18 23:05 Kloot Resolution open => fixed
2010-07-18 23:05 Kloot Assigned To => Kloot