2025-07-18 18:24 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002656Spring engineAIpublic2012-09-18 18:26
Reporterhoijui 
Assigned Tohoijui 
PrioritylowSeverityminorReproducibilityhave not tried
StatusresolvedResolutionunable to reproduce 
Product Version 
Target VersionFixed in Version 
Summary0002656: SIGFPE in AAI (AAIExecute::BuildFactory)
Descriptionseems to happen when:
   bt->units_dynamic[*fac].active == -1
which i guess, should never be the case, so it looks like a logic error somewhere else.
Additional InformationProgram received signal SIGFPE, Arithmetic exception.
0x00007fffd6190442 in AAIExecute::BuildFactory (this=0xd9f8950) at AI/Skirmish/AAI/AAIExecute.cpp:1757
(gdb) bt
#0 0x00007fffd6190442 in AAIExecute::BuildFactory (this=0xd9f8950) at AI/Skirmish/AAI/AAIExecute.cpp:1757
#1 0x00007fffd6194d0e in AAIExecute::CheckConstruction (this=0xd9f8950) at AI/Skirmish/AAI/AAIExecute.cpp:2797
#2 0x00007fffd61d6e36 in AAI::Update (this=0xcdd0940) at AI/Skirmish/AAI/AAI.cpp:871
0000003 0x00007fffd62082c5 in springLegacyAI::CAIUpdateEvent::Run (this=0xc6170e0, ai=..., globalAICallback=0xd1344c0) at AI/Wrappers/LegacyCpp/Event/AIUpdateEvent.h:17
0000004 0x00007fffd62076ab in springLegacyAI::CAIAI::handleEvent (this=0xcdd09e0, topic=3, data=0x7fffffffc990) at AI/Wrappers/LegacyCpp/AIAI.cpp:161
0000005 0x00007fffd62000aa in handleEvent (skirmishAIId=0, topic=3, data=0x7fffffffc990) at AI/Skirmish/AAI/AIExport.cpp:97
#6 0x00000000011eae16 in CSkirmishAILibrary::HandleEvent (this=0xcdcdfb0, skirmishAIId=0, topic=3, data=0x7fffffffc990) at rts/ExternalAI/SkirmishAILibrary.cpp:95
#7 0x00000000011df041 in CSkirmishAI::HandleEvent (this=0xd110a10, topic=3, data=0x7fffffffc990) at rts/ExternalAI/SkirmishAI.cpp:57
#8 0x00000000011ef9df in CSkirmishAIWrapper::Update (this=0xd110970, frame=8342) at rts/ExternalAI/SkirmishAIWrapper.cpp:378
#9 0x00000000011b8de9 in CEngineOutHandler::Update (this=0x58a59a0) at rts/ExternalAI/EngineOutHandler.cpp:167
0000010 0x0000000000ae24ed in CGame::SimFrame (this=0x2582800) at rts/Game/Game.cpp:1416
#11 0x0000000000b62d81 in CGame::ClientReadNet (this=0x2582800) at rts/Game/NetCommands.cpp:362
0000012 0x0000000000adfe0f in CGame::Update (this=0x2582800) at rts/Game/Game.cpp:889
0000013 0x0000000001107ea5 in SpringApp::UpdateSim (this=0x7fffffffd760, ac=0x2582800) at rts/System/SpringApp.cpp:982
0000014 0x0000000001107f19 in SpringApp::Update (this=0x7fffffffd760) at rts/System/SpringApp.cpp:1060
#15 0x000000000110818d in SpringApp::Run (this=0x7fffffffd760, argc=2, argv=0x7fffffffd928) at rts/System/SpringApp.cpp:1164
#16 0x00000000010e582b in MainFunc (argc=2, argv=0x7fffffffd928, ret=0x7fffffffd7fc) at rts/System/Main.cpp:51
#17 0x00000000010e5abe in Run (argc=2, argv=0x7fffffffd928) at rts/System/Main.cpp:62
#18 0x00000000010e5b57 in main (argc=2, argv=0x7fffffffd928) at rts/System/Main.cpp:92
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
related to 0002657resolvedabma SIGSEGV in RAI (cRAI::UnitDamaged) 
+Relationships

-Notes

~0007385

jK (developer)

Last edited: 2011-09-19 18:08

the bug is in SSkirmishAICallbackImpl.cpp (engine code!)

It does call:

EXPORT(bool) skirmishAiCallback_Unit_isBeingBuilt(int skirmishAIId, int unitId) {
    if (skirmishAiCallback_Cheats_isEnabled(skirmishAIId)) {
        return skirmishAIId_cheatCallback[skirmishAIId]->UnitBeingBuilt(unitId);
    } else {
        return skirmishAIId_callback[skirmishAIId]->UnitBeingBuilt(unitId);
    }
}

The normal non-cheat callback does a LOS check, while the cheat one doesn't.
The problem is now that the non-cheat one gets called even for allied units, and LOS gets updated irregular -> it sometimes returns false for allied units inbuilt

Note, this bug affects near 80% of all functions in SSkirmishAICallbackImpl.cpp

~0007451

hoijui (reporter)

jk's initial assumption did help to find and eliminate some potential future crashes, but proved to not be responsible for this crash.
instead we found out, that AAI uses some wrong logic with a variable it uses to track the number of active constructors (including those being built and planned to being built).

should be fixed by:
https://github.com/spring/spring/commit/951dca1910cf78d5667eacd6a705659389d5e24e
+Notes

-Issue History
Date Modified Username Field Change
2011-09-17 13:07 hoijui New Issue
2011-09-19 18:08 jK Note Added: 0007385
2011-09-19 18:08 jK Note Edited: 0007385
2011-09-19 18:36 jK Relationship added related to 0002657
2011-09-20 09:23 hoijui Status new => assigned
2011-09-20 09:23 hoijui Assigned To => hoijui
2011-10-02 15:56 hoijui Note Added: 0007451
2012-09-18 18:26 abma Status assigned => resolved
2012-09-18 18:26 abma Resolution open => unable to reproduce
+Issue History