• 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!

TFS 1.X+ my TFS 8.6 crashes multiple times/day in function Player::~Player

TheGahl

Learning in Progress
Joined
Jul 28, 2018
Messages
200
Solutions
3
Reaction score
124
Hello,

My OT runs on ubuntu and have 1-20 players online.
and I've had these crashes for a long time but I can't figure out why it happens.

Someone told me to install gdb to make debug and I get this when the ot crashes:

gdb > bt
Code:
Reading symbols from world...done.
[New LWP 3585]
[New LWP 3587]
[New LWP 3586]
[New LWP 3584]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./world'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000985969 in Player::~Player (this=0x7fd2c34b6330, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/otsmanager/flamek/source/src/player.cpp:157
157                             item->setParent(nullptr);
[Current thread is 1 (Thread 0x7fd2f139a700 (LWP 3585))]
(gdb) bt
#0  0x0000000000985969 in Player::~Player (this=0x7fd2c34b6330, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/otsmanager/flamek/source/src/player.cpp:157
#1  0x0000000000985b82 in Player::~Player (this=0x7fd2c34b6330, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/otsmanager/flamek/source/src/player.cpp:168
#2  0x00000000007f2c3a in Creature::decrementReferenceCounter (this=0x7fd2c34b6330) at /home/otsmanager/flamek/source/src/creature.h:463
#3  0x0000000000822dd7 in Game::cleanup (this=0xd3af20 <g_game>) at /home/otsmanager/flamek/source/src/game.cpp:3975
#4  0x000000000081f384 in Game::checkCreatures (this=0xd3af20 <g_game>, index=8) at /home/otsmanager/flamek/source/src/game.cpp:3264
#5  0x000000000084749c in std::_Mem_fn_base<void (Game::*)(unsigned long), true>::operator()<unsigned long&, void> (this=0x7fd2d00c2860, __object=0xd3af20 <g_game>) at /usr/include/c++/5/functional:600
#6  0x000000000084303a in std::_Bind<std::_Mem_fn<void (Game::*)(unsigned long)> (Game*, unsigned long)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) (this=0x7fd2d00c2860,
    __args=<unknown type in /home/otsmanager/flamek/world, CU 0x6464d0, DIE 0x73f876>) at /usr/include/c++/5/functional:1074
#7  0x000000000083c1f3 in std::_Bind<std::_Mem_fn<void (Game::*)(unsigned long)> (Game*, unsigned long)>::operator()<, void>() (this=0x7fd2d00c2860) at /usr/include/c++/5/functional:1133
#8  0x0000000000836308 in std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void (Game::*)(unsigned long)> (Game*, unsigned long)> >::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/5/functional:1871
#9  0x00000000009e92fc in std::function<void ()>::operator()() const (this=0x7fd2eff3d060) at /usr/include/c++/5/functional:2267
#10 0x00000000009e917a in Task::operator() (this=0x7fd2eff3d050) at /home/otsmanager/flamek/source/src/tasks.h:42
#11 0x00000000009e89a0 in Dispatcher::threadMain (this=0xd3ad40 <g_dispatcher>) at /home/otsmanager/flamek/source/src/tasks.cpp:50
#12 0x0000000000977d47 in std::_Mem_fn_base<void (Dispatcher::*)(), true>::operator()<, void>(Dispatcher*) const (this=0xd59f30, __object=0xd3ad40 <g_dispatcher>) at /usr/include/c++/5/functional:600
#13 0x0000000000977b6b in std::_Bind_simple<std::_Mem_fn<void (Dispatcher::*)()> (Dispatcher*)>::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0xd59f28) at /usr/include/c++/5/functional:1531
#14 0x00000000009777f4 in std::_Bind_simple<std::_Mem_fn<void (Dispatcher::*)()> (Dispatcher*)>::operator()() (this=0xd59f28) at /usr/include/c++/5/functional:1520
#15 0x00000000009774e6 in std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (Dispatcher::*)()> (Dispatcher*)> >::_M_run() (this=0xd59f10) at /usr/include/c++/5/thread:115
#16 0x00007fd2f2838c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#17 0x00007fd2f2b096ba in start_thread (arg=0x7fd2f139a700) at pthread_create.c:333
#18 0x00007fd2f1f9e41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

gdb > bt full
Code:
#0  0x0000000000985969 in Player::~Player (this=0x7fd2c34b6330, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/otsmanager/flamek/source/src/player.cpp:157
        item = 0x7fd2c85bbca0
        __for_range = @0x7fd2c34b6938: {0x0, 0x0, 0x0, 0x7fd2c0eda640, 0x0, 0x7fd2c85bbca0, 0x7fd2d39022d0, 0x0, 0x0, 0x0, 0x0}
        __for_begin = 0x7fd2c34b6960
        __for_end = 0x7fd2c34b6990
#1  0x0000000000985b82 in Player::~Player (this=0x7fd2c34b6330, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/otsmanager/flamek/source/src/player.cpp:168
No locals.
#2  0x00000000007f2c3a in Creature::decrementReferenceCounter (this=0x7fd2c34b6330) at /home/otsmanager/flamek/source/src/creature.h:463
No locals.
#3  0x0000000000822dd7 in Game::cleanup (this=0xd3af20 <g_game>) at /home/otsmanager/flamek/source/src/game.cpp:3975
        creature = 0x7fd2c34b6330
        __for_range = std::vector of length 7, capacity 512 = {0x7fd2c34b6330, 0x7fd2cc6b0910, 0x7fd2ca357830, 0x7fd2ef6acc40, 0x7fd2cc2ffc90, 0x7fd2ee95eb30, 0x7fd2ca19bff0}
        __for_begin =
        __for_end =
