mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-06-17 14:12:25 +00:00
bump to 2.3.1, fix sentry
Fix sentry url length print remove quotes github actions is cursed add debug print test action Dont use curl on windows I dont know why the windows build doesnt report to sentry, so ill try this. Change timeout to 20 minutes instead of 5 this is a hacky workaround anyways, so i really dont see why it should only be 5. 5 is barely enough. temporarily enable debug mode on sentry CMake: Use breakpad on windows instead of crashpad CMake: Sentry: use inproc backend Since cmake refuses to set my variables, I will do it this way. I am so tired of this github workflow garbage Sentry: disable debug again, set sentry_options_set_symbolize_stacktraces to true, fix memory leak Sentry: hotfix: dont free options somehow that causes it to crash, and i cannot be bothered to find out why right now
This commit is contained in:
@@ -15,7 +15,10 @@ jobs:
|
|||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
|
env:
|
||||||
|
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
||||||
run: |
|
run: |
|
||||||
|
echo ${#beammp_sentry_url}
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libz-dev rapidjson-dev liblua5.3 libssl-dev libwebsocketpp-dev libcurl4-openssl-dev
|
sudo apt-get install -y libz-dev rapidjson-dev liblua5.3 libssl-dev libwebsocketpp-dev libcurl4-openssl-dev
|
||||||
sudo add-apt-repository ppa:mhier/libboost-latest
|
sudo add-apt-repository ppa:mhier/libboost-latest
|
||||||
@@ -29,7 +32,7 @@ jobs:
|
|||||||
working-directory: ${{github.workspace}}/build-linux
|
working-directory: ${{github.workspace}}/build-linux
|
||||||
env:
|
env:
|
||||||
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
||||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=g++-10 -DBEAMMP_SECRET_SENTRY_URL='$beammp_sentry_url'
|
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=g++-10 -DBEAMMP_SECRET_SENTRY_URL="$beammp_sentry_url"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{github.workspace}}/build-linux
|
working-directory: ${{github.workspace}}/build-linux
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
working-directory: ${{github.workspace}}/build-windows
|
working-directory: ${{github.workspace}}/build-windows
|
||||||
env:
|
env:
|
||||||
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
||||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE='${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBEAMMP_SECRET_SENTRY_URL='$beammp_sentry_url'
|
run: cmake $GITHUB_WORKSPACE -DSENTRY_BACKEND=breakpad -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE='${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBEAMMP_SECRET_SENTRY_URL="$beammp_sentry_url"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{github.workspace}}/build-windows
|
working-directory: ${{github.workspace}}/build-windows
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ jobs:
|
|||||||
working-directory: ${{github.workspace}}/build-linux
|
working-directory: ${{github.workspace}}/build-linux
|
||||||
env:
|
env:
|
||||||
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
||||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=g++-10 -DBEAMMP_SECRET_SENTRY_URL='$beammp_sentry_url'
|
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=g++-10 -DBEAMMP_SECRET_SENTRY_URL="$beammp_sentry_url"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{github.workspace}}/build-linux
|
working-directory: ${{github.workspace}}/build-linux
|
||||||
@@ -98,7 +98,7 @@ jobs:
|
|||||||
working-directory: ${{github.workspace}}/build-windows
|
working-directory: ${{github.workspace}}/build-windows
|
||||||
env:
|
env:
|
||||||
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
|
||||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE='${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBEAMMP_SECRET_SENTRY_URL='$beammp_sentry_url'
|
run: cmake $GITHUB_WORKSPACE -DSENTRY_BACKEND=breakpad -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE='${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBEAMMP_SECRET_SENTRY_URL="$beammp_sentry_url"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{github.workspace}}/build-windows
|
working-directory: ${{github.workspace}}/build-windows
|
||||||
|
|||||||
+3
-3
@@ -15,12 +15,12 @@ if (WIN32)
|
|||||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(SENTRY_TRANSPORT "curl")
|
|
||||||
include_directories("include/sentry-native/include")
|
include_directories("include/sentry-native/include")
|
||||||
set(SENTRY_BUILD_SHARED_LIBS OFF)
|
set(SENTRY_BUILD_SHARED_LIBS OFF)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(SENTRY_BUILD_RUNTIMESTATIC ON)
|
set(SENTRY_BUILD_RUNTIMESTATIC ON)
|
||||||
endif()
|
endif()
|
||||||
|
set(SENTRY_BACKEND breakpad)
|
||||||
add_subdirectory("include/sentry-native")
|
add_subdirectory("include/sentry-native")
|
||||||
|
|
||||||
message(STATUS "Setting compiler flags")
|
message(STATUS "Setting compiler flags")
|
||||||
@@ -35,7 +35,7 @@ elseif (UNIX)
|
|||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -s -fno-builtin")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -s -fno-builtin")
|
||||||
if (SANITIZE)
|
if (SANITIZE)
|
||||||
message(STATUS "sanitize is ON")
|
message(STATUS "sanitize is ON")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,thread")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLanAGS} -fsanitize=undefined,thread")
|
||||||
endif (SANITIZE)
|
endif (SANITIZE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ if (NOT DEFINED BEAMMP_SECRET_SENTRY_URL)
|
|||||||
This is not an error, and if you're building the BeamMP-Server yourself, this is expected and can be ignored.")
|
This is not an error, and if you're building the BeamMP-Server yourself, this is expected and can be ignored.")
|
||||||
set(BEAMMP_SECRET_SENTRY_URL "")
|
set(BEAMMP_SECRET_SENTRY_URL "")
|
||||||
else()
|
else()
|
||||||
string(LENGTH BEAMMP_SECRET_SENTRY_URL URL_LEN)
|
string(LENGTH ${BEAMMP_SECRET_SENTRY_URL} URL_LEN)
|
||||||
message(STATUS "Sentry URL is length ${URL_LEN}")
|
message(STATUS "Sentry URL is length ${URL_LEN}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ public:
|
|||||||
// Causes all threads to finish up and exit gracefull gracefully
|
// Causes all threads to finish up and exit gracefull gracefully
|
||||||
static void GracefullyShutdown();
|
static void GracefullyShutdown();
|
||||||
static TConsole& Console() { return *mConsole; }
|
static TConsole& Console() { return *mConsole; }
|
||||||
static std::string ServerVersion() { return "2.3.0"; }
|
static std::string ServerVersion() { return "2.3.1"; }
|
||||||
static std::string ClientVersion() { return "2.0"; }
|
static std::string ClientVersion() { return "2.0"; }
|
||||||
static std::string PPS() { return mPPS; }
|
static std::string PPS() { return mPPS; }
|
||||||
static void SetPPS(const std::string& NewPPS) { mPPS = NewPPS; }
|
static void SetPPS(const std::string& NewPPS) { mPPS = NewPPS; }
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ enum class SentryLevel {
|
|||||||
// singleton, dont make this twice
|
// singleton, dont make this twice
|
||||||
class TSentry final {
|
class TSentry final {
|
||||||
public:
|
public:
|
||||||
TSentry(const std::string& SentryUrl);
|
TSentry();
|
||||||
~TSentry();
|
~TSentry();
|
||||||
|
|
||||||
void PrintWelcome();
|
void PrintWelcome();
|
||||||
|
|||||||
+2
-2
@@ -44,7 +44,7 @@ void TPPSMonitor::operator()() {
|
|||||||
V += c->GetCarCount();
|
V += c->GetCarCount();
|
||||||
}
|
}
|
||||||
// kick on "no ping"
|
// kick on "no ping"
|
||||||
if (c->SecondsSinceLastPing() > (5 * 60)) {
|
if (c->SecondsSinceLastPing() > (20 * 60)) {
|
||||||
debug("client " + std::string("(") + std::to_string(c->GetID()) + ")" + c->GetName() + " timing out: " + std::to_string(c->SecondsSinceLastPing()) + ", pps: " + Application::PPS());
|
debug("client " + std::string("(") + std::to_string(c->GetID()) + ")" + c->GetName() + " timing out: " + std::to_string(c->SecondsSinceLastPing()) + ", pps: " + Application::PPS());
|
||||||
TimedOutClients.push_back(c);
|
TimedOutClients.push_back(c);
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ void TPPSMonitor::operator()() {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
for (auto& ClientToKick : TimedOutClients) {
|
for (auto& ClientToKick : TimedOutClients) {
|
||||||
Network().ClientKick(*ClientToKick, "Timeout (no ping for >5 min)");
|
Network().ClientKick(*ClientToKick, "Timeout (no ping for way too long)");
|
||||||
}
|
}
|
||||||
TimedOutClients.clear();
|
TimedOutClients.clear();
|
||||||
if (C == 0 || mInternalPPS == 0) {
|
if (C == 0 || mInternalPPS == 0) {
|
||||||
|
|||||||
+14
-3
@@ -4,13 +4,23 @@
|
|||||||
#include <sentry.h>
|
#include <sentry.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
TSentry::TSentry(const std::string& SentryUrl) {
|
static size_t SentryUrlLen;
|
||||||
if (SentryUrl.empty()) {
|
|
||||||
|
// compile-time length of a string/array
|
||||||
|
template <size_t N>
|
||||||
|
constexpr size_t ConstexprLength(char const (&)[N]) {
|
||||||
|
return N - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TSentry::TSentry() {
|
||||||
|
if constexpr (ConstexprLength(SECRET_SENTRY_URL) == 0) {
|
||||||
mValid = false;
|
mValid = false;
|
||||||
} else {
|
} else {
|
||||||
mValid = true;
|
mValid = true;
|
||||||
sentry_options_t* options = sentry_options_new();
|
sentry_options_t* options = sentry_options_new();
|
||||||
sentry_options_set_dsn(options, SentryUrl.c_str());
|
sentry_options_set_dsn(options, SECRET_SENTRY_URL);
|
||||||
|
sentry_options_set_debug(options, false); // needs to always be false
|
||||||
|
sentry_options_set_symbolize_stacktraces(options, true);
|
||||||
auto ReleaseString = "BeamMP-Server@" + Application::ServerVersion();
|
auto ReleaseString = "BeamMP-Server@" + Application::ServerVersion();
|
||||||
sentry_options_set_release(options, ReleaseString.c_str());
|
sentry_options_set_release(options, ReleaseString.c_str());
|
||||||
sentry_options_set_max_breadcrumbs(options, 10);
|
sentry_options_set_max_breadcrumbs(options, 10);
|
||||||
@@ -27,6 +37,7 @@ TSentry::~TSentry() {
|
|||||||
void TSentry::PrintWelcome() {
|
void TSentry::PrintWelcome() {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
info("Sentry started");
|
info("Sentry started");
|
||||||
|
debug("Sentry URL is length " + std::to_string(SentryUrlLen));
|
||||||
} else {
|
} else {
|
||||||
info("Sentry disabled in unofficial build");
|
info("Sentry disabled in unofficial build");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-7
@@ -36,13 +36,9 @@ void UnixSignalHandler(int sig) {
|
|||||||
}
|
}
|
||||||
#endif // __unix
|
#endif // __unix
|
||||||
|
|
||||||
int constexpr length(const char* str) {
|
|
||||||
return *str ? 1 + length(str + 1) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is provided by the build system, leave empty for source builds
|
// this is provided by the build system, leave empty for source builds
|
||||||
// global, yes, this is ugly, no, it cant be done another way
|
// global, yes, this is ugly, no, it cant be done another way
|
||||||
TSentry Sentry { SECRET_SENTRY_URL };
|
TSentry Sentry {};
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -57,8 +53,6 @@ int main(int argc, char** argv) try {
|
|||||||
#endif // __unix
|
#endif // __unix
|
||||||
setlocale(LC_ALL, "C");
|
setlocale(LC_ALL, "C");
|
||||||
|
|
||||||
static_assert(length(SECRET_SENTRY_URL) != 0);
|
|
||||||
|
|
||||||
bool Shutdown = false;
|
bool Shutdown = false;
|
||||||
Application::RegisterShutdownHandler([&Shutdown] { Shutdown = true; });
|
Application::RegisterShutdownHandler([&Shutdown] { Shutdown = true; });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user