Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#1662 closed defect (fixed)

UnitAI error "InternalError: too much recursion"

Reported by: historic_bruno Owned by: leper
Priority: Should Have Milestone: Alpha 12
Component: UI & Simulation Keywords:
Cc: Deiz, zoot Patch:

Description

Happened during a game when a large army or several were on a rampage. Don't really have any more details :(

ERROR: JavaScript error: simulation/components/UnitAI.js line 2570 InternalError: too much recursion
(6138,0,10)@simulation/components/UnitAI.js:2570
([object Object])@simulation/components/UnitAI.js:502
([object Object],[object Object])@simulation/helpers/FSM.js:274
("WalkToTargetRange",[object Object])@simulation/components/UnitAI.js:2181
([object Object])@simulation/components/UnitAI.js:544
([object Object],[object Object])@simulation/helpers/FSM.js:274
()@simulation/components/UnitAI.js:2113
([object Object])@simulation/components/UnitAI.js:505
([object Object],[object Object])@simulation/helpers/FSM.js:274
("WalkToTargetRange",[object Object])@simulation/components/UnitAI.js:2181
([object Object])@simulation/components/UnitAI.js:544
([object Object],[object Object])@simulation/helpers/FSM.js:274
()@simulation/components/UnitAI.js:2113
([object Object])@simulation/components/UnitAI.js:505
([object Object],[object Object])@simulation/helpers/FSM.js:274
("WalkToTargetRange",[obj...

ERROR: Failed to call ProcessCommand() global script function

Change History (6)

comment:1 by Deiz, 12 years ago

Milestone: BacklogAlpha 12

This is an odd one. As discussed, the 'fix' to the generic issue (infinite loops where an order's failure mode is to push another order in front of itself) is to track failures and retry once per simulation turn, rather than recursing infinitely and hitting SpiderMonkey's recursion limit.

I can't see how the specific issue here could occur, though. Looking at the conditionals in CCmpUnitMotion::IsInTargetRange and CCmpUnitMotion::MoveToTargetRange, the former uses 'distance >= maxRange' while the latter uses 'distance > maxRange' and the like.

So there is a minuscule amount of difference there, but it shouldn't matter; if distance equals maxRange then IsInTargetRange says it's in range, and MoveToTargetRange ought to never be called. The only time that they should both return 'false' is if there's an error: either the current entity isn't in the world, or the target has no obstruction and isn't in the world.

Both cases seem impossible to hit - this bug is specific to the formation controller, which should always be in-world, and repair targets are validated as existing right before the movement attempt is made.

comment:2 by historic_bruno, 12 years ago

I believe there was an out of sync in that game, after a disconnect and rejoin, it's likely the simulation states differed somewhat, if that makes any difference here. Not saying that definitely invalidates this ticket but it's worth considering :)

comment:3 by historic_bruno, 11 years ago

Milestone: Alpha 12Backlog

I'll backlog this since it doesn't appear easy to reproduce. If anyone encounters this "frequently" or has some steps to reproduce it, feel free to bump it back up again.

comment:4 by historic_bruno, 11 years ago

Cc: zoot added

Similar report here.

comment:5 by leper, 11 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 12975:

Check whether the attack/gather target is visible and if not abort. Fixes #1662 and #1753.

comment:6 by leper, 11 years ago

Milestone: BacklogAlpha 12

See #1753 for a previously reproducible case.

Note: See TracTickets for help on using tickets.