#4  0x000000000081f384 in Game::checkCreatures (this=0xd3af20 <g_game>, index=8) at /home/otsmanager/flamek/source/src/game.cpp:3264
        checkCreatureList = @0xd3b310: {<std::__cxx11::_List_base<Creature*, std::allocator<Creature*> >> = {
            _M_impl = {<std::allocator<std::_List_node<Creature*> >> = {<__gnu_cxx::new_allocator<std::_List_node<Creature*> >> = {<No data fields>}, <No data fields>}, _M_node = {<std::__detail::_List_node_base> = {
                  _M_next = 0x7fd2c4031230, _M_prev = 0x7fd2c8b6d460}, _M_data = 218}}}, <No data fields>}
        it =
        end =
#5  0x000000000084749c in std::_Mem_fn_base<void (Game::*)(unsigned long), true>::operator()<unsigned long&, void> (this=0x7fd2d00c2860, __object=0xd3af20 <g_game>) at /usr/include/c++/5/functional:600
No locals.
#6  0x000000000084303a in std::_Bind<std::_Mem_fn<void (Game::*)(unsigned long)> (Game*, unsigned long)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) (this=0x7fd2d00c2860,
    __args=<unknown type in /home/otsmanager/flamek/world, CU 0x6464d0, DIE 0x73f876>) at /usr/include/c++/5/functional:1074
No locals.
#7  0x000000000083c1f3 in std::_Bind<std::_Mem_fn<void (Game::*)(unsigned long)> (Game*, unsigned long)>::operator()<, void>() (this=0x7fd2d00c2860) at /usr/include/c++/5/functional:1133
No locals.
#8  0x0000000000836308 in std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void (Game::*)(unsigned long)> (Game*, unsigned long)> >::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/5/functional:1871
No locals.
#9  0x00000000009e92fc in std::function<void ()>::operator()() const (this=0x7fd2eff3d060) at /usr/include/c++/5/functional:2267
No locals.
#10 0x00000000009e917a in Task::operator() (this=0x7fd2eff3d050) at /home/otsmanager/flamek/source/src/tasks.h:42
No locals.
#11 0x00000000009e89a0 in Dispatcher::threadMain (this=0xd3ad40 <g_dispatcher>) at /home/otsmanager/flamek/source/src/tasks.cpp:50
        task = 0x7fd2eff3d050
        taskLockUnique = {_M_device = 0xd3ad58 <g_dispatcher+24>, _M_owns = false}
#12 0x0000000000977d47 in std::_Mem_fn_base<void (Dispatcher::*)(), true>::operator()<, void>(Dispatcher*) const (this=0xd59f30, __object=0xd3ad40 <g_dispatcher>) at /usr/include/c++/5/functional:600
No locals.
#13 0x0000000000977b6b in std::_Bind_simple<std::_Mem_fn<void (Dispatcher::*)()> (Dispatcher*)>::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0xd59f28) at /usr/include/c++/5/functional:1531
No locals.
#14 0x00000000009777f4 in std::_Bind_simple<std::_Mem_fn<void (Dispatcher::*)()> (Dispatcher*)>::operator()() (this=0xd59f28) at /usr/include/c++/5/functional:1520
No locals.
#15 0x00000000009774e6 in std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (Dispatcher::*)()> (Dispatcher*)> >::_M_run() (this=0xd59f10) at /usr/include/c++/5/thread:115
No locals.
#16 0x00007fd2f2838c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
No symbol table info available.
#17 0x00007fd2f2b096ba in start_thread (arg=0x7fd2f139a700) at pthread_create.c:333
        __res = <optimized out>
        pd = 0x7fd2f139a700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140543966947072, 6026604292297397613, 0, 140723746064543, 140543966947776, 0, -6050816037660977811, -6050821612817541779}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0},
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#18 0x00007fd2f1f9e41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
No locals.

But I don't understand it, I tried to look in C++ for the functions but it make no sense to me..
source/player.cpp
C++:
Player::~Player()
{
    for (Item* item : inventory) {
        if (item) {
            item->setParent(nullptr);
            item->decrementReferenceCounter();
        }
    }

    for (const auto& it : depotLockerMap) {
        it.second->decrementReferenceCounter();
    }

    setWriteItem(nullptr);
    setEditHouse(nullptr);
}

If I understands this correctly, it's the
C++:
item->setParent(nullptr);
that crashes the server, but why?
What's this function for Player::~Player()?
What would happen to the ot if I removed the the crashing line?
 
If i see correctly you have problem not only with player.cpp in that lines but with:
Code:
player.cpp in line 157 (player.cpp:157)
player.cpp in line 168 (player.cpp:168)
game.cpp in line 3264 (game.cpp:3264)
tasks.cpp in line 50 (tasks.cpp:50)
too..

And also the
Code:
Player::~Player()
that means: std::variant::~variant - cppreference.com , but it's ok (i checked the original TFS 1.3 sources and there is this too.)
 
If i see correctly you have problem not only with player.cpp in that lines but with:
Code:
player.cpp in line 157 (player.cpp:157)
player.cpp in line 168 (player.cpp:168)
game.cpp in line 3264 (game.cpp:3264)
tasks.cpp in line 50 (tasks.cpp:50)
too..

And also the
Code:
Player::~Player()
that means: std::variant::~variant - cppreference.com , but it's ok (i checked the original TFS 1.3 sources and there is this too.)
look up what a stacktrace is
all of those functions were called leading up to the function that crashes the server
also ~X() is a class destructor, it's not the same as a std::variant, Player is its own class and has its own destructor completely different from std::variant

what tfs are you using? have you made ANY source edits whatsoever?
are you able to replicate the crash manually?
 
Back
Top