2025-07-19 16:10 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002941Spring engineAIpublic2012-09-18 18:26
Reporterabma 
Assigned Tohoijui 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionunable to reproduce 
Product Version 
Target VersionFixed in Version 
Summary0002941: (AAI) SIGFPE in AAIUnitTable.cpp:377
Descriptionvalidation test failed:

http://buildbot.springrts.com/builders/validationtests/builds/872/steps/validation%20test_3/logs/stdio
Additional Information[f=0023663] Skirmish AI "Bot1" (ID:0), which controlled team 0 is now dead

Program received signal SIGFPE, Arithmetic exception.
0x00007ffff04112f2 in AAIUnitTable::FindClosestBuilder (this=0x708aa20, building=121, pos=0x7fffffffd760, commander=true, min_dist=0x7fffffffd74c) at /home/buildslave/full-linux/build/AI/Skirmish/AAI/AAIUnitTable.cpp:377
377 my_dist /= bt->unitList[builder->def_id-1]->speed;
#0 0x00007ffff04112f2 in AAIUnitTable::FindClosestBuilder (this=0x708aa20, building=121, pos=0x7fffffffd760, commander=true, min_dist=0x7fffffffd74c) at /home/buildslave/full-linux/build/AI/Skirmish/AAI/AAIUnitTable.cpp:377
        i = 19833
        my_dist = 1039.5293
        best_builder = 0x7069080
        builder = 0x759ea90
        builder_pos = {static CMP_EPS = 9.99999975e-05, static NORMALIZE_EPS = 9.99999996e-13, static maxxpos = 4095, static maxzpos = 4095, x = 2810.16357, y = 200.21759, z = 2899.33203}
        suitable = true
        continent = 0
#1 0x00007ffff04040d4 in AAIExecute::BuildRadar (this=0x73d6a20) at /home/buildslave/full-linux/build/AI/Skirmish/AAI/AAIExecute.cpp:1996
        min_dist = 29.0427723
        builder = 0x7ffff5e52d1a
        ground_radar = 121
        range = 5.02707291
        sea_radar = 0
        my_pos = {static CMP_EPS = 9.99999975e-05, static NORMALIZE_EPS = 9.99999996e-13, static maxxpos = 4095, static maxzpos = 4095, x = 3696, y = 0, z = 3584}
        best_pos = {static CMP_EPS = 9.99999975e-05, static NORMALIZE_EPS = 9.99999996e-13, static maxxpos = 4095, static maxzpos = 4095, x = 3776, y = 0, z = 2512}
        my_rating = -400
        best_rating = -320
        radar = 121
        cost = 0.989229262
#2 0x00007ffff0407854 in AAIExecute::CheckConstruction (this=0x73d6a20) at /home/buildslave/full-linux/build/AI/Skirmish/AAI/AAIExecute.cpp:2809
        category = STATIONARY_RECON
        highest_urgency = 1.06938684
        construction_started = false
0000003 0x00007ffff042c3f3 in AAI::Update (this=0x6640e60) at /home/buildslave/full-linux/build/AI/Skirmish/AAI/AAI.cpp:875
        myScopedTimerFromMakro = {part = 0x7ffff045a0ee "Building-Management", profiler = 0x72ffa90, startTime = 1328289531750}
        tick = 23668
0000004 0x00007ffff0436a9d in springLegacyAI::CAIUpdateEvent::Run (this=0x820baf0, ai=..., globalAICallback=0x6f257c0) at /home/buildslave/full-linux/build/AI/Wrappers/LegacyCpp/Event/AIUpdateEvent.h:17
No locals.
0000005 0x00007ffff0435e8e in springLegacyAI::CAIAI::handleEvent (this=0x72ffad0, topic=3, data=0x7fffffffdc90) at /home/buildslave/full-linux/build/AI/Wrappers/LegacyCpp/AIAI.cpp:161
        e = 0x820baf0
        ret = -1
