aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-08-21 18:48:52 +0200
committerStefan Boberg <[email protected]>2021-08-21 18:48:52 +0200
commit276bb86fca388416428613dec981e4e5eb927081 (patch)
treea42f0beb32fd1e61754e007d6ce26809f060a993
parentImproved comment while reviewing code (diff)
downloadzen-276bb86fca388416428613dec981e4e5eb927081.tar.xz
zen-276bb86fca388416428613dec981e4e5eb927081.zip
Improved crash reporting setup and removed old stubs
Also added ability to exercise crash reporting from command line
-rw-r--r--zenserver/config.cpp7
-rw-r--r--zenserver/config.h1
-rw-r--r--zenserver/diag/crashreport.cpp12
-rw-r--r--zenserver/diag/crashreport.h9
-rw-r--r--zenserver/zenserver.cpp25
-rw-r--r--zenserver/zenserver.vcxproj2
-rw-r--r--zenserver/zenserver.vcxproj.filters2
7 files changed, 26 insertions, 32 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 79433f20c..6d725e55b 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -88,6 +88,13 @@ ParseGlobalCliOptions(int argc, char* argv[], ZenServerOptions& GlobalOptions, Z
cxxopts::value<bool>(ServiceConfig.MeshEnabled)->default_value("true"),
"");
+ options.add_option("diagnostics",
+ "",
+ "crash",
+ "Simulate a crash",
+ cxxopts::value<bool>(ServiceConfig.ShouldCrash)->default_value("false"),
+ "");
+
try
{
auto result = options.parse(argc, argv);
diff --git a/zenserver/config.h b/zenserver/config.h
index e33b27962..53538314d 100644
--- a/zenserver/config.h
+++ b/zenserver/config.h
@@ -20,6 +20,7 @@ struct ZenServiceConfig
{
bool LegacyCacheEnabled = false;
bool StructuredCacheEnabled = true;
+ bool ShouldCrash = false; // Option for testing crash handling
bool MeshEnabled = false; // Experimental p2p mesh discovery
std::string FlockId; // Id for grouping test instances into sets
};
diff --git a/zenserver/diag/crashreport.cpp b/zenserver/diag/crashreport.cpp
deleted file mode 100644
index b9b8b5020..000000000
--- a/zenserver/diag/crashreport.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "crashreport.h"
-
-#include <zencore/filesystem.h>
-#include <zencore/zencore.h>
-
-void
-InitializeCrashReporting(const std::filesystem::path&)
-{
- // TODO: properly implement crash reporting
-}
diff --git a/zenserver/diag/crashreport.h b/zenserver/diag/crashreport.h
deleted file mode 100644
index 6369d1cf5..000000000
--- a/zenserver/diag/crashreport.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-namespace std::filesystem {
-class path;
-}
-
-void InitializeCrashReporting(const std::filesystem::path& DumpPath);
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 1d1711dfe..d9f72ed12 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -38,7 +38,6 @@
#include "casstore.h"
#include "config.h"
-#include "diag/crashreport.h"
#include "diag/logging.h"
#define SENTRY_BUILD_STATIC 1
@@ -74,6 +73,8 @@ public:
using namespace fmt::literals;
spdlog::info(ZEN_APP_NAME " initializing");
+ m_DebugOptionForcedCrash = ServiceConfig.ShouldCrash;
+
if (ParentPid)
{
m_Process.Initialize(ParentPid);
@@ -195,6 +196,13 @@ public:
spdlog::info(ZEN_APP_NAME " now running");
+ sentry_clear_modulecache();
+
+ if (m_DebugOptionForcedCrash)
+ {
+ __debugbreak();
+ }
+
m_Http.Run(m_TestMode);
spdlog::info(ZEN_APP_NAME " exiting");
@@ -288,6 +296,8 @@ private:
HttpAdminService m_AdminService;
HttpHealthService m_HealthService;
zen::Mesh m_ZenMesh{m_IoContext};
+
+ bool m_DebugOptionForcedCrash = false;
};
int
@@ -295,18 +305,19 @@ main(int argc, char* argv[])
{
mi_version();
+ ZenServerOptions GlobalOptions;
+ ZenServiceConfig ServiceConfig;
+ ParseGlobalCliOptions(argc, argv, GlobalOptions, ServiceConfig);
+ InitializeLogging(GlobalOptions);
+
+ // Initialize sentry.io client
+
sentry_options_t* SentryOptions = sentry_options_new();
sentry_options_set_dsn(SentryOptions, "https://[email protected]/5919284");
sentry_init(SentryOptions);
auto _ = zen::MakeGuard([&] { sentry_close(); });
- ZenServerOptions GlobalOptions;
- ZenServiceConfig ServiceConfig;
- ParseGlobalCliOptions(argc, argv, GlobalOptions, ServiceConfig);
- InitializeCrashReporting(GlobalOptions.DataDir / "crashdumps");
- InitializeLogging(GlobalOptions);
-
// Prototype config system, let's see how this pans out
ParseServiceConfig(GlobalOptions.DataDir, /* out */ ServiceConfig);
diff --git a/zenserver/zenserver.vcxproj b/zenserver/zenserver.vcxproj
index 89784300b..6c87b4a68 100644
--- a/zenserver/zenserver.vcxproj
+++ b/zenserver/zenserver.vcxproj
@@ -108,7 +108,6 @@
<ClInclude Include="cache\structuredcachestore.h" />
<ClInclude Include="compute\apply.h" />
<ClInclude Include="config.h" />
- <ClInclude Include="diag\crashreport.h" />
<ClInclude Include="diag\logging.h" />
<ClInclude Include="sos\sos.h" />
<ClInclude Include="upstream\jupiter.h" />
@@ -130,7 +129,6 @@
<ClCompile Include="cache\structuredcachestore.cpp" />
<ClCompile Include="compute\apply.cpp" />
<ClCompile Include="config.cpp" />
- <ClCompile Include="diag\crashreport.cpp" />
<ClCompile Include="diag\logging.cpp" />
<ClCompile Include="projectstore.cpp" />
<ClCompile Include="cache\cacheagent.cpp" />
diff --git a/zenserver/zenserver.vcxproj.filters b/zenserver/zenserver.vcxproj.filters
index 95cba466f..79fcfb803 100644
--- a/zenserver/zenserver.vcxproj.filters
+++ b/zenserver/zenserver.vcxproj.filters
@@ -35,7 +35,6 @@
</ClInclude>
<ClInclude Include="config.h" />
<ClInclude Include="diag\logging.h" />
- <ClInclude Include="diag\crashreport.h" />
<ClInclude Include="cache\structuredcachestore.h" />
<ClInclude Include="compute\apply.h" />
<ClInclude Include="sos\sos.h" />
@@ -69,7 +68,6 @@
</ClCompile>
<ClCompile Include="config.cpp" />
<ClCompile Include="diag\logging.cpp" />
- <ClCompile Include="diag\crashreport.cpp" />
<ClCompile Include="cache\structuredcachestore.cpp" />
<ClCompile Include="compute\apply.cpp" />
<ClCompile Include="sos\sos.cpp" />