Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor async client #12

Merged
merged 1 commit into from
Aug 15, 2016
Merged

Refactor async client #12

merged 1 commit into from
Aug 15, 2016

Conversation

mattklein123
Copy link
Member

This change refactors async client so that it is owned by the cluster
manager. Now users can just send requests and fire and forget if they
don't need to cancel. This makes a lot of the consumers much simpler.
The fire and forget functionality will be used for router request
shadowing (similar to the HTTP tracer).

This change refactors async client so that it is owned by the cluster
manager. Now users can just send requests and fire and forget if they
don't need to cancel. This makes a lot of the consumers much simpler.
The fire and forget functionality will be used for router request
shadowing (similar to the HTTP tracer).
@mattklein123
Copy link
Member Author

@lyft/network-team please review. This is a large change and a little scary. I already tested it on a prod host just to verify that it is sane. Overall this makes all uses of async client much simpler and will make fire and forget request shadowing in the router pretty trivial.

@RomanDzhabarov
Copy link
Member

👍

@mattklein123 mattklein123 merged commit 7654e26 into master Aug 15, 2016
@mattklein123 mattklein123 deleted the async_client branch August 15, 2016 18:27
@hzariv hzariv mentioned this pull request Jun 8, 2017
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
Add initial travis-CI build config for bazel.build.
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
* Add attribute context to fill protobuf.

* Combine dictionary update with attribute filling.

* Add comment
htuch added a commit to htuch/envoy that referenced this pull request Nov 1, 2018
…ardown.

server_fuzz_test indicated the below crash, where the DispatcherImpl teardown
releases some upstream client SSL related objects that then needs
SecretManagerImpl to unregister. Previously, this was already destructed by
time we were in ~DispatcherImpl(), this PR reorders.

    #0 0xc1e826 in size /usr/local/include/c++/v1/__hash_table:809:55
    envoyproxy#1 0xc1e826 in bucket_count /usr/local/include/c++/v1/__hash_table:1197
    envoyproxy#2 0xc1e826 in std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, void*>*> std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> > > >::find<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /usr/local/include/c++/v1/__hash_table:2334
    envoyproxy#3 0xc1e278 in unsigned long std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> > > >::__erase_unique<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /usr/local/include/c++/v1/__hash_table:2510:20
    envoyproxy#4 0xc1def6 in erase /usr/local/include/c++/v1/unordered_map:1156:59
    envoyproxy#5 0xc1def6 in Envoy::Secret::SecretManagerImpl::DynamicSecretProviders<Envoy::Secret::TlsCertificateSdsApi>::removeDynamicSecretProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /bazel-out/k8-fastbuild/bin/source/common/secret/_virtual_includes/secret_manager_impl_lib/common/secret/secret_manager_impl.h:75
    envoyproxy#6 0x724aa9 in Envoy::Cleanup::~Cleanup() /bazel-out/k8-fastbuild/bin/source/common/common/_virtual_includes/cleanup_lib/common/common/cleanup.h:11:16
    envoyproxy#7 0xc1ff33 in Envoy::Secret::SdsApi::~SdsApi() /bazel-out/k8-fastbuild/bin/source/common/secret/_virtual_includes/sds_api_lib/common/secret/sds_api.h:29:7
    envoyproxy#8 0xc188a0 in __release_shared /usr/local/include/c++/v1/memory:3530:9
    envoyproxy#9 0xc188a0 in __release_shared /usr/local/include/c++/v1/memory:3572
    envoyproxy#10 0xc188a0 in std::__1::shared_ptr<Envoy::Secret::SecretProvider<Envoy::Ssl::TlsCertificateConfig> >::~shared_ptr() /usr/local/include/c++/v1/memory:4508
    envoyproxy#11 0x149c922 in Envoy::Ssl::ContextConfigImpl::~ContextConfigImpl() /source/common/ssl/context_config_impl.cc:117:1
    envoyproxy#12 0x14a0d8f in Envoy::Ssl::ClientContextConfigImpl::~ClientContextConfigImpl() /bazel-out/k8-fastbuild/bin/source/common/ssl/_virtual_includes/context_config_lib/common/ssl/context_config_impl.h:91:7
    envoyproxy#13 0x14a0dc8 in Envoy::Ssl::ClientContextConfigImpl::~ClientContextConfigImpl() /bazel-out/k8-fastbuild/bin/source/common/ssl/_virtual_includes/context_config_lib/common/ssl/context_config_impl.h:91:7
    envoyproxy#14 0x149815b in operator() /usr/local/include/c++/v1/memory:2325:5
    envoyproxy#15 0x149815b in reset /usr/local/include/c++/v1/memory:2638
    envoyproxy#16 0x149815b in ~unique_ptr /usr/local/include/c++/v1/memory:2592
    envoyproxy#17 0x149815b in Envoy::Ssl::ClientSslSocketFactory::~ClientSslSocketFactory() /bazel-out/k8-fastbuild/bin/source/common/ssl/_virtual_includes/ssl_socket_lib/common/ssl/ssl_socket.h:83
    envoyproxy#18 0x14981c8 in Envoy::Ssl::ClientSslSocketFactory::~ClientSslSocketFactory() /bazel-out/k8-fastbuild/bin/source/common/ssl/_virtual_includes/ssl_socket_lib/common/ssl/ssl_socket.h:83:7
    envoyproxy#19 0x1362caf in operator() /usr/local/include/c++/v1/memory:2325:5
    envoyproxy#20 0x1362caf in reset /usr/local/include/c++/v1/memory:2638
    envoyproxy#21 0x1362caf in ~unique_ptr /usr/local/include/c++/v1/memory:2592
    envoyproxy#22 0x1362caf in Envoy::Upstream::ClusterInfoImpl::~ClusterInfoImpl() /bazel-out/k8-fastbuild/bin/source/common/upstream/_virtual_includes/upstream_includes/common/upstream/upstream_impl.h:362
    envoyproxy#23 0x1362d28 in Envoy::Upstream::ClusterInfoImpl::~ClusterInfoImpl() /bazel-out/k8-fastbuild/bin/source/common/upstream/_virtual_includes/upstream_includes/common/upstream/upstream_impl.h:362:7
    envoyproxy#24 0x66e560 in __release_shared /usr/local/include/c++/v1/memory:3530:9
    envoyproxy#25 0x66e560 in __release_shared /usr/local/include/c++/v1/memory:3572
    envoyproxy#26 0x66e560 in std::__1::shared_ptr<Envoy::Upstream::ClusterInfo const>::~shared_ptr() /usr/local/include/c++/v1/memory:4508
    envoyproxy#27 0x13621bf in Envoy::Upstream::HostImpl::~HostImpl() /bazel-out/k8-fastbuild/bin/source/common/upstream/_virtual_includes/upstream_includes/common/upstream/upstream_impl.h:156:7
    envoyproxy#28 0x13621f8 in Envoy::Upstream::HostImpl::~HostImpl() /bazel-out/k8-fastbuild/bin/source/common/upstream/_virtual_includes/upstream_includes/common/upstream/upstream_impl.h:156:7
    envoyproxy#29 0x66e650 in __release_shared /usr/local/include/c++/v1/memory:3530:9
    envoyproxy#30 0x66e650 in __release_shared /usr/local/include/c++/v1/memory:3572
    envoyproxy#31 0x66e650 in std::__1::shared_ptr<Envoy::Upstream::HostDescription const>::~shared_ptr() /usr/local/include/c++/v1/memory:4508
    envoyproxy#32 0x13b20c3 in Envoy::Http::CodecClient::~CodecClient() /source/common/http/codec_client.cc:38:30
    envoyproxy#33 0x13b2258 in Envoy::Http::CodecClientProd::~CodecClientProd() /bazel-out/k8-fastbuild/bin/source/common/http/_virtual_includes/codec_client_lib/common/http/codec_client.h:229:7
    envoyproxy#34 0x751de6 in operator() /usr/local/include/c++/v1/memory:2325:5
    envoyproxy#35 0x751de6 in reset /usr/local/include/c++/v1/memory:2638
    envoyproxy#36 0x751de6 in ~unique_ptr /usr/local/include/c++/v1/memory:2592
    envoyproxy#37 0x751de6 in destroy /usr/local/include/c++/v1/memory:1867
    envoyproxy#38 0x751de6 in __destroy<std::__1::unique_ptr<Envoy::Event::DeferredDeletable, std::__1::default_delete<Envoy::Event::DeferredDeletable> > > /usr/local/include/c++/v1/memory:1729
    envoyproxy#39 0x751de6 in destroy<std::__1::unique_ptr<Envoy::Event::DeferredDeletable, std::__1::default_delete<Envoy::Event::DeferredDeletable> > > /usr/local/include/c++/v1/memory:1597
    envoyproxy#40 0x751de6 in __destruct_at_end /usr/local/include/c++/v1/vector:422
    envoyproxy#41 0x751de6 in clear /usr/local/include/c++/v1/vector:365
    envoyproxy#42 0x751de6 in std::__1::__vector_base<std::__1::unique_ptr<Envoy::Event::DeferredDeletable, std::__1::default_delete<Envoy::Event::DeferredDeletable> >, std::__1::allocator<std::__1::unique_ptr<Envoy::Event::DeferredDeletable, std::__1::default_delete<Envoy::Event::DeferredDeletable> > > >::~__vector_base() /usr/local/include/c++/v1/vector:459
    envoyproxy#43 0x74d1aa in ~vector /usr/local/include/c++/v1/vector:551:5
    envoyproxy#44 0x74d1aa in Envoy::Event::DispatcherImpl::~DispatcherImpl() /source/common/event/dispatcher_impl.cc:41
    envoyproxy#45 0x74d658 in Envoy::Event::DispatcherImpl::~DispatcherImpl() /source/common/event/dispatcher_impl.cc:41:35
    envoyproxy#46 0x697b76 in operator() /usr/local/include/c++/v1/memory:2325:5
    envoyproxy#47 0x697b76 in reset /usr/local/include/c++/v1/memory:2638
    envoyproxy#48 0x697b76 in ~unique_ptr /usr/local/include/c++/v1/memory:2592
    envoyproxy#49 0x697b76 in Envoy::Server::InstanceImpl::InstanceImpl(Envoy::Server::Options&, Envoy::Event::TimeSystem&, std::__1::shared_ptr<Envoy::Network::Address::Instance const>, Envoy::TestHooks&, Envoy::Server::HotRestart&, Envoy::Stats::StoreRoot&, Envoy::Thread::BasicLockable&, Envoy::Server::ComponentFactory&, std::__1::unique_ptr<Envoy::Runtime::RandomGenerator, std::__1::default_delete<Envoy::Runtime::RandomGenerator> >&&, Envoy::ThreadLocal::Instance&) /source/server/server.cc:92
    envoyproxy#50 0x586026 in make_unique<Envoy::Server::InstanceImpl, testing::NiceMock<Envoy::Server::MockOptions> &, Envoy::Event::TestTimeSystem &, std::__1::shared_ptr<Envoy::Network::Address::Ipv4Instance>, Envoy::DefaultTestHooks &, testing::NiceMock<Envoy::Server::MockHotRestart> &, Envoy::Stats::TestIsolatedStoreImpl &, Envoy::Thread::MutexBasicLockable &, Envoy::Server::TestComponentFactory &, std::__1::unique_ptr<Envoy::Runtime::RandomGeneratorImpl, std::__1::default_delete<Envoy::Runtime::RandomGeneratorImpl> >, Envoy::ThreadLocal::InstanceImpl &> /usr/local/include/c++/v1/memory:3118:32
    envoyproxy#51 0x586026 in Envoy::Server::TestOneProtoInput(envoy::config::bootstrap::v2::Bootstrap const&) /test/server/server_fuzz_test.cc:78

