2025-07-20 22:15 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004274Spring engineGeneralpublic2014-01-20 01:12
Reporterabma 
Assigned TojK 
PrioritynormalSeveritycrashReproducibilityhave not tried
StatusresolvedResolutionfixed 
Product Version96.0.1+git 
Target Version97.0Fixed in Version 
Summary0004274: SIGFPE in lobject.cpp:92
DescriptionProgram terminated with signal 8, Arithmetic exception.
#0 0x0000000000dc4281 in luaO_str2d (s=0x347ce88 "1389763542", result=0x7fff0b6501c4) at ../../rts/lib/lua/src/lobject.cpp:92
92 *result = lua_str2number(s, &endptr);
The program being debugged is not being run.
#0 0x0000000000dc4281 in luaO_str2d (s=0x347ce88 "1389763542", result=0x7fff0b6501c4) at ../../rts/lib/lua/src/lobject.cpp:92
        endptr = 0x347ce92 ""
#1 0x0000000000dd0367 in luaV_tonumber (obj=0x347b110, n=0x7fff0b650200) at ../../rts/lib/lua/src/lvm.cpp:41
        num = 0
#2 0x0000000000db3f7a in lua_isnumber (L=0x347ade0, idx=-1) at ../../rts/lib/lua/src/lapi.cpp:264
        n = {value = {gc = 0x14f679e00, p = 0x14f679e00, n = 3.88589158e+09, b = 1332190720}, tt = 55030032}
        o = 0x347b110
0000003 0x000000000080a6af in CheckForNaNsReal (L=0x347ade0, path=...) at ../../rts/Lua/LuaUtils.cpp:447
        __FUNCTION__ = "CheckForNaNsReal"
        table = 7
        foundNaNs = false
0000004 0x000000000080a67c in CheckForNaNsReal (L=0x347ade0, path=...) at ../../rts/Lua/LuaUtils.cpp:445
        key = 0x3481b18 "1"
        subpath = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3487148 "/tmp/spring/tests/.config/spring/cache/96dev-develop/ArchiveCache.lua: archives.1."}}
        __FUNCTION__ = "CheckForNaNsReal"
        table = 5
        foundNaNs = false
0000005 0x000000000080a67c in CheckForNaNsReal (L=0x347ade0, path=...) at ../../rts/Lua/LuaUtils.cpp:445
        key = 0x347bde8 "archives"
        subpath = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3486998 "/tmp/spring/tests/.config/spring/cache/96dev-develop/ArchiveCache.lua: archives."}}
        __FUNCTION__ = "CheckForNaNsReal"
        table = 3
        foundNaNs = false
#6 0x000000000080a88d in LuaUtils::CheckTableForNaNs (L=0x347ade0, table=1, name=...) at ../../rts/Lua/LuaUtils.cpp:479
        __FUNCTION__ = "CheckTableForNaNs"
        foundNaNs = false
#7 0x000000000077f80e in LuaParser::Execute (this=0x7fff0b6509f0) at ../../rts/Lua/LuaParser.cpp:229
        __PRETTY_FUNCTION__ = "bool LuaParser::Execute()"
        code = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3483b88 "local archiveCache = {\n\n\tinternalver = 9,\n\n\tarchives = { -- count = 8\n\t\t{\n\t\t\tname = \"316674e253df5c896492a35853c7be0d.sdp\",\n\t\t\tpath = \"/tmp/spring/tests/.config/spring/packages/\",\n\t\t\tmodified = \"1389"...}}
        codeLabel = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x347a958 "/tmp/spring/tests/.config/spring/cache/96dev-develop/ArchiveCache.lua"}}
        error = 0
