2025-07-18 19:36 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004653Spring engineGeneralpublic2015-01-21 21:01
Reporterabma 
Assigned ToKloot 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version98.0.1+git 
Target VersionFixed in Version 
Summary0004653: AAI crash at exit in rts/ExternalAI/SSkirmishAICallbackImpl.cpp:1862 since LoadMap merge (validation test)
Descriptionit seems deinit order is wrong, is it possible that the map is unloaded before AI's are unloaded? (=release event)

http://buildbot.springrts.com/builders/validationtests/builds/4505/steps/analyze%20core%20dumps_2/logs/stdio

could be workarrounded by changing AAIBuildTable::GetBuildCacheFileName to cache result in a static var (its used on init, too), but would be better to fix the cause :)
Additional Information#0 0x00007fb570eb62c0 in std::string::c_str() const () from /lib64/libstdc++.so.6
The program being debugged is not being run.
#0 0x00007fb570eb62c0 in std::string::c_str() const () from /lib64/libstdc++.so.6
No symbol table info available.
#1 0x0000000000b6fc1d in skirmishAiCallback_Map_getName (skirmishAIId=1) at ../../rts/ExternalAI/SSkirmishAICallbackImpl.cpp:1862
No locals.
#2 0x00007fb572fe829e in springLegacyAI::CAIAICallback::GetMapName (this=0x45678a0) at ../../AI/Wrappers/LegacyCpp/AIAICallback.cpp:954
No locals.
0000003 0x00007fb572f96915 in AAIConfig::getUniqueName (this=0x46a0b70, game=true, gamehash=true, map=true, maphash=true) at ../../AI/Skirmish/AAI/AAIConfig.cpp:521
        mapName = <error reading variable: Cannot access memory at address 0xffffffffffffffe8>
        res = ""
0000004 0x00007fb572f717a5 in AAIBuildTable::GetBuildCacheFileName (this=0x41f8cf0) at ../../AI/Skirmish/AAI/AAIBuildTable.cpp:2497
No locals.
0000005 0x00007fb572f726e5 in AAIBuildTable::SaveBuildTable (this=0x41f8cf0, game_period=0, map_type=LAND_MAP) at ../../AI/Skirmish/AAI/AAIBuildTable.cpp:2658
        filename = "\001\000\000\000\265\177\000\000(\234\231\001", '\000' <repeats 12 times>, "\360rV\004\000\000\000\000\000\000\000\000mish\200ZB\004\000\000\000\000@\000\000\000\000\000\000\000\341\000\000\000\000\000\000\000\220~\342\n\000\000\000\000\300i\260\n\000\000\000\000\300\327q\t\000\000\000\000Q\000\000\000\000\000\000\000\200\374\356\b\000\000\000\000\220\363\314\n", '\000' <repeats 12 times>, "P\204\204\b\000\000\000\000 T/\001\000\000\000\000 T/\001\000\000\000\000Pfn\004\000\000\000\000\002\000\000\000\000\000\000\000p\000\000\000\000\000\000\000P\000\000\000\000\000\000\000\260\302g\t\000\000\000\000\005\001\377", '\000' <repeats 13 times>...
        save_file = 0x7fff17dea550
#6 0x00007fb572fc1558 in AAI::~AAI (this=0x461a8b0, __in_chrg=<optimized out>) at ../../AI/Skirmish/AAI/AAI.cpp:119
No locals.
#7 0x00007fb572fc17c2 in AAI::~AAI (this=0x461a8b0, __in_chrg=<optimized out>) at ../../AI/Skirmish/AAI/AAI.cpp:145
No locals.
#8 0x00007fb572fdc2c8 in springLegacyAI::CAIAI::~CAIAI (this=0x46e64a0, __in_chrg=<optimized out>) at ../../AI/Wrappers/LegacyCpp/AIAI.cpp:15
No locals.
#9 0x00007fb572fdc33c in springLegacyAI::CAIAI::~CAIAI (this=0x46e64a0, __in_chrg=<optimized out>) at ../../AI/Wrappers/LegacyCpp/AIAI.cpp:20
No locals.
0000010 0x00007fb572fd5942 in release (skirmishAIId=0) at ../../AI/Skirmish/AAI/AIExport.cpp:82
No locals.
#11 0x0000000000b8dcca in CSkirmishAILibrary::Release (this=0x4558010, skirmishAIId=0) at ../../rts/ExternalAI/SkirmishAILibrary.cpp:77
        error = -1023563194
        ok = true
0000012 0x0000000000b80a87 in CSkirmishAI::~CSkirmishAI (this=0x4263c20, __in_chrg=<optimized out>) at ../../rts/ExternalAI/SkirmishAI.cpp:36
        myScopedTimerFromMakro = {<BasicTimer> = {<boost::noncopyable_::noncopyable> = {<No data fields>}, hash = 1172, starttime = {static binder = {class_ = 0x20e35e0, base = 0x0, flags = creg::CF_None, memberRegistrator = 0x198d308 <spring_time::memberRegistrator>, name = 0x1282a21 "spring_time", size = 8, alignment = 8, hasVTable = false, isCregStruct = true, constructor = 0xa78552 <spring_time::_ConstructInstance(void*)>, destructor = 0xa7857e <spring_time::_DestructInstance(void*)>, nextBinder = 0x198d220 <CRectangleOptimizer::binder>}, static memberRegistrator = 0x198d420 <spring_timemreg>, static creg_hasVTable = false, static creg_isStruct = true, x = 46221084321, static xs = 1421801212332933699}, nameIterator = {first = 1172, second = "AI t:0 id:0 AAI 0.9"}}, autoShowGraph = false, it = {first = 1172, second = 1}}