#6 0x00007ffff03d61ba in handleEvent (skirmishAIId=1, topic=3, data=0x7fffffffdc90) at /home/buildslave/full-linux/build/AI/Skirmish/AAI/AIExport.cpp:97
No locals.
#7 0x00000000012016cd in CSkirmishAILibrary::HandleEvent (this=0x21bd950, skirmishAIId=1, topic=3, data=0x7fffffffdc90) at /home/buildslave/full-linux/build/rts/ExternalAI/SkirmishAILibrary.cpp:95
        ret = 0
#8 0x00000000011f4593 in CSkirmishAI::HandleEvent (this=0x6f21f30, topic=3, data=0x7fffffffdc90) at /home/buildslave/full-linux/build/rts/ExternalAI/SkirmishAI.cpp:57
        myScopedTimerFromMakro = {<BasicTimer> = {<boost::noncopyable_::noncopyable> = {<No data fields>}, name = "AI t:1 id:1 AAI 0.9", starttime = 70001}, autoShowGraph = false}
#9 0x000000000120624b in CSkirmishAIWrapper::Update (this=0x6da9190, frame=23668) at /home/buildslave/full-linux/build/rts/ExternalAI/SkirmishAIWrapper.cpp:378
        evtData = {frame = 23668}
0000010 0x00000000011cd997 in CEngineOutHandler::Update (this=0x49df060) at /home/buildslave/full-linux/build/rts/ExternalAI/EngineOutHandler.cpp:167
        ai = {first = 1 '\001', second = }
        myScopedTimerFromMakro = {<BasicTimer> = {<boost::noncopyable_::noncopyable> = {<No data fields>}, name = "AI Total", starttime = 70001}, autoShowGraph = false}
        frame = 23668
#11 0x0000000000ae5d53 in CGame::SimFrame (this=0x1e792c0) at /home/buildslave/full-linux/build/rts/Game/Game.cpp:1454
        cputimer = {<BasicTimer> = {<boost::noncopyable_::noncopyable> = {<No data fields>}, name = "Game::SimFrame", starttime = 70001}, autoShowGraph = true}
        forced = {<BasicTimer> = {<boost::noncopyable_::noncopyable> = {<No data fields>}, name = "\300\302g\001\000\000\000\000q\021\001\000\000\000\000\000\220\343\377\377\377\177\000\000\230\343\377\377\377\177\000\000\300\335\377\377\377\177\000\000\006\215\255", '\000' <repeats 13 times>, "\001\000\000\000\000\000\000\000\300\351\377\377\377\177\000\000\367\\\266\000\000\000\000\000\000\336\377\377\377\177\000\000\r\344 \001\000\000\000\000\000\336\377\377\002\000\000\000\250\345'\a\000\000\000\000\000\215K\b\377\377\377\377p\214K\b\000\000\000\000\200\336\377\377\377\177\000\000@6!\001\000\000\000\000(Ts\a\377\377\377\377\320\345'\a\002\000\000\000P\214K\b\000\000\000\000\340\245\362\006\000\000\000\000\260\336\377\377\377\177\000\000@6!\001\000\000\000\000\250\345'\a\000\000\000\000\000\220\362\006\377\377\377\377\320\214K\b\000\000\000\000\340\245\362\006\000\000\000\000@f6\006\000\000\000\000\300\000\000\000\000\000\000\000\360\213K\b\000\000\000\000\300\222\347\001\000\000\000\000\240\213K\b\000\000\000\000\340\213K\b\000\000\000\000\340\213K\b\001\000\000\000X\345'\a\000\000\000\000P\214K\b\377"... <Address 0x7ffffffff000 out of bounds>, starttime = 11372903}, autoShowGraph = false}
0000012 0x0000000000b65cf7 in CGame::ClientReadNet (this=0x1e792c0) at /home/buildslave/full-linux/build/rts/Game/NetCommands.cpp:370
        inbuf = 0x7fffec2dd330 "\002d-\354\377\177"
        dataLength = 1
        packetCode = 2 '\002'
        packet = {px = 0x7fffec2dd310, pn = {pi_ = 0x7fffec2d6470}}
        procstarttime = {_vptr.spring_time = 0x167c2c0, static binder = {class_ = 0x1c79b10, base = 0x0, flags = creg::CF_None, memberRegistrator = 0x1c3d280, name = 0x167c268 "spring_time", size = 16, constructor = 0x11060da <spring_time::_ConstructInstance(void*)>, destructor = 0x1106106 <spring_time::_DestructInstance(void*)>, nextBinder = 0x1c3d480}, static memberRegistrator = 0x1c3d300, x = 69991}
        __PRETTY_FUNCTION__ = "void CGame::ClientReadNet()"
