rlcevg / CircuitAI

Spring RTS local native AI
GNU General Public License v2.0
19 stars 20 forks source link

SIGFPE in debug build related to CMetalManager::ClusterizeMetal ? #69

Closed cleanrock closed 7 years ago

cleanrock commented 7 years ago

I am not sure this is circuits fault. spring version: 7a4aad71b20cdf2e407070eaecb119f8e2b3d1f2 Backtrace:


Program terminated with signal SIGFPE, Arithmetic exception.
#0  0x000055ef9f64d023 in Square<float> (x=3.40282347e+38) at /home/johanr/my_projects/spring/rts/System/myMath.h:117
117 template<class T> constexpr T Square(const T x) { return x*x; }
[Current thread is 1 (Thread 0x7ff1c7621800 (LWP 18803))]
(gdb) bt
#0  0x000055ef9f64d023 in Square<float> (x=3.40282347e+38) at /home/johanr/my_projects/spring/rts/System/myMath.h:117
#1  0x000055ef9ff2d574 in CPathFinder::DoRawSearch (this=0x55efec744000, moveDef=..., pfDef=..., owner=0x0)
    at /home/johanr/my_projects/spring/rts/Sim/Path/Default/PathFinder.cpp:85
#2  0x000055ef9ff13f8c in IPathFinder::InitSearch (this=0x55efec744000, moveDef=..., pfDef=..., owner=0x0)
    at /home/johanr/my_projects/spring/rts/Sim/Path/Default/IPathFinder.cpp:219
#3  0x000055ef9ff13a3e in IPathFinder::GetPath (this=0x55efec744000, moveDef=..., pfDef=..., owner=0x0, startPos=..., path=..., maxNodes=8192)
    at /home/johanr/my_projects/spring/rts/Sim/Path/Default/IPathFinder.cpp:146
#4  0x000055ef9ff36edf in CPathManager::ArrangePath (this=0x55efecdfd5e0, newPath=0x7ffff0a1bf10, moveDef=0x55eff9ba3c40, startPos=..., goalPos=..., caller=0x0)
    at /home/johanr/my_projects/spring/rts/Sim/Path/Default/PathManager.cpp:162
#5  0x000055ef9ff37371 in CPathManager::RequestPath (this=0x55efecdfd5e0, caller=0x0, moveDef=0x55eff9ba3c40, startPos=..., goalPos=..., goalRadius=16, synced=false)
    at /home/johanr/my_projects/spring/rts/Sim/Path/Default/PathManager.cpp:363
#6  0x000055ef9fc2c035 in CAICallback::InitPath (this=0x55f01414b050, start=..., end=..., pathType=4, goalRadius=0)
    at /home/johanr/my_projects/spring/rts/ExternalAI/AICallback.cpp:722
#7  0x000055ef9fc2c1e1 in CAICallback::GetPathLength (this=0x55f01414b050, start=..., end=..., pathType=4, goalRadius=0)
    at /home/johanr/my_projects/spring/rts/ExternalAI/AICallback.cpp:737
#8  0x000055ef9fc56dff in skirmishAiCallback_Engine_handleCommand (skirmishAIId=0, commandId=-1, commandTopic=17, commandData=0x7ffff0a1c4a0)
    at /home/johanr/my_projects/spring/rts/ExternalAI/SSkirmishAICallbackImpl.cpp:810
#9  0x00007ff1b151546e in bridged_Pathing_getApproximateLength (skirmishAIId=0, start_posF3=0x7ffff0a1c520, end_posF3=0x7ffff0a1c52c, pathType=4, goalRadius=0)
    at /home/johanr/my_projects/spring_build/build_develop_debug/AI/Wrappers/Cpp/src-generated/CombinedCallbackBridge.c:2694
#10 0x00007ff1b14f6b0e in springai::WrappPathing::GetApproximateLength (this=0x55f01414b090, start=..., end=..., pathType=4, goalRadius=0)
    at /home/johanr/my_projects/spring_build/build_develop_debug/AI/Wrappers/Cpp/src-generated/WrappPathing.cpp:57
#11 0x00007ff1b13ca50a in circuit::CMetalManager::ClusterizeMetal (this=0x55efed6c49b0, commDef=0x55f05c0910c0)
    at /home/johanr/my_projects/spring/AI/Skirmish/CircuitAI/src/circuit/resource/MetalManager.cpp:211
#12 0x00007ff1b148a01f in circuit::CAllyTeam::Init (this=0x55f03ad89560, circuit=0x55f039cc6d00)
    at /home/johanr/my_projects/spring/AI/Skirmish/CircuitAI/src/circuit/unit/AllyTeam.cpp:66