#8 0x0000000000cfae73 in CArchiveScanner::ReadCacheData (this=0x347a8c0, filename=...) at ../../rts/System/FileSystem/ArchiveScanner.cpp:803
        archiveCache = {path = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x7fff0b650880 "\310\363\234@\020\177"}}, isValid = 48, parser = 0x7fff0b650920, L = 0x7fff0b650860, refnum = 0}
        ver = 0
        brokenArchives = {path = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x5 <Address 0x5 out of bounds>}}, isValid = 169, parser = 0x0, L = 0x7f10423a64c0, refnum = 5}
        p = {fileName = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x347a958 "/tmp/spring/tests/.config/spring/cache/96dev-develop/ArchiveCache.lua"}}, fileModes = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3423a38 "r"}}, textChunk = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x7f1040cb63f8 <std::string::_Rep::_S_empty_rep_storage+24> ""}}, accessModes = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x347a878 "b"}}, valid = false, initDepth = -1, L = 0x347ade0, tables = {_M_t = {_M_impl = {<std::allocator<std::_Rb_tree_node<LuaTable*> >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<LuaTable*> >> = {<No data fields>}, <No data fields>}, _M_key_compare = {<std::binary_function<LuaTable*, LuaTable*, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0x0, _M_left = 0x7fff0b650a28, _M_right = 0x7fff0b650a28}, _M_node_count = 0}}}, rootRef = -2, currentRef = -2, lowerKeys = true, lowerCppKeys = true, errorLog = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x7f1040cb63f8 <std::string::_Rep::_S_empty_rep_storage+24> ""}}, accessedFiles = {_M_t = {_M_impl = {<std::allocator<std::_Rb_tree_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<No data fields>}, <No data fields>}, _M_key_compare = {<std::binary_function<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0x0, _M_left = 0x7fff0b650a70, _M_right = 0x7fff0b650a70}, _M_node_count = 0}}}, static currentParser = 0x0}
        archives = {path = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x7f10423ac500 ""}}, isValid = 110, parser = 0x7f10409cf3c8, L = 0x401248, refnum = 0}