0000013 0x0000000000ae2f01 in CGame::Update (this=0x1e792c0) at /home/buildslave/full-linux/build/rts/Game/Game.cpp:882
        timeNow = {_vptr.spring_time = 0x167c2c0, static binder = {class_ = 0x1c79b10, base = 0x0, flags = creg::CF_None, memberRegistrator = 0x1c3d280, name = 0x167c268 "spring_time", size = 16, constructor = 0x11060da <spring_time::_ConstructInstance(void*)>, destructor = 0x1106106 <spring_time::_DestructInstance(void*)>, nextBinder = 0x1c3d480}, static memberRegistrator = 0x1c3d300, x = 69991}
        diffsecs = 0.153999999
0000014 0x000000000112346e in GML::UpdateSim (ac=0x1e792c0) at /home/buildslave/full-linux/build/rts/lib/gml/gml_base.h:37
No locals.
#15 0x00000000011210b4 in SpringApp::Update (this=0x7fffffffeb40) at /home/buildslave/full-linux/build/rts/System/SpringApp.cpp:927
        ret = 1
#16 0x0000000001121230 in SpringApp::Run (this=0x7fffffffeb40, argc=2, argv=0x7fffffffed38) at /home/buildslave/full-linux/build/rts/System/SpringApp.cpp:1008
No locals.
#17 0x0000000001100c50 in MainFunc (argc=2, argv=0x7fffffffed38, ret=0x7fffffffec0c) at /home/buildslave/full-linux/build/rts/System/Main.cpp:51
        app = {cmdline = 0x1c74e20, binaryName = "/tmp/spring/tests/usr/local/bin/spring-headless"}
#18 0x0000000001101013 in Run (argc=2, argv=0x7fffffffed38) at /home/buildslave/full-linux/build/rts/System/Main.cpp:62
        ret = -1
        err = 0x15ecb35
#19 0x00000000011010ac in main (argc=2, argv=0x7fffffffed38) at /home/buildslave/full-linux/build/rts/System/Main.cpp:92
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0008264

hoijui (reporter)

how the heck is that possible, as we have no threads invovled here, that we get a SIGFPE on the second of these to lines:
if(bt->unitList[builder->def_id-1]->speed > 0)
    my_dist /= bt->unitList[builder->def_id-1]->speed;
????????

~0008265

hoijui (reporter)

after some investigation on #C++ ...
*Indiana Jones music*

minimal example:
if (f_0 > 0) { f_1 /= f_0; } // f_0 and f_1 are floats

can cause SIGFPE when:
f_0 is a denormal.
denormals are float values that inbetween valid float values.
some operations clamp them, others do not.
if f_0 is a denormal next to 0.0f, and comparison (>) does not clamp it, but division does (/=), one might get a SIGFPE.

possible solution:
* use other FPU flags when compiling (spring seems to do that, but not for AIs)
* instead of comparing to 0(.0f), compare to VERY_SMALL_FLOAT

AAI uses comparison with 0 in a LOT of places, and i woudl not know an easy way to find out which ones are float and which ones are int comparisons with a script.
this issue is really too minor to go through all these places by hand.

i suggest leaving this report open. and .. well.. maybe some veeeery boring day... who knows!? ;-)
+Notes

-Issue History
Date Modified Username Field Change
2012-02-03 19:48 abma New Issue
2012-02-05 19:03 hoijui Note Added: 0008264
2012-02-05 19:45 hoijui Note Added: 0008265
2012-02-06 14:06 hoijui Status new => assigned
2012-02-06 14:06 hoijui Assigned To => hoijui
2012-09-18 18:26 abma Status assigned => resolved
2012-09-18 18:26 abma Resolution open => unable to reproduce
+Issue History