#13 0x00007ff1b125f573 in circuit::CCircuitAI::Init (this=0x55f039cc6d00, skirmishAIId=0, sAICallback=0x55f055efa800)
    at /home/johanr/my_projects/spring/AI/Skirmish/CircuitAI/src/circuit/CircuitAI.cpp:651
#14 0x00007ff1b125b0f2 in circuit::CCircuitAI::HandleGameEvent (this=0x55f039cc6d00, topic=1, data=0x7ffff0a1ce20)
    at /home/johanr/my_projects/spring/AI/Skirmish/CircuitAI/src/circuit/CircuitAI.cpp:190
#15 0x00007ff1b125a4ee in circuit::CCircuitAI::HandleEvent (this=0x55f039cc6d00, topic=1, data=0x7ffff0a1ce20)
    at /home/johanr/my_projects/spring/AI/Skirmish/CircuitAI/src/circuit/CircuitAI.cpp:121
#16 0x00007ff1b1255c0c in handleEvent (skirmishAIId=0, topic=1, data=0x7ffff0a1ce20) at /home/johanr/my_projects/spring/AI/Skirmish/CircuitAI/src/AIExport.cpp:75
#17 0x000055ef9fc7b412 in CSkirmishAILibrary::HandleEvent (this=0x55efece3e6e0, skirmishAIId=0, topic=1, data=0x7ffff0a1ce20)
    at /home/johanr/my_projects/spring/rts/ExternalAI/SkirmishAILibrary.cpp:94
#18 0x000055ef9fc80bd6 in CSkirmishAIWrapper::HandleEvent (this=0x55f013e5e8a0, topic=1, data=0x7ffff0a1ce20)
    at /home/johanr/my_projects/spring/rts/ExternalAI/SkirmishAIWrapper.cpp:467
#19 0x000055ef9fc7fab4 in CSkirmishAIWrapper::Init (this=0x55f013e5e8a0) at /home/johanr/my_projects/spring/rts/ExternalAI/SkirmishAIWrapper.cpp:220
#20 0x000055ef9fc49b21 in CEngineOutHandler::CreateSkirmishAI (this=0x55efed7b6120, skirmishAIId=0 '\000')
    at /home/johanr/my_projects/spring/rts/ExternalAI/EngineOutHandler.cpp:571
#21 0x000055ef9fc6ff6a in CSkirmishAIHandler::CreateLocalSkirmishAI (this=0x55efec59fa00, skirmishAIId=0)
    at /home/johanr/my_projects/spring/rts/ExternalAI/SkirmishAIHandler.cpp:187
#22 0x000055ef9f6764f4 in CGame::LoadSkirmishAIs (this=0x55efec8cd700) at /home/johanr/my_projects/spring/rts/Game/Game.cpp:742
#23 0x000055ef9f6738c6 in CGame::LoadGame (this=0x55efec8cd700, mapName="maps/Nuclear_Winter_v1.smf") at /home/johanr/my_projects/spring/rts/Game/Game.cpp:433
#24 0x000055ef9f6b7f38 in CLoadScreen::Init (this=0x55efece3f400) at /home/johanr/my_projects/spring/rts/Game/LoadScreen.cpp:182
#25 0x000055ef9f6b8230 in CLoadScreen::CreateInstance (mapName="maps/Nuclear_Winter_v1.smf", modName="78a83091836a56ad708eb0963fd2165a.sdp", saveFile=0x0)
    at /home/johanr/my_projects/spring/rts/Game/LoadScreen.cpp:208
#26 0x000055ef9f6c7054 in CPreGame::UpdateClientNet (this=0x55efec54f810) at /home/johanr/my_projects/spring/rts/Game/PreGame.cpp:381
#27 0x000055ef9f6c5e2d in CPreGame::Update (this=0x55efec54f810) at /home/johanr/my_projects/spring/rts/Game/PreGame.cpp:186
#28 0x000055ef9fb99c6a in SpringApp::Update (this=0x7ffff0a1d550) at /home/johanr/my_projects/spring/rts/System/SpringApp.cpp:872
#29 0x000055ef9fb99dc1 in SpringApp::Run (this=0x7ffff0a1d550) at /home/johanr/my_projects/spring/rts/System/SpringApp.cpp:906
#30 0x000055ef9fb765d1 in Run (argc=2, argv=0x7ffff0a1d778) at /home/johanr/my_projects/spring/rts/System/Main.cpp:43
#31 0x000055ef9fb76894 in main (argc=2, argv=0x7ffff0a1d778) at /home/johanr/my_projects/spring/rts/System/Main.cpp:92
rlcevg commented 7 years ago

Raw-move is kinda new. Apparantly the way Pathing::GetApproximateLength() works was changed. Circuit uses engine-pathfinder only on Init-event and only for pairs of metal spots, should be reproducible. Which map was it?