#9 0x0000000000cf7acc in CArchiveScanner::CArchiveScanner (this=0x347a8c0) at ../../rts/System/FileSystem/ArchiveScanner.cpp:353
        file = <incomplete type>
        datadirs = @0x7fff0b650c30: {<std::_Vector_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {_M_impl = {<std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {<__gnu_cxx::new_allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}
        scanDirs = {<std::_Vector_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {_M_impl = {<std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {<__gnu_cxx::new_allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {<No data fields>}, <No data fields>}, _M_start = 0x7fff0b650b8f, _M_finish = 0x7f1040a6dba6 <std::string::reserve(unsigned long)+102>, _M_end_of_storage = 0x100000000}}, <No data fields>}
0000010 0x0000000000d19539 in FileSystemInitializer::Initialize () at ../../rts/System/FileSystem/FileSystemInitializer.cpp:38
No locals.
#11 0x0000000000ca2ffa in SpringApp::Initialize (this=0x7fff0b650ef0) at ../../rts/System/SpringApp.cpp:245
        __PRETTY_FUNCTION__ = "bool SpringApp::Initialize()"
        __FUNCTION__ = "Initialize"
0000012 0x0000000000ca87d9 in SpringApp::Run (this=0x7fff0b650ef0) at ../../rts/System/SpringApp.cpp:887
        __FUNCTION__ = "Run"
0000013 0x0000000000c790ff in Run (argc=3, argv=0x7fff0b651048) at ../../rts/System/Main.cpp:60
        app = {cmdline = 0x3423480}
        ret = -1
        err = 0x11a9502 <_GLOBAL__sub_I__ZN4agui6WindowC2ERKSsPNS_10GuiElementE()+19>
        __FUNCTION__ = "Run"
0000014 0x0000000000c79752 in main (argc=3, argv=0x7fff0b651048) at ../../rts/System/Main.cpp:120
Additional Informationvalidation test, Spring 96.0.1-159-g7f66476 develop (Debug Headless)
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
has duplicate 0004275resolvedabma SIGFPE in lobject.cpp:92 
+Relationships

-Notes

~0012704

cleanrock (reporter)

Last edited: 2014-01-15 16:28

View 2 revisions

Looks very odd, is this really the crashing thread ?
If so, it looks like strtod is broken.

I dont see any SIGFPE with a rebuild of develop 96.0.1-162-gda58846 (release and debug builds).

~0012706

jK (developer)

It's no crash, only in special debug builds it does so to make debugging it easier

~0012708

cleanrock (reporter)

But why SIGFPE on
  luaO_str2d (s=0x347ce88 "1389763542", result=0x7fff0b6501c4) at ../../rts/lib/lua/src/lobject.cpp:92
?
To me this look like strtod cause SIGFPE.

~0012709

abma (administrator)

Last edited: 2014-01-15 17:09

View 3 revisions

why? its the "last line" of spring. strtod is libc++ which we can't change. -> strtod is called with a "bad" parameter.

idk if the cause (some overflow because called with wrong parameter or sth. like that) can be fixed, or we just disable SIGFPE checking for this functions with:

ScopedDisableFpuExceptions fe;

https://github.com/spring/spring/blob/develop/rts/Rendering/Models/AssParser.cpp#L201


or, if some new bug was introduced. idk, didn't investigate.

~0012710

Kloot (developer)

Last edited: 2014-01-15 17:15

View 3 revisions

"1389763542" is an *INTEGER* larger than the maximum representable integer value of a 32-bit float...

there are dozens of these reports on mantis by now, how many times does this need to be explained?

~0012711

cleanrock (reporter)

Kloot, please explain this:
luaconf.h:534
#define lua_str2number(s,p) strtod((s), (p))

~0012712

cleanrock (reporter)

Kloot, you edit/removed ur refs to lua_str2number in ur post 12710, care to explain why ?

~0012713

abma (administrator)

Last edited: 2014-01-15 17:42

View 3 revisions

https://github.com/spring/spring/blob/develop/rts/lib/lua/include/luaconf.h#L534

@cleanrock:

this line was added by trepan in 2007-05-17 13:59:52 / dcc064b5, there is nothing to explain i guess.

SIGFPE is a floating point exception: https://en.wikipedia.org/wiki/Unix_signal#SIGFPE

and the SIGFPE only happens in builds which have the cmake-option SIGNAL_NANS set.

SIGFPE's should be avoided because they _could_ cause desyncs.


maybe as note:

Spring's lua uses floats to represent all numbers, if they overflow / a NAN is a result, a SIGFPE is triggered. afaik float is used for performance reasons as doubles would be much slower. (but thats very basic stuff about the engine...)

~0012714

cleanrock (reporter)

Just so i understand, is this SIGFPE triggered by the double to float conversion when converting return value from double to float ?
*result = lua_str2number(s, &endptr);

Also is there any reason to use strtod instead of strtof on
https://github.com/spring/spring/blob/develop/rts/lib/lua/include/luaconf.h#L534
?

~0012715

cleanrock (reporter)

Since a double have between 15-17 decimal digits of precision i suspect it is the double to float conversion that cause this SIGFPE.

~0012716

Kloot (developer)

"also is there any reason to use strtod instead of strtof"

sigh... *search* and you shall find: http://springrts.com/mantis/view.php?id=3932

~0012717

cleanrock (reporter)

Ok, missing a code comment then.
I would like to understand what triggers the SIGFPE, do anyone know what do in this case ?
"1389763542" look harmless for strtod.
Only candidates i see is either internally inside strtod or the double to float conversion.
+Notes

-Issue History
Date Modified Username Field Change
2014-01-15 06:41 abma New Issue
2014-01-15 12:12 abma Relationship added related to 0004275
2014-01-15 14:52 abma Relationship replaced has duplicate 0004275
2014-01-15 16:23 cleanrock Note Added: 0012704
2014-01-15 16:28 cleanrock Note Edited: 0012704 View Revisions
2014-01-15 16:52 jK Note Added: 0012706
2014-01-15 17:03 cleanrock Note Added: 0012708
2014-01-15 17:09 abma Note Added: 0012709
2014-01-15 17:09 abma Note Edited: 0012709 View Revisions
2014-01-15 17:09 abma Note Edited: 0012709 View Revisions
2014-01-15 17:13 Kloot Note Added: 0012710
2014-01-15 17:13 Kloot Note Edited: 0012710 View Revisions
2014-01-15 17:15 Kloot Note Edited: 0012710 View Revisions
2014-01-15 17:19 cleanrock Note Added: 0012711
2014-01-15 17:24 cleanrock Note Added: 0012712
2014-01-15 17:37 abma Note Added: 0012713
2014-01-15 17:39 abma Note Edited: 0012713 View Revisions
2014-01-15 17:42 abma Note Edited: 0012713 View Revisions
2014-01-15 18:25 cleanrock Note Added: 0012714
2014-01-15 18:34 cleanrock Note Added: 0012715
2014-01-15 19:05 Kloot Note Added: 0012716
2014-01-15 19:19 cleanrock Note Added: 0012717
2014-01-20 01:11 jK Changeset attached => spring develop 82213f1e
2014-01-20 01:12 jK Status new => resolved
2014-01-20 01:12 jK Resolution open => fixed
2014-01-20 01:12 jK Assigned To => jK
+Issue History