Risk Level: Low
Testing: Corpus entry added. It's pretty hard to build regressions for this
  kind of destruction ordering, so relying on server_fuzz_test + corpus.

Signed-off-by: Harvey Tuch <htuch@google.com>
htuch added a commit that referenced this pull request Nov 1, 2018
…ardown. (#4940)

server_fuzz_test indicated the below crash, where the DispatcherImpl teardown
releases some upstream client SSL related objects that then needs
SecretManagerImpl to unregister. Previously, this was already destructed by
time we were in ~DispatcherImpl(), this PR reorders.

    #0 0xc1e826 in size /usr/local/include/c++/v1/__hash_table:809:55
    #1 0xc1e826 in bucket_count /usr/local/include/c++/v1/__hash_table:1197
    #2 0xc1e826 in std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, void*>*> std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> > > >::find<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /usr/local/include/c++/v1/__hash_table:2334
    #3 0xc1e278 in unsigned long std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::weak_ptr<Envoy::Secret::TlsCertificateSdsApi> > > >::__erase_unique<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /usr/local/include/c++/v1/__hash_table:2510:20
    #4 0xc1def6 in erase /usr/local/include/c++/v1/unordered_map:1156:59
    #5 0xc1def6 in Envoy::Secret::SecretManagerImpl::DynamicSecretProviders<Envoy::Secret::TlsCertificateSdsApi>::removeDynamicSecretProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /bazel-out/k8-fastbuild/bin/source/common/secret/_virtual_includes/secret_manager_impl_lib/common/secret/secret_manager_impl.h:75
    #6 0x724aa9 in Envoy::Cleanup::~Cleanup() /bazel-out/k8-fastbuild/bin/source/common/common/_virtual_includes/cleanup_lib/common/common/cleanup.h:11:16
    #7 0xc1ff33 in Envoy::Secret::SdsApi::~SdsApi() /bazel-out/k8-fastbuild/bin/source/common/secret/_virtual_includes/sds_api_lib/common/secret/sds_api.h:29:7
    #8 0xc188a0 in __release_shared /usr/local/include/c++/v1/memory:3530:9
    #9 0xc188a0 in __release_shared /usr/local/include/c++/v1/memory:3572
    #10 0xc188a0 in std::__1::shared_ptr<Envoy::Secret::SecretProvider<Envoy::Ssl::TlsCertificateConfig> >::~shared_ptr() /usr/local/include/c++/v1/memory:4508
    #11 0x149c922 in Envoy::Ssl::ContextConfigImpl::~ContextConfigImpl() /source/common/ssl/context_config_impl.cc:117:1
    #12 0x14a0d8f in Envoy::Ssl::ClientContextConfigImpl::~ClientContextConfigImpl() /bazel-out/k8-fastbuild/bin/source/common/ssl/_virtual_includes/context_config_lib/common/ssl/context_config_impl.h:91:7
    #13 0x14a0dc8 in Envoy::Ssl::ClientContextConfigImpl::~ClientContextConfigImpl() /bazel-out/k8-fastbuild/bin/source/common/ssl/_virtual_includes/context_config_lib/common/ssl/context_config_impl.h:91:7
    #14 0x149815b in operator() /usr/local/include/c++/v1/memory:2325:5
    #15 0x149815b in reset /usr/local/include/c++/v1/memory:2638
    #16 0x149815b in ~unique_ptr /usr/local/include/c++/v1/memory:2592
    #17 0x149815b in Envoy::Ssl::ClientSslSocketFactory::~ClientSslSocketFactory() /bazel-out/k8-fastbuild/bin/source/common/ssl/_virtual_includes/ssl_socket_lib/common/ssl/ssl_socket.h:83
    #18 0x14981c8 in Envoy::Ssl::ClientSslSocketFactory::~ClientSslSocketFactory() /bazel-out/k8-fastbuild/bin/source/common/ssl/_virtual_includes/ssl_socket_lib/common/ssl/ssl_socket.h:83:7
    #19 0x1362caf in operator() /usr/local/include/c++/v1/memory:2325:5
    #20 0x1362caf in reset /usr/local/include/c++/v1/memory:2638
    #21 0x1362caf in ~unique_ptr /usr/local/include/c++/v1/memory:2592
    #22 0x1362caf in Envoy::Upstream::ClusterInfoImpl::~ClusterInfoImpl() /bazel-out/k8-fastbuild/bin/source/common/upstream/_virtual_includes/upstream_includes/common/upstream/upstream_impl.h:362
    #23 0x1362d28 in Envoy::Upstream::ClusterInfoImpl::~ClusterInfoImpl() /bazel-out/k8-fastbuild/bin/source/common/upstream/_virtual_includes/upstream_includes/common/upstream/upstream_impl.h:362:7
    #24 0x66e560 in __release_shared /usr/local/include/c++/v1/memory:3530:9
    #25 0x66e560 in __release_shared /usr/local/include/c++/v1/memory:3572
    #26 0x66e560 in std::__1::shared_ptr<Envoy::Upstream::ClusterInfo const>::~shared_ptr() /usr/local/include/c++/v1/memory:4508
    #27 0x13621bf in Envoy::Upstream::HostImpl::~HostImpl() /bazel-out/k8-fastbuild/bin/source/common/upstream/_virtual_includes/upstream_includes/common/upstream/upstream_impl.h:156:7
    #28 0x13621f8 in Envoy::Upstream::HostImpl::~HostImpl() /bazel-out/k8-fastbuild/bin/source/common/upstream/_virtual_includes/upstream_includes/common/upstream/upstream_impl.h:156:7
    #29 0x66e650 in __release_shared /usr/local/include/c++/v1/memory:3530:9
    #30 0x66e650 in __release_shared /usr/local/include/c++/v1/memory:3572
    #31 0x66e650 in std::__1::shared_ptr<Envoy::Upstream::HostDescription const>::~shared_ptr() /usr/local/include/c++/v1/memory:4508
    #32 0x13b20c3 in Envoy::Http::CodecClient::~CodecClient() /source/common/http/codec_client.cc:38:30
    #33 0x13b2258 in Envoy::Http::CodecClientProd::~CodecClientProd() /bazel-out/k8-fastbuild/bin/source/common/http/_virtual_includes/codec_client_lib/common/http/codec_client.h:229:7
    #34 0x751de6 in operator() /usr/local/include/c++/v1/memory:2325:5
    #35 0x751de6 in reset /usr/local/include/c++/v1/memory:2638
    #36 0x751de6 in ~unique_ptr /usr/local/include/c++/v1/memory:2592
    #37 0x751de6 in destroy /usr/local/include/c++/v1/memory:1867
    #38 0x751de6 in __destroy<std::__1::unique_ptr<Envoy::Event::DeferredDeletable, std::__1::default_delete<Envoy::Event::DeferredDeletable> > > /usr/local/include/c++/v1/memory:1729
    #39 0x751de6 in destroy<std::__1::unique_ptr<Envoy::Event::DeferredDeletable, std::__1::default_delete<Envoy::Event::DeferredDeletable> > > /usr/local/include/c++/v1/memory:1597
    #40 0x751de6 in __destruct_at_end /usr/local/include/c++/v1/vector:422
    #41 0x751de6 in clear /usr/local/include/c++/v1/vector:365
    #42 0x751de6 in std::__1::__vector_base<std::__1::unique_ptr<Envoy::Event::DeferredDeletable, std::__1::default_delete<Envoy::Event::DeferredDeletable> >, std::__1::allocator<std::__1::unique_ptr<Envoy::Event::DeferredDeletable, std::__1::default_delete<Envoy::Event::DeferredDeletable> > > >::~__vector_base() /usr/local/include/c++/v1/vector:459
    #43 0x74d1aa in ~vector /usr/local/include/c++/v1/vector:551:5
    #44 0x74d1aa in Envoy::Event::DispatcherImpl::~DispatcherImpl() /source/common/event/dispatcher_impl.cc:41
    #45 0x74d658 in Envoy::Event::DispatcherImpl::~DispatcherImpl() /source/common/event/dispatcher_impl.cc:41:35
    #46 0x697b76 in operator() /usr/local/include/c++/v1/memory:2325:5
    #47 0x697b76 in reset /usr/local/include/c++/v1/memory:2638
    #48 0x697b76 in ~unique_ptr /usr/local/include/c++/v1/memory:2592
    #49 0x697b76 in Envoy::Server::InstanceImpl::InstanceImpl(Envoy::Server::Options&, Envoy::Event::TimeSystem&, std::__1::shared_ptr<Envoy::Network::Address::Instance const>, Envoy::TestHooks&, Envoy::Server::HotRestart&, Envoy::Stats::StoreRoot&, Envoy::Thread::BasicLockable&, Envoy::Server::ComponentFactory&, std::__1::unique_ptr<Envoy::Runtime::RandomGenerator, std::__1::default_delete<Envoy::Runtime::RandomGenerator> >&&, Envoy::ThreadLocal::Instance&) /source/server/server.cc:92
    #50 0x586026 in make_unique<Envoy::Server::InstanceImpl, testing::NiceMock<Envoy::Server::MockOptions> &, Envoy::Event::TestTimeSystem &, std::__1::shared_ptr<Envoy::Network::Address::Ipv4Instance>, Envoy::DefaultTestHooks &, testing::NiceMock<Envoy::Server::MockHotRestart> &, Envoy::Stats::TestIsolatedStoreImpl &, Envoy::Thread::MutexBasicLockable &, Envoy::Server::TestComponentFactory &, std::__1::unique_ptr<Envoy::Runtime::RandomGeneratorImpl, std::__1::default_delete<Envoy::Runtime::RandomGeneratorImpl> >, Envoy::ThreadLocal::InstanceImpl &> /usr/local/include/c++/v1/memory:3118:32
    #51 0x586026 in Envoy::Server::TestOneProtoInput(envoy::config::bootstrap::v2::Bootstrap const&) /test/server/server_fuzz_test.cc:78

Fixes oss-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11231

Risk Level: Low
Testing: Corpus entry added. It's pretty hard to build regressions for this
  kind of destruction ordering, so relying on server_fuzz_test + corpus.

Signed-off-by: Harvey Tuch <htuch@google.com>
@msarajam msarajam mentioned this pull request Mar 21, 2019
RyanTheOptimist pushed a commit that referenced this pull request Jan 10, 2024
Commit Message: the probing socket is released when port migration fails. If this happens in response to an incoming packet during an I/O event, the follow socket read could cause use-after-free.

[2024-01-08 16:30:53.386][12][critical][backtrace] [./source/server/backtrace.h:104] Caught Segmentation fault, suspect faulting address 0x0
[2024-01-08 16:30:53.387][12][critical][backtrace] [./source/server/backtrace.h:91] Backtrace (use tools/stack_decode.py to get line numbers):
[2024-01-08 16:30:53.387][12][critical][backtrace] [./source/server/backtrace.h:92] Envoy version: 0/1.29.0-dev/test/DEBUG/BoringSSL
[2024-01-08 16:30:53.413][12][critical][backtrace] [./source/server/backtrace.h:96] #0: Envoy::SignalAction::sigHandler() [0x55bb876d499e]
[2024-01-08 16:30:53.413][12][critical][backtrace] [./source/server/backtrace.h:98] #1: [0x7f55fbf92510]
[2024-01-08 16:30:53.440][12][critical][backtrace] [./source/server/backtrace.h:96] #2: Envoy::Network::Utility::readPacketsFromSocket() [0x55bb875de0ef]
[2024-01-08 16:30:53.466][12][critical][backtrace] [./source/server/backtrace.h:96] #3: Envoy::Quic::EnvoyQuicClientConnection::onFileEvent() [0x55bb8663e1eb]
[2024-01-08 16:30:53.492][12][critical][backtrace] [./source/server/backtrace.h:96] #4: Envoy::Quic::EnvoyQuicClientConnection::setUpConnectionSocket()::$_0::operator()() [0x55bb8663f192]
[2024-01-08 16:30:53.518][12][critical][backtrace] [./source/server/backtrace.h:96] #5: std::__invoke_impl<>() [0x55bb8663f151]
[2024-01-08 16:30:53.544][12][critical][backtrace] [./source/server/backtrace.h:96] #6: std::__invoke_r<>() [0x55bb8663f0e2]
[2024-01-08 16:30:53.569][12][critical][backtrace] [./source/server/backtrace.h:96] #7: std::_Function_handler<>::_M_invoke() [0x55bb8663efc2]
[2024-01-08 16:30:53.595][12][critical][backtrace] [./source/server/backtrace.h:96] #8: std::function<>::operator()() [0x55bb85cb8f44]
[2024-01-08 16:30:53.621][12][critical][backtrace] [./source/server/backtrace.h:96] #9: Envoy::Event::DispatcherImpl::createFileEvent()::$_5::operator()() [0x55bb8722560f]
[2024-01-08 16:30:53.648][12][critical][backtrace] [./source/server/backtrace.h:96] #10: std::__invoke_impl<>() [0x55bb872255c1]
[2024-01-08 16:30:53.674][12][critical][backtrace] [./source/server/backtrace.h:96] #11: std::__invoke_r<>() [0x55bb87225562]
[2024-01-08 16:30:53.700][12][critical][backtrace] [./source/server/backtrace.h:96] #12: std::_Function_handler<>::_M_invoke() [0x55bb872253e2]
[2024-01-08 16:30:53.700][12][critical][backtrace] [./source/server/backtrace.h:96] #13: std::function<>::operator()() [0x55bb85cb8f44]
[2024-01-08 16:30:53.726][12][critical][backtrace] [./source/server/backtrace.h:96] #14: Envoy::Event::FileEventImpl::mergeInjectedEventsAndRunCb() [0x55bb872358ec]
[2024-01-08 16:30:53.752][12][critical][backtrace] [./source/server/backtrace.h:96] #15: Envoy::Event::FileEventImpl::assignEvents()::$_1::operator()() [0x55bb87235ed1]
[2024-01-08 16:30:53.778][12][critical][backtrace] [./source/server/backtrace.h:96] #16: Envoy::Event::FileEventImpl::assignEvents()::$_1::__invoke() [0x55bb87235949]
[2024-01-08 16:30:53.804][12][critical][backtrace] [./source/server/backtrace.h:96] #17: event_persist_closure [0x55bb87fab72b]
[2024-01-08 16:30:53.830][12][critical][backtrace] [./source/server/backtrace.h:96] #18: event_process_active_single_queue [0x55bb87faada2]
[2024-01-08 16:30:53.856][12][critical][backtrace] [./source/server/backtrace.h:96] #19: event_process_active [0x55bb87fa56c8]
[2024-01-08 16:30:53.882][12][critical][backtrace] [./source/server/backtrace.h:96] #20: event_base_loop [0x55bb87fa45cc]
[2024-01-08 16:30:53.908][12][critical][backtrace] [./source/server/backtrace.h:96] #21: Envoy::Event::LibeventScheduler::run() [0x55bb8760a59f]
Risk Level: low
Testing: new unit test
Docs Changes: N/A
Release Notes: Yes
Platform Specific Features: N/A

Signed-off-by: Dan Zhang <danzh@google.com>
Co-authored-by: Dan Zhang <danzh@google.com>
nezdolik pushed a commit to nezdolik/envoy that referenced this pull request May 4, 2024
…_cache.cc

This avoids a deadlock when a library which is being dlopen'ed creates
as part of its static constructors a thread which quickly need to call
malloc. We are still in the dlopen call (so with some internal glibc
mutex taken) when the thread executes code and later needs to call
malloc which in term calls tls_get_addr_tail, which wait for the dlopen
mutex to be unlocked. If later the dlopen'ing thread also calls malloc
as part of its constructors, we are in a deadlock.

Fix is similar to
gperftools/gperftools@7852eeb

Stack of the dlopening thread:
    #0  0x00007fd5406ca93c in __lll_lock_wait () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libpthread.so.0
    #1  0x00007fd5406c45a5 in pthread_mutex_lock () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libpthread.so.0
    ... proprietary code in the stack
    envoyproxy#9  0x00007fd5074f0367 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at src/ClientImpl.cpp:15
    envoyproxy#10 0x00007fd5074f06d7 in _GLOBAL__sub_I_ClientImpl.cpp(void) () at src/ClientImpl.cpp:85
    envoyproxy#11 0x00007fd50757aa46 in __do_global_ctors_aux ()
    envoyproxy#12 0x00007fd5073e985f in _init () from ...
    envoyproxy#13 0x00007fd53bf9dec8 in ?? () from ...
    envoyproxy#14 0x00007fd54d637a5d in call_init.part () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/ld-linux-x86-64.so.2
    envoyproxy#15 0x00007fd54d637bab in _dl_init () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/ld-linux-x86-64.so.2
    envoyproxy#16 0x00007fd54d63c160 in dl_open_worker () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/ld-linux-x86-64.so.2
    envoyproxy#17 0x00007fd54d637944 in _dl_catch_error () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/ld-linux-x86-64.so.2
    envoyproxy#18 0x00007fd54d63b7d9 in _dl_open () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/ld-linux-x86-64.so.2
    envoyproxy#19 0x00007fd54d61f2b9 in dlopen_doit () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libdl.so.2
    envoyproxy#20 0x00007fd54d637944 in _dl_catch_error () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/ld-linux-x86-64.so.2
    envoyproxy#21 0x00007fd54d61f889 in _dlerror_run () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libdl.so.2
    envoyproxy#22 0x00007fd54d61f351 in dlopen@@GLIBC_2.2.5 () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libdl.so.2

Stack of the newly created thread calling tls_get_addr_tail:
    #0  0x00007fd5406ca93c in __lll_lock_wait () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libpthread.so.0
    #1  0x00007fd5406c4622 in pthread_mutex_lock () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libpthread.so.0
    envoyproxy#2  0x00007fd54d63a2ed in tls_get_addr_tail () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/ld-linux-x86-64.so.2
    envoyproxy#3  0x00007fd53fee877d in tcmalloc::ThreadCache::CreateCacheIfNecessary () at src/thread_cache.cc:344
    envoyproxy#4  0x00007fd53fecb4ab in tcmalloc::ThreadCache::GetCache () at src/thread_cache.h:437
    envoyproxy#5  0x00007fd53fefeccb in (anonymous namespace)::do_malloc (size=56) at src/tcmalloc.cc:1354
    envoyproxy#6  tcmalloc::do_allocate_full<tcmalloc::cpp_throw_oom> (size=56) at src/tcmalloc.cc:1762
    envoyproxy#7  tcmalloc::allocate_full_cpp_throw_oom (size=56) at src/tcmalloc.cc:1776
    envoyproxy#8  0x00007fd53ff01b80 in tcmalloc::dispatch_allocate_full<tcmalloc::cpp_throw_oom> (size=56) at src/tcmalloc.cc:1785
    envoyproxy#9  malloc_fast_path<tcmalloc::cpp_throw_oom> (size=56) at src/tcmalloc.cc:1845
    envoyproxy#10 tc_new (size=56) at src/tcmalloc.cc:1980
    ... proprietary code in the stack
    envoyproxy#26 0x00007fd5406c1ef4 in start_thread () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libpthread.so.0
    envoyproxy#27 0x00007fd5403ba01d in clone () from /data3/mwrep/rgeissler/core.tls/opt/1A/toolchain/x86_64-2.6.32-v2/lib64/libc.so.6
arminabf pushed a commit to arminabf/envoy that referenced this pull request Jun 5, 2024
ggreenway pushed a commit that referenced this pull request Aug 1, 2024
When the ``AsyncTcpClient`` is being destroyed but it
also has an active client connection, there's a crash since during the
instance destruction, the ``ClientConnection`` object would also be
destroyed, causing ``raiseEvent`` to be called back to
``AsyncTcpClient`` while it is being destroyed

Caught with the following stack trace:
```
Caught Segmentation fault, suspect faulting address 0x0
Backtrace (use tools/stack_decode.py to get line numbers):
Envoy version: ee8c765a07037033766ea556c032120b497152b3/1.27.0/Clean/RELEASE/BoringSSL
#0: __restore_rt [0x7d80ab903420]
#1: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLoggerImpl::onEvent() [0x58313528746b]
#2: Envoy::Tcp::AsyncTcpClientImpl::onEvent() [0x5831359da00a]
#3: Envoy::Network::ConnectionImplBase::raiseConnectionEvent() [0x583135f0521d]
#4: Envoy::Network::ConnectionImpl::raiseEvent() [0x583135e9fed9]
#5: Envoy::Network::ConnectionImpl::closeSocket() [0x583135e9f90c]
#6: Envoy::Network::ConnectionImpl::close() [0x583135e9e54c]
#7: Envoy::Network::ConnectionImpl::~ConnectionImpl() [0x583135e9de5c]
#8: Envoy::Network::ClientConnectionImpl::~ClientConnectionImpl() [0x5831355fd25e]
#9: Envoy::Tcp::AsyncTcpClientImpl::~AsyncTcpClientImpl() [0x5831359da247]
#10: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLoggerImpl::~FluentdAccessLoggerImpl() [0x583135289350]
#11: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLog::ThreadLocalLogger::~ThreadLocalLogger() [0x58313528adbf]
#12: Envoy::ThreadLocal::InstanceImpl::shutdownThread() [0x58313560373a]
#13: Envoy::Server::WorkerImpl::threadRoutine() [0x583135630c0a]
#14: Envoy::Thread::ThreadImplPosix::ThreadImplPosix()::{lambda()#1}::__invoke() [0x5831364e88d5]
#15: start_thread [0x7d80ab8f7609]
```
Risk Level: low
Testing: unit tests
Docs Changes: none
Release Notes: none
Platform Specific Features: none

---------

Signed-off-by: Ohad Vano <ohadvano@gmail.com>
martinduke pushed a commit to martinduke/envoy that referenced this pull request Aug 8, 2024
…yproxy#35410)

When the ``AsyncTcpClient`` is being destroyed but it
also has an active client connection, there's a crash since during the
instance destruction, the ``ClientConnection`` object would also be
destroyed, causing ``raiseEvent`` to be called back to
``AsyncTcpClient`` while it is being destroyed

Caught with the following stack trace:
```
Caught Segmentation fault, suspect faulting address 0x0
Backtrace (use tools/stack_decode.py to get line numbers):
Envoy version: ee8c765a07037033766ea556c032120b497152b3/1.27.0/Clean/RELEASE/BoringSSL
#0: __restore_rt [0x7d80ab903420]
envoyproxy#1: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLoggerImpl::onEvent() [0x58313528746b]
envoyproxy#2: Envoy::Tcp::AsyncTcpClientImpl::onEvent() [0x5831359da00a]
envoyproxy#3: Envoy::Network::ConnectionImplBase::raiseConnectionEvent() [0x583135f0521d]
envoyproxy#4: Envoy::Network::ConnectionImpl::raiseEvent() [0x583135e9fed9]
envoyproxy#5: Envoy::Network::ConnectionImpl::closeSocket() [0x583135e9f90c]
envoyproxy#6: Envoy::Network::ConnectionImpl::close() [0x583135e9e54c]
envoyproxy#7: Envoy::Network::ConnectionImpl::~ConnectionImpl() [0x583135e9de5c]
envoyproxy#8: Envoy::Network::ClientConnectionImpl::~ClientConnectionImpl() [0x5831355fd25e]
envoyproxy#9: Envoy::Tcp::AsyncTcpClientImpl::~AsyncTcpClientImpl() [0x5831359da247]
envoyproxy#10: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLoggerImpl::~FluentdAccessLoggerImpl() [0x583135289350]
envoyproxy#11: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLog::ThreadLocalLogger::~ThreadLocalLogger() [0x58313528adbf]
envoyproxy#12: Envoy::ThreadLocal::InstanceImpl::shutdownThread() [0x58313560373a]
envoyproxy#13: Envoy::Server::WorkerImpl::threadRoutine() [0x583135630c0a]
envoyproxy#14: Envoy::Thread::ThreadImplPosix::ThreadImplPosix()::{lambda()envoyproxy#1}::__invoke() [0x5831364e88d5]
envoyproxy#15: start_thread [0x7d80ab8f7609]
```
Risk Level: low
Testing: unit tests
Docs Changes: none
Release Notes: none
Platform Specific Features: none

---------

Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Martin Duke <martin.h.duke@gmail.com>
asingh-g pushed a commit to asingh-g/envoy that referenced this pull request Aug 20, 2024
…yproxy#35410)

When the ``AsyncTcpClient`` is being destroyed but it
also has an active client connection, there's a crash since during the
instance destruction, the ``ClientConnection`` object would also be
destroyed, causing ``raiseEvent`` to be called back to
``AsyncTcpClient`` while it is being destroyed

Caught with the following stack trace:
```
Caught Segmentation fault, suspect faulting address 0x0
Backtrace (use tools/stack_decode.py to get line numbers):
Envoy version: ee8c765a07037033766ea556c032120b497152b3/1.27.0/Clean/RELEASE/BoringSSL
#0: __restore_rt [0x7d80ab903420]
envoyproxy#1: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLoggerImpl::onEvent() [0x58313528746b]
envoyproxy#2: Envoy::Tcp::AsyncTcpClientImpl::onEvent() [0x5831359da00a]
envoyproxy#3: Envoy::Network::ConnectionImplBase::raiseConnectionEvent() [0x583135f0521d]
envoyproxy#4: Envoy::Network::ConnectionImpl::raiseEvent() [0x583135e9fed9]
envoyproxy#5: Envoy::Network::ConnectionImpl::closeSocket() [0x583135e9f90c]
envoyproxy#6: Envoy::Network::ConnectionImpl::close() [0x583135e9e54c]
envoyproxy#7: Envoy::Network::ConnectionImpl::~ConnectionImpl() [0x583135e9de5c]
envoyproxy#8: Envoy::Network::ClientConnectionImpl::~ClientConnectionImpl() [0x5831355fd25e]
envoyproxy#9: Envoy::Tcp::AsyncTcpClientImpl::~AsyncTcpClientImpl() [0x5831359da247]
envoyproxy#10: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLoggerImpl::~FluentdAccessLoggerImpl() [0x583135289350]
envoyproxy#11: Envoy::Extensions::AccessLoggers::Fluentd::FluentdAccessLog::ThreadLocalLogger::~ThreadLocalLogger() [0x58313528adbf]
envoyproxy#12: Envoy::ThreadLocal::InstanceImpl::shutdownThread() [0x58313560373a]
envoyproxy#13: Envoy::Server::WorkerImpl::threadRoutine() [0x583135630c0a]
envoyproxy#14: Envoy::Thread::ThreadImplPosix::ThreadImplPosix()::{lambda()envoyproxy#1}::__invoke() [0x5831364e88d5]
envoyproxy#15: start_thread [0x7d80ab8f7609]
```
Risk Level: low
Testing: unit tests
Docs Changes: none
Release Notes: none
Platform Specific Features: none

---------

Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: asingh-g <abhisinghx@google.com>
nezdolik added a commit that referenced this pull request Sep 9, 2024
Fixing asan failures:
```
==16==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x323ecbe in malloc /local/mnt/workspace/bcain_clang_hu-bcain-lv_22036/final/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
    #1 0xa58a194 in operator new(unsigned long) (/b/f/w/bazel-out/k8-dbg/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test.runfiles/envoy/test/extensions/geoip_providers/maxmind/geoip_provider_test+0xa58a194)
    #2 0x3348d04 in void std::__1::vector<std::__1::function<absl::lts_20230802::Status (unsigned int)>, std::__1::allocator<std::__1::function<absl::lts_20230802::Status (unsigned int)> > >::__emplace_back_slow_path<std::__1::function<absl::lts_20230802::Status (unsigned int)> >(std::__1::function<absl::lts_20230802::Status (unsigned int)>&&) /opt/llvm/bin/../include/c++/v1/vector:1558:49
    #3 0x3348883 in std::__1::function<absl::lts_20230802::Status (unsigned int)>& std::__1::vector<std::__1::function<absl::lts_20230802::Status (unsigned int)>, std::__1::allocator<std::__1::function<absl::lts_20230802::Status (unsigned int)> > >::emplace_back<std::__1::function<absl::lts_20230802::Status (unsigned int)> >(std::__1::function<absl::lts_20230802::Status (unsigned int)>&&) /opt/llvm/bin/../include/c++/v1/vector:1580:9
    #4 0x3348554 in Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>) const /proc/self/cwd/test/extensions/geoip_providers/maxmind/geoip_provider_test.cc:118:35
    #5 0x334830e in decltype(static_cast<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)&>(fp)(static_cast<std::__1::basic_string_view<char, std::__1::char_traits<char> >>(fp0), static_cast<unsigned int>(fp0), static_cast<std::__1::function<absl::lts_20230802::Status (unsigned int)>>(fp0))) std::__1::__invoke<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)&, std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> >(Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)&, std::__1::basic_string_view<char, std::__1::char_traits<char> >&&, unsigned int&&, std::__1::function<absl::lts_20230802::Status (unsigned int)>&&) /opt/llvm/bin/../include/c++/v1/type_traits:3640:23
    #6 0x33481c5 in absl::lts_20230802::Status std::__1::__invoke_void_return_wrapper<absl::lts_20230802::Status, false>::__call<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)&, std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> >(Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)&, std::__1::basic_string_view<char, std::__1::char_traits<char> >&&, unsigned int&&, std::__1::function<absl::lts_20230802::Status (unsigned int)>&&) /opt/llvm/bin/../include/c++/v1/__functional/invoke.h:30:16
    #7 0x334819d in std::__1::__function::__alloc_func<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>), std::__1::allocator<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>, absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >&&, unsigned int&&, std::__1::function<absl::lts_20230802::Status (unsigned int)>&&) /opt/llvm/bin/../include/c++/v1/__functional/function.h:180:16
    #8 0x3347993 in std::__1::__function::__func<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>), std::__1::allocator<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>, absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >&&, unsigned int&&, std::__1::function<absl::lts_20230802::Status (unsigned int)>&&) /opt/llvm/bin/../include/c++/v1/__functional/function.h:354:12
    #9 0x71758dd in std::__1::__function::__value_func<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >&&, unsigned int&&, std::__1::function<absl::lts_20230802::Status (unsigned int)>&&) const /opt/llvm/bin/../include/c++/v1/__functional/function.h:507:16
    #10 0x7175738 in std::__1::function<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>) const /opt/llvm/bin/../include/c++/v1/__functional/function.h:1184:12
    #11 0x71754e8 in decltype(std::forward<std::__1::function<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)> const&>(fp)(std::get<0ul>(std::forward<std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> > >(fp0)), std::get<1ul>(std::forward<std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> > >(fp0)), std::get<2ul>(std::forward<std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> > >(fp0)))) testing::internal::ApplyImpl<std::__1::function<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)> const&, std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> >, 0ul, 1ul, 2ul>(std::__1::function<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)> const&, std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> >&&, testing::internal::IndexSequence<0ul, 1ul, 2ul>) /proc/self/cwd/external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:420:10
    #12 0x7175395 in decltype(ApplyImpl(std::forward<std::__1::function<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)> const&>(fp), std::forward<std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> > >(fp0), (testing::internal::MakeIndexSequence<std::tuple_size<std::__1::remove_reference<std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> > >::type>::value>)())) testing::internal::Apply<std::__1::function<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)> const&, std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> > >(std::__1::function<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)> const&, std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> >&&) /proc/self/cwd/external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:429:10
    #13 0x7174d47 in testing::Action<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>::Perform(std::__1::tuple<std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)> >) const /proc/self/cwd/external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:497:12
    #14 0x7175afd in testing::internal::ActionResultHolder<absl::lts_20230802::Status>* testing::internal::ActionResultHolder<absl::lts_20230802::Status>::PerformAction<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>(testing::Action<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)> const&, testing::internal::Function<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>::ArgumentTuple&&) /proc/self/cwd/external/com_google_googletest/googlemock/include/gmock/gmock-spec-builders.h:1402:24
    #15 0x7173651 in testing::internal::FunctionMocker<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>::UntypedPerformAction(void const*, void*) const /proc/self/cwd/external/com_google_googletest/googlemock/include/gmock/gmock-spec-builders.h:1556:12
    #16 0xa3e9535 in testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*) /proc/self/cwd/external/com_google_googletest/googlemock/src/gmock-spec-builders.cc:452:24
    #17 0x333e5b2 in testing::internal::FunctionMocker<absl::lts_20230802::Status (std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>)>::Invoke(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>) /proc/self/cwd/external/com_google_googletest/googlemock/include/gmock/gmock-spec-builders.h:1593:15
    #18 0x333e24c in Envoy::Filesystem::MockWatcher::addWatch(std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned int, std::__1::function<absl::lts_20230802::Status (unsigned int)>) /proc/self/cwd/./test/mocks/filesystem/mocks.h:78:3
    #19 0x3405db9 in decltype(static_cast<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProvider::GeoipProvider(Envoy::Event::Dispatcher&, Envoy::Api::Api&, std::__1::shared_ptr<Envoy::Singleton::Instance>, std::__1::shared_ptr<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderConfig>)::$_0&>(fp)()) std::__1::__invoke<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProvider::GeoipProvider(Envoy::Event::Dispatcher&, Envoy::Api::Api&, std::__1::shared_ptr<Envoy::Singleton::Instance>, std::__1::shared_ptr<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderConfig>)::$_0&>(Envoy::Extensions::GeoipProviders::Maxmind::GeoipProvider::GeoipProvider(Envoy::Event::Dispatcher&, Envoy::Api::Api&, std::__1::shared_ptr<Envoy::Singleton::Instance>, std::__1::shared_ptr<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderConfig>)::$_0&) /proc/self/cwd/source/extensions/geoip_providers/maxmind/geoip_provider.cc:126:11
    #20 0x3404a63 in std::__1::__function::__func<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProvider::GeoipProvider(Envoy::Event::Dispatcher&, Envoy::Api::Api&, std::__1::shared_ptr<Envoy::Singleton::Instance>, std::__1::shared_ptr<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderConfig>)::$_0, std::__1::allocator<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProvider::GeoipProvider(Envoy::Event::Dispatcher&, Envoy::Api::Api&, std::__1::shared_ptr<Envoy::Singleton::Instance>, std::__1::shared_ptr<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderConfig>)::$_0>, void ()>::operator()() /opt/llvm/bin/../include/c++/v1/__functional/invoke.h:61:9
    #21 0x34f0239 in std::__1::__function::__value_func<void ()>::operator()() const /opt/llvm/bin/../include/c++/v1/__functional/function.h:507:16
    #22 0x91dbf37 in Envoy::Thread::PosixThreadFactory::createPthread(Envoy::Thread::ThreadHandle*)::$_6::__invoke(void*) /opt/llvm/bin/../include/c++/v1/__functional/function.h:1184:12
    #23 0x7fb0ecf9f608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x8608) (BuildId: 0c044ba611aeeeaebb8374e660061f341ebc0bac)
```

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
Fixes #35829
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional [API
Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

Signed-off-by: Kateryna Nezdolii <kateryna.nezdolii@gmail.com>
ravenblackx pushed a commit that referenced this pull request Sep 23, 2024
Fix for:
```
==12==ERROR: AddressSanitizer: heap-use-after-free on address 0x60300019d860 at pc 0xb7d3f059f8cc bp 0xe6dc6a8fde80 sp 0xe6dc6a8fd670
WRITE of size 24 at 0x60300019d860 thread T1
    #0 0xb7d3f059f8c8 in __asan_memset (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x48ef8c8)
    #1 0xb7d3f065bb9c in std::function<absl::lts_20230802::Status (unsigned int)>& std::vector<std::function<absl::lts_20230802::Status (unsigned int)>, std::allocator<std::function<absl::lts_20230802::Status (unsigned int)>>>::emplace_back<std::function<absl::lts_20230802::Status (unsigned int)>>(std::function<absl::lts_20230802::Status (unsigned int)>&&) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49abb9c)
    #2 0xb7d3f065b6a0 in Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)::operator()(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>) const (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49ab6a0)
    #3 0xb7d3f065b2c0 in std::_Function_handler<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>), Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>::_M_invoke(std::_Any_data const&, std::basic_string_view<char, std::char_traits<char>>&&, unsigned int&&, std::function<absl::lts_20230802::Status (unsigned int)>&&) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49ab2c0)
    #4 0xb7d3f3080050 in decltype(std::forward<std::function<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)> const&>(fp)(std::get<0ul>(std::forward<std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>>(fp0)), std::get<1ul>(std::forward<std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>>(fp0)), std::get<2ul>(std::forward<std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>>(fp0)))) testing::internal::ApplyImpl<std::function<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)> const&, std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>, 0ul, 1ul, 2ul>(std::function<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)> const&, std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>&&, testing::internal::IndexSequence<0ul, 1ul, 2ul>) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x73d0050)
    #5 0xb7d3f3080438 in testing::internal::ActionResultHolder<absl::lts_20230802::Status>* testing::internal::ActionResultHolder<absl::lts_20230802::Status>::PerformAction<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>(testing::Action<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)> const&, testing::internal::Function<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>::ArgumentTuple&&) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x73d0438)
    #6 0xb7d3f307e148 in testing::internal::FunctionMocker<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>::UntypedPerformAction(void const*, void*) const (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x73ce148)
    #7 0xb7d3f531993c in testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x966993c)
    #8 0xb7d3f0657fa0 in testing::internal::FunctionMocker<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>::Invoke(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49a7fa0)
    #9 0xb7d3f0657c2c in Envoy::Filesystem::MockWatcher::addWatch(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49a7c2c)
    #10 0xb7d3f06b63b4 in std::_Function_handler<void (), Envoy::Extensions::GeoipProviders::Maxmind::GeoipProvider::GeoipProvider(Envoy::Event::Dispatcher&, Envoy::Api::Api&, std::shared_ptr<Envoy::Singleton::Instance>, std::shared_ptr<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderConfig>)::$_0>::_M_invoke(std::_Any_data const&) geoip_provider.cc
    #11 0xb7d3f45c9fc8 in Envoy::Thread::PosixThreadFactory::createPthread(Envoy::Thread::ThreadHandle*)::$_0::__invoke(void*) thread_impl.cc
    #12 0xe6dc6ea637cc  (/lib/aarch64-linux-gnu/libc.so.6+0x837cc) (BuildId: 5b12268cafe96b30a4b950adece623b540b747be)
    #13 0xe6dc6eacf5c8  (/lib/aarch64-linux-gnu/libc.so.6+0xef5c8) (BuildId: 5b12268cafe96b30a4b950adece623b540b747be)

0x60300019d860 is located 0 bytes inside of 32-byte region [0x60300019d860,0x60300019d880)
freed by thread T0 here:
    #0 0xb7d3f05a0138 in free (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x48f0138)
    #1 0xb7d3f05edd2c in std::vector<std::function<absl::lts_20230802::Status (unsigned int)>, std::allocator<std::function<absl::lts_20230802::Status (unsigned int)>>>::~vector() (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x493dd2c)
    #2 0xb7d3f0648504 in Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::~GeoipProviderTestBase() (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x4998504)
    #3 0xb7d3f05eba10 in Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTest_ValidConfigCityAndIspDbsSuccessfulLookup_Test::~GeoipProviderTest_ValidConfigCityAndIspDbsSuccessfulLookup_Test() (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x493ba10)
    #4 0xb7d3f53a68b0 in testing::Test::DeleteSelf_() (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x96f68b0)
    #5 0xb7d3f53a5ccc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x96f5ccc)
    #6 0xb7d3f53702fc in testing::TestInfo::Run() (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x96c02fc)
    #7 0xb7d3f5371dc8 in testing::TestSuite::Run() (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x96c1dc8)
    #8 0xb7d3f5394e84 in testing::internal::UnitTestImpl::RunAllTests() (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x96e4e84)
    #9 0xb7d3f53a82a4 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x96f82a4)
    #10 0xb7d3f53945d0 in testing::UnitTest::Run() (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x96e45d0)
    #11 0xb7d3f2f2ea10 in Envoy::TestRunner::runTests(int, char**) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x727ea10)
    #12 0xb7d3f2f2b2c0 in main (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x727b2c0)
    #13 0xe6dc6ea07580  (/lib/aarch64-linux-gnu/libc.so.6+0x27580) (BuildId: 5b12268cafe96b30a4b950adece623b540b747be)
    #14 0xe6dc6ea07654 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x27654) (BuildId: 5b12268cafe96b30a4b950adece623b540b747be)
    #15 0xb7d3f0502eec in _start (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x4852eec)

previously allocated by thread T1 here:
    #0 0xb7d3f05a03cc in malloc (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x48f03cc)
    #1 0xb7d3f5428378 in operator new(unsigned long) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x9778378)
    #2 0xb7d3f065b994 in std::vector<std::function<absl::lts_20230802::Status (unsigned int)>, std::allocator<std::function<absl::lts_20230802::Status (unsigned int)>>>::reserve(unsigned long) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49ab994)
    #3 0xb7d3f065b684 in Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)::operator()(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>) const (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49ab684)
    #4 0xb7d3f065b2c0 in std::_Function_handler<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>), Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderTestBase::initializeProvider(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::optional<Envoy::ConditionalInitializer>&)::'lambda'()::operator()() const::'lambda'(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>::_M_invoke(std::_Any_data const&, std::basic_string_view<char, std::char_traits<char>>&&, unsigned int&&, std::function<absl::lts_20230802::Status (unsigned int)>&&) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49ab2c0)
    #5 0xb7d3f3080050 in decltype(std::forward<std::function<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)> const&>(fp)(std::get<0ul>(std::forward<std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>>(fp0)), std::get<1ul>(std::forward<std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>>(fp0)), std::get<2ul>(std::forward<std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>>(fp0)))) testing::internal::ApplyImpl<std::function<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)> const&, std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>, 0ul, 1ul, 2ul>(std::function<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)> const&, std::tuple<std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>>&&, testing::internal::IndexSequence<0ul, 1ul, 2ul>) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x73d0050)
    #6 0xb7d3f3080438 in testing::internal::ActionResultHolder<absl::lts_20230802::Status>* testing::internal::ActionResultHolder<absl::lts_20230802::Status>::PerformAction<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>(testing::Action<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)> const&, testing::internal::Function<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>::ArgumentTuple&&) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x73d0438)
    #7 0xb7d3f307e148 in testing::internal::FunctionMocker<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>::UntypedPerformAction(void const*, void*) const (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x73ce148)
    #8 0xb7d3f531993c in testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x966993c)
    #9 0xb7d3f0657fa0 in testing::internal::FunctionMocker<absl::lts_20230802::Status (std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>)>::Invoke(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49a7fa0)
    #10 0xb7d3f0657c2c in Envoy::Filesystem::MockWatcher::addWatch(std::basic_string_view<char, std::char_traits<char>>, unsigned int, std::function<absl::lts_20230802::Status (unsigned int)>) (/home/nezdolik.linux/.cache/bazel/_bazel_nezdolik/9a5f062d7ba021dba530b9f40b2998a7/execroot/envoy/bazel-out/aarch64-fastbuild/bin/test/extensions/geoip_providers/maxmind/geoip_provider_test+0x49a7c2c)
    #11 0xb7d3f06b61d4 in std::_Function_handler<void (), Envoy::Extensions::GeoipProviders::Maxmind::GeoipProvider::GeoipProvider(Envoy::Event::Dispatcher&, Envoy::Api::Api&, std::shared_ptr<Envoy::Singleton::Instance>, std::shared_ptr<Envoy::Extensions::GeoipProviders::Maxmind::GeoipProviderConfig>)::$_0>::_M_invoke(std::_Any_data const&) geoip_provider.cc
    #12 0xb7d3f45c9fc8 in Envoy::Thread::PosixThreadFactory::createPthread(Envoy::Thread::ThreadHandle*)::$_0::__invoke(void*) thread_impl.cc
    #13 0xe6dc6ea637cc  (/lib/aarch64-linux-gnu/libc.so.6+0x837cc) (BuildId: 5b12268cafe96b30a4b950adece623b540b747be)
    #14 0xe6dc6eacf5c8  (/lib/aarch64-linux-gnu/libc.so.6+0xef5c8) (BuildId: 5b12268cafe96b30a4b950adece623b540b747be)
```

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional [API
Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

Signed-off-by: Kateryna Nezdolii <kateryna.nezdolii@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants