From 94bc9a93f9e24d347504f066cd8ac1cdae5b466d Mon Sep 17 00:00:00 2001 From: Nigel Brittain Date: Wed, 7 Aug 2024 07:56:28 +0000 Subject: [PATCH] handle shutdown case Signed-off-by: Nigel Brittain --- source/extensions/common/aws/metadata_fetcher.cc | 6 ++++++ .../aws_request_signing_integration_test.cc | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/extensions/common/aws/metadata_fetcher.cc b/source/extensions/common/aws/metadata_fetcher.cc index f5dbe85eea55..aeaac64661d2 100644 --- a/source/extensions/common/aws/metadata_fetcher.cc +++ b/source/extensions/common/aws/metadata_fetcher.cc @@ -52,6 +52,12 @@ class MetadataFetcherImpl : public MetadataFetcher, ASSERT(!request_); complete_ = false; receiver_ = makeOptRef(receiver); + + // Stop processing if we are shutting down + if (cm_.isShutdown()) { + return; + } + const auto thread_local_cluster = cm_.getThreadLocalCluster(cluster_name_); if (thread_local_cluster == nullptr) { ENVOY_LOG(error, "{} AWS Metadata failed: [cluster = {}] not found", __func__, cluster_name_); diff --git a/test/extensions/filters/http/aws_request_signing/aws_request_signing_integration_test.cc b/test/extensions/filters/http/aws_request_signing/aws_request_signing_integration_test.cc index 61b2d066aa1b..ba0da9513745 100644 --- a/test/extensions/filters/http/aws_request_signing/aws_request_signing_integration_test.cc +++ b/test/extensions/filters/http/aws_request_signing/aws_request_signing_integration_test.cc @@ -446,7 +446,6 @@ TEST_F(InitializeFilterTest, TestWithTwoClustersRouteLevelAndStandard) { } TEST_F(InitializeFilterTest, TestWithTwoClustersStandardInstanceProfile) { - Envoy::Logger::Registry::setLogLevel(spdlog::level::debug); dnsSetup(); // Web Identity Credentials, Container Credentials and Instance Profile Credentials TestEnvironment::setEnvVar("AWS_WEB_IDENTITY_TOKEN_FILE", "/path/to/web_token", 1);