0000013 0x0000000000b9109e in CSkirmishAIWrapper::~CSkirmishAIWrapper (this=0x44655c0, __in_chrg=<optimized out>) at ../../rts/ExternalAI/SkirmishAIWrapper.cpp:107
No locals.
0000014 0x0000000000b91176 in CSkirmishAIWrapper::~CSkirmishAIWrapper (this=0x44655c0, __in_chrg=<optimized out>) at ../../rts/ExternalAI/SkirmishAIWrapper.cpp:119
No locals.
#15 0x0000000000b57d37 in CEngineOutHandler::~CEngineOutHandler (this=0x220c8c0, __in_chrg=<optimized out>) at ../../rts/ExternalAI/EngineOutHandler.cpp:113
        ai = {first = 0 '\000', second = }
#16 0x0000000000b57dcc in CEngineOutHandler::~CEngineOutHandler (this=0x220c8c0, __in_chrg=<optimized out>) at ../../rts/ExternalAI/EngineOutHandler.cpp:115
No locals.
#17 0x0000000000b5ed74 in SafeDelete<CEngineOutHandler*> (a=@0x1999a58: 0x0) at ../../rts/System/Util.h:197
        tmp = 0x220c8c0
#18 0x0000000000b57ccf in CEngineOutHandler::Destroy () at ../../rts/ExternalAI/EngineOutHandler.cpp:102
No locals.
#19 0x00000000005be7bd in CGame::~CGame (this=0x21e5760, __in_chrg=<optimized out>) at ../../rts/Game/Game.cpp:384
No locals.
0000020 0x00000000005be842 in CGame::~CGame (this=0x21e5760, __in_chrg=<optimized out>) at ../../rts/Game/Game.cpp:390
No locals.
#21 0x0000000000aafda5 in SafeDelete<CGame*> (a=@0x1920bc0: 0x0) at ../../rts/System/Util.h:197
        tmp = 0x21e5760
#22 0x0000000000aabea2 in SpringApp::ShutDown () at ../../rts/System/SpringApp.cpp:981
        numCalls = 1
        __FUNCTION__ = "ShutDown"
#23 0x0000000000aab814 in SpringApp::Run (this=0x7fff17deaa50) at ../../rts/System/SpringApp.cpp:954
        __FUNCTION__ = "Run"
0000024 0x0000000000a70b3d in Run (argc=3, argv=0x7fff17deac68) at ../../rts/System/Main.cpp:48
        app = {cmdline = {px = 0x20ccfb0, pn = {pi_ = 0x20cd320}}, clientSetup = {px = 0x2865610, pn = {pi_ = 0x2126440}}}
        ret = -1
        err = 0x11d6fff <__static_initialization_and_destruction_0(int, int)+495>
#25 0x0000000000a71207 in main (argc=3, argv=0x7fff17deac68) at ../../rts/System/Main.cpp:107
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0013935

abma (administrator)

yep, seems there is CGame::InitSkirmishAIs() but no deinit

~0013936

Kloot (developer)

AI deinit is handled by CEngineOutHandler::Destroy()

The map is indeed deleted first, but I hate moving AI destruction before that point (because it doesn't belong in KillSimulation).

~0013937

abma (administrator)

then move ai deinitialize to (a new) UnLoadSkirmishAIs()?

not sure if it works, but i guess i see the problems with moving CEngineOutHandler::Destroy() before KillSimulation: i guess simulation just tries to run events without checking if the handler(s) are still valid?!

~0013938

Kloot (developer)

yup, mutual dependency hell ;)

~0013939

abma (administrator)

unload ai's while all stuff is running should be safe as load/unload ai commands exits:

see CTeam::KillAIs() :)

(imo it shouldn't crash at exit when all ai's are unloaded/killed)

~0013940

abma (administrator)

thanks, seems fixed!

https://github.com/spring/spring/commit/3f50800fc24e592ad7fc310144e0f551927dc604
+Notes

-Issue History
Date Modified Username Field Change
2015-01-21 02:08 abma New Issue
2015-01-21 02:08 abma Summary crash at exit in rts/ExternalAI/SSkirmishAICallbackImpl.cpp:1862 => crash at exit in rts/ExternalAI/SSkirmishAICallbackImpl.cpp:1862 (validation test)
2015-01-21 02:11 abma Product Version => 98.0.1+git
2015-01-21 02:11 abma Target Version 98.0.1+git =>
2015-01-21 02:17 abma Note Added: 0013935
2015-01-21 02:48 abma Reproducibility have not tried => always
2015-01-21 02:48 abma Summary crash at exit in rts/ExternalAI/SSkirmishAICallbackImpl.cpp:1862 (validation test) => AAI crash at exit in rts/ExternalAI/SSkirmishAICallbackImpl.cpp:1862 (validation test)
2015-01-21 02:48 Kloot Note Added: 0013936
2015-01-21 02:49 abma Summary AAI crash at exit in rts/ExternalAI/SSkirmishAICallbackImpl.cpp:1862 (validation test) => AAI crash at exit in rts/ExternalAI/SSkirmishAICallbackImpl.cpp:1862 since LoadMap merge (validation test)
2015-01-21 03:03 abma Note Added: 0013937
2015-01-21 03:05 Kloot Note Added: 0013938
2015-01-21 03:12 abma Note Added: 0013939
2015-01-21 13:35 Kloot Assigned To => Kloot
2015-01-21 13:35 Kloot Status new => assigned
2015-01-21 21:01 abma Note Added: 0013940
2015-01-21 21:01 abma Status assigned => resolved
2015-01-21 21:01 abma Resolution open => fixed
+Issue History