You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/11/08 23:26:06 UTC
[trafficserver] branch 9.2.x updated: Make sni.yaml errors cause an
unrecoverable TS crash at startup. (#8208)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new 8fc4b25 Make sni.yaml errors cause an unrecoverable TS crash at startup. (#8208)
8fc4b25 is described below
commit 8fc4b2537a581364c03043ac892407458f1beb7e
Author: Walt Karas <wk...@verizonmedia.com>
AuthorDate: Thu Oct 21 13:10:59 2021 -0500
Make sni.yaml errors cause an unrecoverable TS crash at startup. (#8208)
(cherry picked from commit a0c5ac306954e90fa79126f96d56dce342743c10)
---
include/tscore/TSSystemState.h | 21 ++++++++++++++++++---
iocore/net/SSLSNIConfig.cc | 11 +++++++++--
src/traffic_server/traffic_server.cc | 2 ++
3 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/include/tscore/TSSystemState.h b/include/tscore/TSSystemState.h
index cc5bf3d..50b86a9 100644
--- a/include/tscore/TSSystemState.h
+++ b/include/tscore/TSSystemState.h
@@ -32,13 +32,20 @@ class TSSystemState
{
private:
struct Data {
- bool ssl_handshaking_stopped;
- bool event_system_shut_down;
- bool draining;
+ bool initializing = true;
+ bool ssl_handshaking_stopped = false;
+ bool event_system_shut_down = false;
+ bool draining = false;
};
public:
static bool
+ is_initializing()
+ {
+ return unlikely(_instance().initializing);
+ }
+
+ static bool
is_ssl_handshaking_stopped()
{
return unlikely(_instance().ssl_handshaking_stopped);
@@ -59,6 +66,14 @@ public:
}
static void
+ initialization_done()
+ {
+ ink_assert(_instance().initializing);
+
+ _instance().initializing = false;
+ }
+
+ static void
stop_ssl_handshaking()
{
ink_assert(!_instance().ssl_handshaking_stopped);
diff --git a/iocore/net/SSLSNIConfig.cc b/iocore/net/SSLSNIConfig.cc
index c134c82..58c1826 100644
--- a/iocore/net/SSLSNIConfig.cc
+++ b/iocore/net/SSLSNIConfig.cc
@@ -39,6 +39,7 @@
#include "tscpp/util/TextView.h"
#include "tscore/I_Layout.h"
#include <sstream>
+#include <utility>
#include <pcre.h>
static constexpr int OVECSIZE{30};
@@ -170,13 +171,19 @@ SNIConfigParams::Initialize()
return 1;
}
- ts::Errata zret = Y_sni.loader(sni_filename);
+ YamlSNIConfig Y_sni_tmp;
+ ts::Errata zret = Y_sni_tmp.loader(sni_filename);
if (!zret.isOK()) {
std::stringstream errMsg;
errMsg << zret;
- Error("%s failed to load: %s", sni_filename, errMsg.str().c_str());
+ if (TSSystemState::is_initializing()) {
+ Emergency("%s failed to load: %s", sni_filename, errMsg.str().c_str());
+ } else {
+ Error("%s failed to load: %s", sni_filename, errMsg.str().c_str());
+ }
return 1;
}
+ Y_sni = std::move(Y_sni_tmp);
loadSNIConfig();
Note("%s finished loading", sni_filename);
diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc
index 7f50493..c952030 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -2224,6 +2224,8 @@ main(int /* argc ATS_UNUSED */, const char **argv)
}
#endif
+ TSSystemState::initialization_done();
+
while (!TSSystemState::is_event_system_shut_down()) {
sleep(1);
}