Describe the bug
Server got randomly crashed when player disconnected. It looks like a some strange race condition
To Reproduce
Have no idea
Expected behavior
Server should not randomly crash when player is disconnected
Screenshots and/or logs
(gdb) bt
#0 0xf7a8aa60 in free () from /lib32/libc.so.6
#1 0xf7dcdf2c in operator delete(void*) () from /lib32/libstdc++.so.6
#2 0x56673beb in std::__new_allocator::deallocate (__p=0x1f <error: Cannot access memory at address 0x1f>,
__n=, this=)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/new_allocator.h:158
#3 std::allocator_traits<std::allocator >::deallocate (__p=0x1f <error: Cannot access memory at address 0x1f>,
__n=, __a=...)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:496
#4 std::_Vector_base<char, std::allocator >::_M_deallocate (
__p=0x1f <error: Cannot access memory at address 0x1f>, __n=, this=)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:387
#5 std::_Vector_base<char, std::allocator >::~_Vector_base (this=)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:366
#6 std::vector<char, std::allocator >::~vector (this=)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:733
#7 httplib::detail::SocketStream::~SocketStream (this=0xf78df854) at /host/openmp/lib/cpp-httplib/httplib.h:4723
#8 0xf61fad33 in Query::buildPlayerInfoBuffer (this=0x58765ff8, except=0xf78df854)
at /host/openmp/Server/Components/LegacyNetwork/Query/query.cpp:51
#9 0xf62196e4 in Query::buildPlayerDependentBuffers (this=0x58765ff8, except=0xf78df854)
at /host/openmp/lib/RakNet/Include/raknet/../../../../Server/Components/LegacyNetwork/Query/query.hpp:44
#10 RakNetLegacyNetwork::onPlayerDisconnect (this=, player=..., reason=)
at /host/openmp/Server/Components/LegacyNetwork/legacy_network_impl.hpp:313
#11 0xf62196e4 in non-virtual thunk to RakNetLegacyNetwork::onPlayerDisconnect(IPlayer&, PeerDisconnectReason) ()
from components/LegacyNetwork.so
#12 0x566a825e in Impl::DefaultEventDispatcher<PlayerConnectEventHandler>::dispatch<void, IPlayer&, PeerDisconnectReason, Player&, PeerDisconnectReason&> (
mf=&virtual PlayerConnectEventHandler::onPlayerDisconnect(IPlayer&, PeerDisconnectReason), this=,
args=, args=) at /host/openmp/SDK/include/Impl/events_impl.hpp:133
#13 PlayerPool::clearPlayer (this=, player=..., reason=)
--Type <RET> for more, q to quit, c to continue without paging--
at /host/openmp/Server/Source/player_pool.hpp:1791
#14 0x566968f9 in PlayerPool::onPeerDisconnect (this=, peer=..., reason=) at /host/openmp/Server/Source/player_pool.hpp:1816
#15 0x56697318 in non-virtual thunk to PlayerPool::onPeerDisconnect(IPlayer&, PeerDisconnectReason) () at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/iostream:74
#16 0xf6202f01 in Impl::DefaultEventDispatcher<NetworkEventHandler>::dispatch<void, IPlayer&, PeerDisconnectReason, IPlayer&, PeerDisconnectReason&> (
mf=&virtual NetworkEventHandler::onPeerDisconnect(IPlayer&, PeerDisconnectReason), args=, this=, args=) at /host/openmp/SDK/include/Impl/events_impl.hpp:133
#17 RakNetLegacyNetwork::OnRakNetDisconnect (this=, reason=PeerDisconnectReason_Quit, rid=) at /host/openmp/Server/Components/LegacyNetwork/legacy_network_impl.cpp:520
#18 RakNetLegacyNetwork::onTick (this=, elapsed=..., now=...) at /host/openmp/Server/Components/LegacyNetwork/legacy_network_impl.cpp:912
#19 0xf620304b in non-virtual thunk to RakNetLegacyNetwork::onTick(std::chrono::duration<long long, std::ratio<1ll, 1000000ll> >, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> > >) () at /host/openmp/Server/Components/LegacyNetwork/legacy_network_impl.cpp:919
#20 0x56678a40 in Impl::DefaultEventDispatcher<CoreEventHandler>::dispatch<void, std::chrono::duration<long long, std::ratio<1ll, 1000000ll> >, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> > >, std::chrono::duration<long long, std::ratio<1ll, 1000000ll> > const&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> > > const&> (this=,
mf=&virtual CoreEventHandler::onTick(std::chrono::duration<long long, std::ratio<1ll, 1000000ll> >, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> > >), args=..., args=...) at /host/openmp/SDK/include/Impl/events_impl.hpp:133
#21 Core::run (this=) at /host/openmp/Server/Source/core_impl.hpp:1413
#22 0x566729ee in main (argc=, argv=) at /host/openmp/Server/Source/server.cpp:153
Commit hash in master
833af233c2e297524f1cd4177ee5d9f306403a67
I've noticed here some calls to httplib::detail::SocketStream::~SocketStream and it's not clear how it appeared there, there's no any reference to it within queries component
The only thing I can tell is that at the moment before the server crash, it stuck for like a 20 seconds, and there could be some issues with dynamic ticks feature. It probably could get too high for a second if I'm correct
This should be fixed now in latest release