• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Linux Segment fault, bt full code, where to look? TFS 1.3

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
TFS 1.3, I have a hard time understand the fault, seems to be a issue in luascript.cpp? or not? No clue actually.

C++:
Thread 2 "tfs" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff5f40700 (LWP 6317)]
0x000055555559d358 in std::less<unsigned int>::operator() (this=0x7fffda839ae0, __x=<error reading variable>,
    [email protected]: 932214) at /usr/include/c++/9/bits/stl_function.h:386
386           { return __x < __y; }
(gdb) bt full
#0  0x000055555559d358 in std::less<unsigned int>::operator() (this=0x7fffda839ae0, __x=<error reading variable>,
    [email protected]: 932214) at /usr/include/c++/9/bits/stl_function.h:386
No locals.
#1  0x000055555582ca6c in std::_Rb_tree<unsigned int, std::pair<unsigned int const, int>, std::_Select1st<std::pair<unsigned int const, int> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, int> > >::_M_lower_bound (this=0x7fffda839ae0,
    __x=0x555500040000, __y=0x7fffda839ae8, [email protected]: 932214) at /usr/include/c++/9/bits/stl_tree.h:1945
No locals.
#2  0x0000555555829554 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, int>, std::_Select1st<std::pair<unsigned int const, int> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, int> > >::find (this=0x7fffda839ae0,
    [email protected]: 932214) at /usr/include/c++/9/bits/stl_tree.h:2570
        __j = {first = 0, second = -1}
#3  0x0000555555826b05 in std::map<unsigned int, int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, int> > >::find (this=0x7fffda839ae0, [email protected]: 932214) at /usr/include/c++/9/bits/stl_map.h:1194
No locals.
#4  0x00005555558156a6 in Player::getStorageValue (this=0x7fffda839690, key=932214, [email protected]: 1074004856)
    at /home/otsmanager/custom/src/player.cpp:670
        it = {first = 3538470793, second = -218104838}
#5  0x00005555557767e9 in LuaScriptInterface::luaPlayerGetStorageValue (L=0x40040378)
    at /home/otsmanager/custom/src/luascript.cpp:9181
        player = 0x7fffda839690
        key = 932214
        value = 1074004856
#6  0x00007ffff772cfb7 in ?? () from /usr/lib/x86_64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
#7  0x00007ffff777b4a4 in lua_pcall () from /usr/lib/x86_64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
#8  0x00005555556f2ce6 in LuaScriptInterface::protectedCall (L=0x40040378, nargs=0, nresults=1)
    at /home/otsmanager/custom/src/luascript.cpp:302
        error_index = 4
        ret = 21845
#9  0x00005555556f3df4 in LuaScriptInterface::callFunction (this=0x555555a85ac0 <g_luaEnvironment>, params=0)
    at /home/otsmanager/custom/src/luascript.cpp:547
        result = false
        size = 4
#10 0x000055555579140c in LuaEnvironment::executeTimerEvent (this=0x555555a85ac0 <g_luaEnvironment>, eventIndex=15374366)
    at /home/otsmanager/custom/src/luascript.cpp:16968
        env = 0x555555a85ca0 <LuaScriptInterface::scriptEnv>
        it = {<std::__detail::_Node_iterator_base<std::pair<unsigned int const, LuaTimerEventDesc>, false>> = {
            _M_cur = 0x7fffd46eaeb0}, <No data fields>}
        timerEventDesc = {scriptId = 1057, function = 3803, parameters = std::vector of length 0, capacity 0, eventId = 267803337}
#11 0x00005555557af003 in std::__invoke_impl<void, void (LuaEnvironment::*&)(unsigned int), LuaEnvironment*&, unsigned int&> (__f=
    @0x7fffd014e090: (void (LuaEnvironment::*)(LuaEnvironment * const, unsigned int)) 0x555555791238 <LuaEnvironment::executeTimerEvent(unsigned int)>, [email protected]: 0x555555a85ac0 <g_luaEnvironment>) at /usr/include/c++/9/bits/invoke.h:73
No locals.
#12 0x00005555557ac153 in std::__invoke<void (LuaEnvironment::*&)(unsigned int), LuaEnvironment*&, unsigned int&> (__fn=
    @0x7fffd014e090: (void (LuaEnvironment::*)(LuaEnvironment * const, unsigned int)) 0x555555791238 <LuaEnvironment::executeTimerEvent(unsigned int)>) at /usr/include/c++/9/bits/invoke.h:95
No locals.
#13 0x00005555557a7954 in std::_Bind<void (LuaEnvironment::*(LuaEnvironment*, unsigned int))(unsigned int)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) (this=0x7fffd014e090, __args=...) at /usr/include/c++/9/functional:400
No locals.
#14 0x00005555557a16c3 in std::_Bind<void (LuaEnvironment::*(LuaEnvironment*, unsigned int))(unsigned int)>::operator()<, void>() (
    this=0x7fffd014e090) at /usr/include/c++/9/functional:484
No locals.
#15 0x000055555579ac75 in std::_Function_handler<void (), std::_Bind<void (LuaEnvironment::*(LuaEnvironment*, unsigned int))(unsigned int)> >::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/9/bits/std_function.h:300
No locals.
#16 0x00005555558b4eb2 in std::function<void ()>::operator()() const (this=0x7fffe32e92d0)
    at /usr/include/c++/9/bits/std_function.h:688
