Skip to content

Commit

Permalink
policy: Change remaining main thread asserts into error logs
Browse files Browse the repository at this point in the history
Signed-off-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
jrajahalme committed Dec 3, 2024
1 parent c52558e commit 16e43f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cilium/network_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion cilium/secret_watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 16e43f5

Please sign in to comment.