Fill out general information
OS (windows, linux, ...): debian12
BeamMP-Server Version: v3.9.2
Describe the bug
When client crashes or ALT + F4, or any other case where the connection is not closed properly. The server might crash with a core dump.
To Reproduce
Steps to reproduce the behavior:
- Go on a server, and close the launcher !
Expected behavior
The server does not crahes (I guess 😆)
Logs
Sorry, there is nothing logged, just a SIGABRT.
Additional context
The server crashes with a SIGABRT caused by an uncaught boost::system::system_error exception escaping the thread's boundary, triggering std::terminate().
src/TNetwork.cpp:652:
void TNetwork::DisconnectClient(TClient &c, const std::string &R)
{
if (c.IsDisconnected()) return;
// THIS LINE THROWS when the socket is already closed:
std::string ClientIP = c.GetTCPSock().remote_endpoint().address().to_string();
mClientMapMutex.lock();
if (mClientMap[ClientIP] > 0) {
mClientMap[ClientIP]--;
}
if (mClientMap[ClientIP] == 0) {
mClientMap.erase(ClientIP);
}
mClientMapMutex.unlock();
c.Disconnect(R);
}
BUT, the fix is not as simple as a try / catch because of the mClientMap, my best bet would be to save the client's ip inside of TClient at all times. If you have any other idea, please tell me.
Fill out general information
OS (windows, linux, ...): debian12
BeamMP-Server Version: v3.9.2
Describe the bug
When client crashes or
ALT+F4, or any other case where the connection is not closed properly. The server might crash with a core dump.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The server does not crahes (I guess 😆)
Logs
Sorry, there is nothing logged, just a SIGABRT.
Additional context
The server crashes with a SIGABRT caused by an uncaught
boost::system::system_errorexception escaping the thread's boundary, triggeringstd::terminate().src/TNetwork.cpp:652:BUT, the fix is not as simple as a
try / catchbecause of themClientMap, my best bet would be to save the client's ip inside ofTClientat all times. If you have any other idea, please tell me.