No locals.
#17 0x00005555558b4924 in Task::operator() (this=0x7fffe32e92c0) at /home/otsmanager/custom/src/tasks.h:41
No locals.
#18 0x00005555558b4b90 in Dispatcher::threadMain (this=0x555555a86640 <g_dispatcher>) at /home/otsmanager/custom/src/tasks.cpp:57
        task = 0x7fffe32e92c0
        __for_range = std::vector of length 1, capacity 8192 = {0x7fffe32e92c0}
        __for_begin = 0x7fffe32e92c0
        __for_end = 0x7fffe1382d20
        tmpTaskList = std::vector of length 1, capacity 8192 = {0x7fffe32e92c0}
        taskLockUnique = {_M_device = 0x555555a86650 <g_dispatcher+16>, _M_owns = false}
#19 0x0000555555804af6 in std::__invoke_impl<void, void (Dispatcher::*)(), Dispatcher*> (
    [email protected]: (void (Dispatcher::*)(Dispatcher * const)) 0x5555558b4a4e <Dispatcher::threadMain()>,
    [email protected]: 0x555555a86640 <g_dispatcher>) at /usr/include/c++/9/bits/invoke.h:73
No locals.
#20 0x0000555555804839 in std::__invoke<void (Dispatcher::*)(), Dispatcher*> (
    [email protected]: (void (Dispatcher::*)(Dispatcher * const)) 0x5555558b4a4e <Dispatcher::threadMain()>)
    at /usr/include/c++/9/bits/invoke.h:95
No locals.
#21 0x00005555558043c9 in std::thread::_Invoker<std::tuple<void (Dispatcher::*)(), Dispatcher*> >::_M_invoke<0ul, 1ul> (
    this=0x555555ab8068) at /usr/include/c++/9/thread:244
No locals.
#22 0x0000555555803de2 in std::thread::_Invoker<std::tuple<void (Dispatcher::*)(), Dispatcher*> >::operator() (this=0x555555ab8068)
    at /usr/include/c++/9/thread:251
No locals.
#23 0x000055555580352e in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (Dispatcher::*)(), Dispatcher*> > >::_M_run (this=0x555555ab8060) at /usr/include/c++/9/thread:195
No locals.
#24 0x00007ffff7e8fde4 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
No symbol table info available.
#25 0x00007ffff7fa4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737319798528, 6288808686363376670, 140737488347486, 140737488347487,
                140737488347488, 140737319796608, -6288786730462708706, -6288791055328969698}, mask_was_saved = 0}}, priv = {
            pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
#26 0x00007ffff7cce293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.
(gdb)
 
Solution
You should pass player uid as argument then check if player exsist in the addEvent.
Lua:
addEvent(function(id)
    local myPlayer = Player(id)
    if not myPlayer then
        return
    end

    if myPlayer:getStorageValue(fishHireStorage) ~= 1 then
        myPlayer:setStorageValue(fishHireStorage, 0)
        myPlayer:teleportTo(Position(1010, 1129, 4))
    end
end, 2 * 60 * 1000, player.uid)

drakylucas

Well-Known Member
Joined
Dec 15, 2015
Messages
185
Solutions
3
Reaction score
81
I'm not sure, but maybe you are using player:getStorageValue in a player that doesn't exist anymore in memory (I mean, using it in an addEvent that the player is already offline, something like this?)
 
OP
OP
Mjmackan

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
I'm not sure, but maybe you are using player:getStorageValue in a player that doesn't exist anymore in memory (I mean, using it in an addEvent that the player is already offline, something like this?)

Thanks, It looked cleaner when pasting it here onto otland, now i found out the storage ID, i have something to search for!

Edit: Its this that caused it, whats wrong though?
Lua:
    addEvent(function()
local creature = Player(player)
if not creature or creature:isRemoved() or player:getStorageValue(fishHireStorage) ~= 1 then
    return
end
player:setStorageValue(fishHireStorage, 0)
player:teleportTo({x=1010,y=1129,z=4})
end, 2 * 60 * 1000 * getStorage(fishHireStorage), player)
 
Last edited:

kamilcioo

Veteran OT User
Joined
Jul 25, 2008
Messages
952
Solutions
1
Reaction score
277
Thanks, It looked cleaner when pasting it here onto otland, now i found out the storage ID, i have something to search for!

Edit: Its this that caused it, whats wrong though?
Lua:
    addEvent(function()
local creature = Player(player)
if not creature or creature:isRemoved() or player:getStorageValue(fishHireStorage) ~= 1 then
    return
end
player:setStorageValue(fishHireStorage, 0)
player:teleportTo({x=1010,y=1129,z=4})
end, 2 * 60 * 1000 * getStorage(fishHireStorage), player)
Use creature to get, set, teleport instead of player since you defined creature as a player. player in your code is just cid
 

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,782
Solutions
31
Reaction score
2,255
Location
Sweden?
You should pass player uid as argument then check if player exsist in the addEvent.
Lua:
addEvent(function(id)
    local myPlayer = Player(id)
    if not myPlayer then
        return
    end

    if myPlayer:getStorageValue(fishHireStorage) ~= 1 then
        myPlayer:setStorageValue(fishHireStorage, 0)
        myPlayer:teleportTo(Position(1010, 1129, 4))
    end
end, 2 * 60 * 1000, player.uid)
 
Solution
OP
OP
Mjmackan

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
Use creature to get, set, teleport instead of player since you defined creature as a player. player in your code is just cid

You should pass player uid as argument then check if player exsist in the addEvent.
Lua:
addEvent(function(id)
    local myPlayer = Player(id)
    if not myPlayer then
        return
    end

    if myPlayer:getStorageValue(fishHireStorage) ~= 1 then
        myPlayer:setStorageValue(fishHireStorage, 0)
        myPlayer:teleportTo(Position(1010, 1129, 4))
    end
end, 2 * 60 * 1000, player.uid)
Thanks for the explaining! ❤️
 
Top