cleanrock commented 7 years ago

Nuclear_Winter_v1

rlcevg commented 7 years ago

assert failed with 103.0.1-1492-g0067dfb (that is newer than 7a4aad)

spring: /home/evgenij/games/spring/spring/rts/Sim/MoveTypes/MoveMath/MoveMath.cpp:138: static CMoveMath::BlockType CMoveMath::IsBlockedNoSpeedModCheckThreadUnsafe(const MoveDef&, int, int, const CSolidObject*): Assertion `Threading::IsMainThread()' failed.

Didn't get to error in OP, or it was fixed in engine. Anyway, those are engine quirks/bugs.

rlcevg commented 7 years ago

Can't reproduce with latest engine commit, all returned values of path lengths seems fine in "relwithdebinfo" mode, as "debug" mode gives Assertion `Threading::IsMainThread()' failed... maybe because Loading_MT is true in springsettings.cfg. Circuit doesn't do separate threads on Init event.

cleanrock commented 7 years ago

I see same problem with 104.0.1-0-g0067dfb39, i always run with default LoadingMT (0).

rlcevg commented 7 years ago

I can confirm that LoadingMT=1 is the cause of

spring: /home/evgenij/games/spring/spring/rts/Sim/MoveTypes/MoveMath/MoveMath.cpp:138: static CMoveMath::BlockType CMoveMath::IsBlockedNoSpeedModCheckThreadUnsafe(const MoveDef&, int, int, const CSolidObject*): Assertion `Threading::IsMainThread()' failed.

But still can't reproduce SIGFPE. Will try to update tools and test with new boost...

cleanrock commented 7 years ago

My script:

[GAME]
{
    HostIP=127.0.0.1;
    IsHost=1;
    MyPlayerName=Host;

    GameType=Zero-K v1.5.9.4;

    Mapname=Nuclear_Winter_v1;
    GameID=00000000000000000000000000000000;

    startpostype=0;

    [modoptions]
    {
        enableunlocks=0;
        MinSpeed=1;
        MaxSpeed=30;
        //factorycostmult=0.5;
        //pathfinder=qtpfs;
    }

    [PLAYER1]
    {
        Name=Host;
        Team=0;
        spectator=1;
    }

        [AI0]
        {
                Name=CircuitAI1;
                ShortName=CircuitAI;
                Version=stable;
                Team=0;
                IsFromDemo=0;
                Host=1;
                [Options]
                {
                }
        }
        [AI1]
        {
                Name=CAI1;
                ShortName=CAI;
                Version=<not-versioned>;
                Team=1;
                IsFromDemo=0;
                Host=1;
                [Options]
                {
                }
        }
        [AI2]
        {
                Name=CircuitAI2;
                ShortName=CircuitAI;
                Version=stable;
                Team=2;
                IsFromDemo=0;
                Host=1;
                [Options]
                {
                }
        }
        [AI3]
        {
                Name=CAI2;
                ShortName=CAI;
                Version=<not-versioned>;
                Team=3;
                IsFromDemo=0;
                Host=1;
                [Options]
                {
                }
        }
        [AI4]
        {
                Name=CAI3;
                ShortName=CAI;
                Version=<not-versioned>;
                Team=4;
                IsFromDemo=0;
                Host=1;
                [Options]
                {
                }
        }

    [TEAM0]
    {
        TeamLeader=1;
        AllyTeam=0;
        RGBColor=0.976471 1 0;
        Side=Robots;
        Handicap=0;
    }
    [TEAM1]
    {
        TeamLeader=1;
        AllyTeam=1;
        RGBColor=0.509804 0.498039 1;
        Side=Robots;
        Handicap=0;
    }
    [TEAM2]
    {
        TeamLeader=1;
        AllyTeam=0;
        RGBColor=0.976471 1 0;
        Side=Robots;
        Handicap=0;
    }
    [TEAM3]
    {
        TeamLeader=1;
        AllyTeam=1;
        RGBColor=0.509804 0.498039 1;
        Side=Robots;
        Handicap=0;
    }
    [TEAM4]
    {
        TeamLeader=1;
        AllyTeam=1;
        RGBColor=0.976471 1 0;
        Side=Robots;
        Handicap=0;
    }

    [ALLYTEAM0]
    {
        NumAllies=0;
    }
    [ALLYTEAM1]
    {
        NumAllies=0;
    }
}
rlcevg commented 7 years ago

Finally updated my rig. Compiled spring 104.0.1-55-g5d0ff28 maintenance with CMAKE_BUILD_TYPE=DEBUG, tested script above with ZK 1.5.10.3. And was unable to reproduce assert hit.