diff --git a/cilium/network_policy.h b/cilium/network_policy.h index 575cc42f2..8a50f41cc 100644 --- a/cilium/network_policy.h +++ b/cilium/network_policy.h @@ -109,7 +109,12 @@ class IPAddressPair { class PolicyInstance { public: - virtual ~PolicyInstance() { ASSERT_IS_MAIN_OR_TEST_THREAD(); }; + virtual ~PolicyInstance() { + if (!Thread::MainThread::isMainOrTestThread()) { + ENVOY_LOG_MISC(error, "PolicyInstance: Destructor executing in a worker thread, while " + "only main thread should destruct xDS resources"); + } + }; virtual bool allowed(bool ingress, uint32_t remote_id, uint16_t port, Envoy::Http::RequestHeaderMap& headers, diff --git a/cilium/secret_watcher.cc b/cilium/secret_watcher.cc index bf25d73a6..bd81e637b 100644 --- a/cilium/secret_watcher.cc +++ b/cilium/secret_watcher.cc @@ -35,7 +35,10 @@ SecretWatcher::SecretWatcher(const NetworkPolicyMap& parent, const std::string& update_secret_(readAndWatchSecret()) {} SecretWatcher::~SecretWatcher() { - ASSERT_IS_MAIN_OR_TEST_THREAD(); + if (!Thread::MainThread::isMainOrTestThread()) { + ENVOY_LOG(error, "SecretWatcher: Destructor executing in a worker thread, while " + "only main thread should destruct xDS resources"); + } delete load(); }