Skip to content

Failure reason desc#4

Closed
RomanDzhabarov wants to merge 4 commits intomasterfrom
failure_reason_desc
Closed

Failure reason desc#4
RomanDzhabarov wants to merge 4 commits intomasterfrom
failure_reason_desc

Conversation

@RomanDzhabarov
Copy link
Member

No description provided.

@RomanDzhabarov RomanDzhabarov deleted the failure_reason_desc branch August 11, 2016 04:32
@hzariv hzariv mentioned this pull request Jun 8, 2017
JimmyCYJ pushed a commit to JimmyCYJ/envoy that referenced this pull request Jun 7, 2018
JimmyCYJ pushed a commit to JimmyCYJ/envoy that referenced this pull request Jun 7, 2018
…base

Merge pull request envoyproxy#4 from mangchiandjjoe/sds_dynamic_secret
JimmyCYJ pushed a commit to JimmyCYJ/envoy that referenced this pull request Jun 7, 2018
JimmyCYJ pushed a commit to JimmyCYJ/envoy that referenced this pull request Jun 7, 2018
…secret_rebase

Revert "Merge pull request envoyproxy#4 from mangchiandjjoe/sds_dynamic_secret"
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>
phlax pushed a commit that referenced this pull request Apr 22, 2025
When trying to build and run fuzzers that may throw an exception (e.g.,
`bazel build //test/common/http:path_utility_fuzz_test
--config=asan-fuzzer`) the following error occurs:
```
$ bazel-bin/test/common/http/path_utility_fuzz_test /tmp/corpus
INFO: found LLVMFuzzerCustomMutator (0x555ec3b27058). Disabling -len_control by default.
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3031084950
INFO: Loaded 1 modules   (2436830 inline 8-bit counters): 2436830 [0x555ecf049c40, 0x555ecf29cb1e),
INFO: Loaded 1 PC tables (2436830 PCs): 2436830 [0x555ecf29cb20,0x555ed17cb900),
INFO:        5 files found in /tmp/corpus
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: seed corpus: files: 5 min: 91b max: 332b total: 1208b rss: 357Mb
libc++abi: terminating due to uncaught exception of type Envoy::EnvoyException
==3072858== ERROR: libFuzzer: deadly signal
    #0 0x555ec3ae0911 in __sanitizer_print_stack_trace (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa49f911)
    #1 0x555ec39e56b8 in fuzzer::PrintStackTrace() cxa_noexception.cpp
    #2 0x555ec39c8a53 in fuzzer::Fuzzer::CrashCallback() cxa_noexception.cpp
    #3 0x7f5506763e1f  (/lib/x86_64-linux-gnu/libc.so.6+0x3fe1f) (BuildId: ea119b374e0f8f858c82ad03a9542414f9ea1c8c)
    #4 0x7f55067b7e5b in __pthread_kill_implementation nptl/pthread_kill.c:43:17
    #5 0x7f5506763d81 in raise signal/../sysdeps/posix/raise.c:26:13
    #6 0x7f550674c4ef in abort stdlib/abort.c:79:7
    #7 0x555ecc751905 in abort_message abort_message.cpp
    #8 0x555ecc751ae2 in demangling_terminate_handler() cxa_default_handlers.cpp
    #9 0x555ecc7519a2 in std::__terminate(void (*)()) cxa_handlers.cpp
    #10 0x555ecc750fd5 in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) cxa_exception.cpp
    #11 0x555ecc750fbf in __cxa_throw (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0x1310ffbf)
    #12 0x555ec97f5a1f in Envoy::ProtoExceptionUtil::throwProtoValidationException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, google::protobuf::Message const&) (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0x101b4a1f)
    #13 0x555ec3b87a1c in void Envoy::MessageUtil::validate<test::common::http::PathUtilityTestCase>(test::common::http::PathUtilityTestCase const&, Envoy::ProtobufMessage::ValidationVisitor&, bool) (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa546a1c)
    #14 0x555ec3b277be in LLVMFuzzerTestOneInput (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa4e67be)
    #15 0x555ec39c9f60 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) cxa_noexception.cpp
    #16 0x555ec39c9785 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) cxa_noexception.cpp
    #17 0x555ec39cb712 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) cxa_noexception.cpp
    #18 0x555ec39cba02 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) cxa_noexception.cpp
    #19 0x555ec39b9eeb in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) cxa_noexception.cpp
    #20 0x555ec39e5f12 in main (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa3a4f12)
    #21 0x7f550674dd67 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #22 0x7f550674de24 in __libc_start_main csu/../csu/libc-start.c:360:3
    #23 0x555ec39ac720 in _start (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa36b720)

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
```

This PR adds a linking flag to allow the fuzzers to properly handle
exceptions.

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
oconnorkyle pushed a commit to oconnorkyle/envoy that referenced this pull request Apr 23, 2025
When trying to build and run fuzzers that may throw an exception (e.g.,
`bazel build //test/common/http:path_utility_fuzz_test
--config=asan-fuzzer`) the following error occurs:
```
$ bazel-bin/test/common/http/path_utility_fuzz_test /tmp/corpus
INFO: found LLVMFuzzerCustomMutator (0x555ec3b27058). Disabling -len_control by default.
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3031084950
INFO: Loaded 1 modules   (2436830 inline 8-bit counters): 2436830 [0x555ecf049c40, 0x555ecf29cb1e),
INFO: Loaded 1 PC tables (2436830 PCs): 2436830 [0x555ecf29cb20,0x555ed17cb900),
INFO:        5 files found in /tmp/corpus
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: seed corpus: files: 5 min: 91b max: 332b total: 1208b rss: 357Mb
libc++abi: terminating due to uncaught exception of type Envoy::EnvoyException
==3072858== ERROR: libFuzzer: deadly signal
    #0 0x555ec3ae0911 in __sanitizer_print_stack_trace (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa49f911)
    envoyproxy#1 0x555ec39e56b8 in fuzzer::PrintStackTrace() cxa_noexception.cpp
    envoyproxy#2 0x555ec39c8a53 in fuzzer::Fuzzer::CrashCallback() cxa_noexception.cpp
    envoyproxy#3 0x7f5506763e1f  (/lib/x86_64-linux-gnu/libc.so.6+0x3fe1f) (BuildId: ea119b374e0f8f858c82ad03a9542414f9ea1c8c)
    envoyproxy#4 0x7f55067b7e5b in __pthread_kill_implementation nptl/pthread_kill.c:43:17
    envoyproxy#5 0x7f5506763d81 in raise signal/../sysdeps/posix/raise.c:26:13
    envoyproxy#6 0x7f550674c4ef in abort stdlib/abort.c:79:7
    envoyproxy#7 0x555ecc751905 in abort_message abort_message.cpp
    envoyproxy#8 0x555ecc751ae2 in demangling_terminate_handler() cxa_default_handlers.cpp
    envoyproxy#9 0x555ecc7519a2 in std::__terminate(void (*)()) cxa_handlers.cpp
    envoyproxy#10 0x555ecc750fd5 in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) cxa_exception.cpp
    envoyproxy#11 0x555ecc750fbf in __cxa_throw (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0x1310ffbf)
    envoyproxy#12 0x555ec97f5a1f in Envoy::ProtoExceptionUtil::throwProtoValidationException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, google::protobuf::Message const&) (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0x101b4a1f)
    envoyproxy#13 0x555ec3b87a1c in void Envoy::MessageUtil::validate<test::common::http::PathUtilityTestCase>(test::common::http::PathUtilityTestCase const&, Envoy::ProtobufMessage::ValidationVisitor&, bool) (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa546a1c)
    envoyproxy#14 0x555ec3b277be in LLVMFuzzerTestOneInput (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa4e67be)
    envoyproxy#15 0x555ec39c9f60 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) cxa_noexception.cpp
    envoyproxy#16 0x555ec39c9785 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) cxa_noexception.cpp
    envoyproxy#17 0x555ec39cb712 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) cxa_noexception.cpp
    envoyproxy#18 0x555ec39cba02 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) cxa_noexception.cpp
    envoyproxy#19 0x555ec39b9eeb in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) cxa_noexception.cpp
    envoyproxy#20 0x555ec39e5f12 in main (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa3a4f12)
    envoyproxy#21 0x7f550674dd67 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    envoyproxy#22 0x7f550674de24 in __libc_start_main csu/../csu/libc-start.c:360:3
    envoyproxy#23 0x555ec39ac720 in _start (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa36b720)

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
```

This PR adds a linking flag to allow the fuzzers to properly handle
exceptions.

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
Signed-off-by: Kyle O'Connor <oconnorkyle@google.com>
oconnorkyle pushed a commit to oconnorkyle/envoy that referenced this pull request Apr 23, 2025
When trying to build and run fuzzers that may throw an exception (e.g.,
`bazel build //test/common/http:path_utility_fuzz_test
--config=asan-fuzzer`) the following error occurs:
```
$ bazel-bin/test/common/http/path_utility_fuzz_test /tmp/corpus
INFO: found LLVMFuzzerCustomMutator (0x555ec3b27058). Disabling -len_control by default.
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3031084950
INFO: Loaded 1 modules   (2436830 inline 8-bit counters): 2436830 [0x555ecf049c40, 0x555ecf29cb1e),
INFO: Loaded 1 PC tables (2436830 PCs): 2436830 [0x555ecf29cb20,0x555ed17cb900),
INFO:        5 files found in /tmp/corpus
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: seed corpus: files: 5 min: 91b max: 332b total: 1208b rss: 357Mb
libc++abi: terminating due to uncaught exception of type Envoy::EnvoyException
==3072858== ERROR: libFuzzer: deadly signal
    #0 0x555ec3ae0911 in __sanitizer_print_stack_trace (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa49f911)
    envoyproxy#1 0x555ec39e56b8 in fuzzer::PrintStackTrace() cxa_noexception.cpp
    envoyproxy#2 0x555ec39c8a53 in fuzzer::Fuzzer::CrashCallback() cxa_noexception.cpp
    envoyproxy#3 0x7f5506763e1f  (/lib/x86_64-linux-gnu/libc.so.6+0x3fe1f) (BuildId: ea119b374e0f8f858c82ad03a9542414f9ea1c8c)
    envoyproxy#4 0x7f55067b7e5b in __pthread_kill_implementation nptl/pthread_kill.c:43:17
    envoyproxy#5 0x7f5506763d81 in raise signal/../sysdeps/posix/raise.c:26:13
    envoyproxy#6 0x7f550674c4ef in abort stdlib/abort.c:79:7
    envoyproxy#7 0x555ecc751905 in abort_message abort_message.cpp
    envoyproxy#8 0x555ecc751ae2 in demangling_terminate_handler() cxa_default_handlers.cpp
    envoyproxy#9 0x555ecc7519a2 in std::__terminate(void (*)()) cxa_handlers.cpp
    envoyproxy#10 0x555ecc750fd5 in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) cxa_exception.cpp
    envoyproxy#11 0x555ecc750fbf in __cxa_throw (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0x1310ffbf)
    envoyproxy#12 0x555ec97f5a1f in Envoy::ProtoExceptionUtil::throwProtoValidationException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, google::protobuf::Message const&) (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0x101b4a1f)
    envoyproxy#13 0x555ec3b87a1c in void Envoy::MessageUtil::validate<test::common::http::PathUtilityTestCase>(test::common::http::PathUtilityTestCase const&, Envoy::ProtobufMessage::ValidationVisitor&, bool) (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa546a1c)
    envoyproxy#14 0x555ec3b277be in LLVMFuzzerTestOneInput (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa4e67be)
    envoyproxy#15 0x555ec39c9f60 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) cxa_noexception.cpp
    envoyproxy#16 0x555ec39c9785 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) cxa_noexception.cpp
    envoyproxy#17 0x555ec39cb712 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) cxa_noexception.cpp
    envoyproxy#18 0x555ec39cba02 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) cxa_noexception.cpp
    envoyproxy#19 0x555ec39b9eeb in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) cxa_noexception.cpp
    envoyproxy#20 0x555ec39e5f12 in main (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa3a4f12)
    envoyproxy#21 0x7f550674dd67 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    envoyproxy#22 0x7f550674de24 in __libc_start_main csu/../csu/libc-start.c:360:3
    envoyproxy#23 0x555ec39ac720 in _start (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa36b720)

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
```

This PR adds a linking flag to allow the fuzzers to properly handle
exceptions.

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
Signed-off-by: Kyle O'Connor <oconnorkyle@google.com>
jtlisi pushed a commit to jtlisi/envoy that referenced this pull request Apr 24, 2025
When trying to build and run fuzzers that may throw an exception (e.g.,
`bazel build //test/common/http:path_utility_fuzz_test
--config=asan-fuzzer`) the following error occurs:
```
$ bazel-bin/test/common/http/path_utility_fuzz_test /tmp/corpus
INFO: found LLVMFuzzerCustomMutator (0x555ec3b27058). Disabling -len_control by default.
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3031084950
INFO: Loaded 1 modules   (2436830 inline 8-bit counters): 2436830 [0x555ecf049c40, 0x555ecf29cb1e),
INFO: Loaded 1 PC tables (2436830 PCs): 2436830 [0x555ecf29cb20,0x555ed17cb900),
INFO:        5 files found in /tmp/corpus
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: seed corpus: files: 5 min: 91b max: 332b total: 1208b rss: 357Mb
libc++abi: terminating due to uncaught exception of type Envoy::EnvoyException
==3072858== ERROR: libFuzzer: deadly signal
    #0 0x555ec3ae0911 in __sanitizer_print_stack_trace (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa49f911)
    envoyproxy#1 0x555ec39e56b8 in fuzzer::PrintStackTrace() cxa_noexception.cpp
    envoyproxy#2 0x555ec39c8a53 in fuzzer::Fuzzer::CrashCallback() cxa_noexception.cpp
    envoyproxy#3 0x7f5506763e1f  (/lib/x86_64-linux-gnu/libc.so.6+0x3fe1f) (BuildId: ea119b374e0f8f858c82ad03a9542414f9ea1c8c)
    envoyproxy#4 0x7f55067b7e5b in __pthread_kill_implementation nptl/pthread_kill.c:43:17
    envoyproxy#5 0x7f5506763d81 in raise signal/../sysdeps/posix/raise.c:26:13
    envoyproxy#6 0x7f550674c4ef in abort stdlib/abort.c:79:7
    envoyproxy#7 0x555ecc751905 in abort_message abort_message.cpp
    envoyproxy#8 0x555ecc751ae2 in demangling_terminate_handler() cxa_default_handlers.cpp
    envoyproxy#9 0x555ecc7519a2 in std::__terminate(void (*)()) cxa_handlers.cpp
    envoyproxy#10 0x555ecc750fd5 in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) cxa_exception.cpp
    envoyproxy#11 0x555ecc750fbf in __cxa_throw (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0x1310ffbf)
    envoyproxy#12 0x555ec97f5a1f in Envoy::ProtoExceptionUtil::throwProtoValidationException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, google::protobuf::Message const&) (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0x101b4a1f)
    envoyproxy#13 0x555ec3b87a1c in void Envoy::MessageUtil::validate<test::common::http::PathUtilityTestCase>(test::common::http::PathUtilityTestCase const&, Envoy::ProtobufMessage::ValidationVisitor&, bool) (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa546a1c)
    envoyproxy#14 0x555ec3b277be in LLVMFuzzerTestOneInput (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa4e67be)
    envoyproxy#15 0x555ec39c9f60 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) cxa_noexception.cpp
    envoyproxy#16 0x555ec39c9785 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) cxa_noexception.cpp
    envoyproxy#17 0x555ec39cb712 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) cxa_noexception.cpp
    envoyproxy#18 0x555ec39cba02 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) cxa_noexception.cpp
    envoyproxy#19 0x555ec39b9eeb in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) cxa_noexception.cpp
    envoyproxy#20 0x555ec39e5f12 in main (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa3a4f12)
    envoyproxy#21 0x7f550674dd67 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    envoyproxy#22 0x7f550674de24 in __libc_start_main csu/../csu/libc-start.c:360:3
    envoyproxy#23 0x555ec39ac720 in _start (/usr/local/google/home/adip/.cache/bazel/_bazel_adip/8e88866af51670ff1222d99304421e7c/execroot/envoy/bazel-out/k8-fastbuild/bin/test/common/http/path_utility_fuzz_test+0xa36b720)

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
```

This PR adds a linking flag to allow the fuzzers to properly handle
exceptions.

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
Signed-off-by: Jacob Lisi <jtlisi@google.com>
ggmoy added a commit to ggmoy/envoyproxy-envoy that referenced this pull request Aug 7, 2025
The previous test implementation was causing random TSAN (ThreadSanitizer)
failures in CI for the following test configurations:

  - IPv4_HttpDownstream_Http2UpstreamNghttp2Legacy_DownstreamFilter
  - IPv6_HttpDownstream_Http2UpstreamNghttp2Legacy_UpstreamFilter
  - IPv4_Http2Downstream_Http2UpstreamNghttp2Legacy_DownstreamFilter

Below is an extract of the stack trace from the GitHub Action workflow:

/bin/addr2line: DWARF error: invalid or unhandled FORM value: 0x25
==================
WARNING: ThreadSanitizer: data race (pid=35)
  Write of size 1 at 0x72100000bfb8 by main thread:
    #0 Envoy::Logger::DelegatingLogSink::setShouldEscape(bool) ??:? (lua_integration_test+0x3ffffd3)
    envoyproxy#1 Envoy::(anonymous namespace)::LuaIntegrationTest_MetadataFallbackToCanonicalName_Test::TestBody() lua_integration_test.cc:? (lua_integration_test+0x3f5745b)
    .
    .
    .

  Previous read of size 1 at 0x72100000bfb8 by thread T99 (mutexes: read M0):
    #0 Envoy::Logger::DelegatingLogSink::log(spdlog::details::log_msg const&)::$_0::operator()(Envoy::Logger::SinkDelegate&) const logger.cc:? (lua_integration_test+0xbb77fa2)
    envoyproxy#1 Envoy::Logger::DelegatingLogSink::log(spdlog::details::log_msg const&) ??:? (lua_integration_test+0xbb77e4c)
    envoyproxy#2 spdlog::logger::sink_it_(spdlog::details::log_msg const&) ??:? (lua_integration_test+0x3fa4772)
    .
    .
    .

  Location is heap block of size 64 at 0x72100000bf80 allocated by main thread:
    #0 malloc ??:? (lua_integration_test+0x3ec84cc)
    envoyproxy#1 operator new(unsigned long) ??:? (lua_integration_test+0xcb198b7)
    envoyproxy#2 Envoy::Logger::DelegatingLogSink::init() ??:? (lua_integration_test+0xbb7845e)
    envoyproxy#3 Envoy::Logger::Registry::getSink() ??:? (lua_integration_test+0x3fffec4)
    envoyproxy#4 Envoy::Logger::Context::activate() ??:? (lua_integration_test+0xbb78c10)
    envoyproxy#5 Envoy::Logger::Context::Context(spdlog::level::level_enum, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Envoy::Thread::BasicLockable&, bool, bool) ??:? (lua_integration_test+0xbb78b5c)
    envoyproxy#6 Envoy::TestRunner::runTests(int, char**) ??:? (lua_integration_test+0xa047b86)
    envoyproxy#7 main ??:? (lua_integration_test+0xa04549d)

  Mutex M0 (0x72100000bf98) created at:
    #0 __tsan_mutex_create ??:? (lua_integration_test+0x3f1b0cf)
    envoyproxy#1 absl::lts_20250512::Mutex::Mutex() ??:? (lua_integration_test+0x404374b)
    envoyproxy#2 Envoy::Logger::DelegatingLogSink::DelegatingLogSink() ??:? (lua_integration_test+0xbb7fa8e)
    envoyproxy#3 Envoy::Logger::DelegatingLogSink::init() ??:? (lua_integration_test+0xbb78470)
    envoyproxy#4 Envoy::Logger::Registry::getSink() ??:? (lua_integration_test+0x3fffec4)
    envoyproxy#5 Envoy::Logger::Context::activate() ??:? (lua_integration_test+0xbb78c10)
    envoyproxy#6 Envoy::Logger::Context::Context(spdlog::level::level_enum, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Envoy::Thread::BasicLockable&, bool, bool) ??:? (lua_integration_test+0xbb78b5c)
    envoyproxy#7 Envoy::TestRunner::runTests(int, char**) ??:? (lua_integration_test+0xa047b86)
    envoyproxy#8 main ??:? (lua_integration_test+0xa04549d)

  Thread T99 (tid=142, running) created by main thread at:
    #0 pthread_create ??:? (lua_integration_test+0x3ec9e2b)
    envoyproxy#1 Envoy::Thread::PosixThreadFactory::createPthread(Envoy::Thread::ThreadHandle*) ??:? (lua_integration_test+0xba8d202)
    envoyproxy#2 Envoy::Thread::PosixThreadFactory::createThread(std::__1::function<void ()>, std::__1::optional<Envoy::Thread::Options> const&, bool) ??:? (lua_integration_test+0xba8d406)
    envoyproxy#3 Envoy::Thread::PosixThreadFactory::createThread(std::__1::function<void ()>, std::__1::optional<Envoy::Thread::Options> const&) ??:? (lua_integration_test+0xba8d0cb)
    envoyproxy#4 Envoy::FakeUpstream::initializeServer() ??:? (lua_integration_test+0x55048cc)
    envoyproxy#5 Envoy::FakeUpstream::FakeUpstream(std::__1::unique_ptr<Envoy::Network::DownstreamTransportSocketFactory, std::__1::default_delete<Envoy::Network::DownstreamTransportSocketFactory> >&&, std::__1::unique_ptr<Envoy::Network::Socket, std::__1::default_delete<Envoy::Network::Socket> >&&, Envoy::FakeUpstreamConfig const&, bool) ??:? (lua_integration_test+0x5503f20)
    envoyproxy#6 Envoy::FakeUpstream::FakeUpstream(std::__1::unique_ptr<Envoy::Network::DownstreamTransportSocketFactory, std::__1::default_delete<Envoy::Network::DownstreamTransportSocketFactory> >&&, std::__1::shared_ptr<Envoy::Network::Address::Instance const> const&, Envoy::FakeUpstreamConfig const&) ??:? (lua_integration_test+0x5504491)
    .
    .
    .

SUMMARY: ThreadSanitizer: data race ??:? in Envoy::Logger::DelegatingLogSink::setShouldEscape(bool)

Signed-off-by: Gustavo Moyano <gustavo.g.moyano@gmail.com>
phlax added a commit that referenced this pull request Aug 24, 2025
#40836)

…0169)"

This reverts commit 8c03b2a.

Signed-off-by: Ryan Northey <ryan@synca.io>
melginaldi pushed a commit to melginaldi/envoy that referenced this pull request Aug 26, 2025
…voyproxy#4… (envoyproxy#40836)

…0169)"

This reverts commit 8c03b2a.

Signed-off-by: Ryan Northey <ryan@synca.io>
Signed-off-by: Melissa Ginaldi <mginaldi@google.com>
wtzhang23 pushed a commit to wtzhang23/envoy that referenced this pull request Aug 27, 2025
…voyproxy#4… (envoyproxy#40836)

…0169)"

This reverts commit 8c03b2a.

Signed-off-by: Ryan Northey <ryan@synca.io>
botengyao pushed a commit that referenced this pull request Dec 16, 2025
…2554)

## Description

Today, when a filesystem watch callback returns a non-OK status or
throws an exception, the error gets propagated to `FileEventImpl` which
uses `THROW_IF_NOT_OK`.

Since there's no exception handler in the `libevent` loop, this causes
`std::terminate` to be called, which crashes Envoy.

**Stack Trace:**
```
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.119][234999][warning][misc] [source/common/protobuf/message_validator_impl.cc:23] Deprecated field: type envoy.config.core.v3.HeaderValueOption Using deprecated option 'envoy.config.core.v3.HeaderValueOption.append' from file base.proto. This configuration will be removed from Envoy soon. Please see https://www.envoyproxy.io/docs/envoy/latest/version_history/version_history for details. If continued use of this field is absolutely necessary, see https://www.envoyproxy.io/docs/envoy/latest/configuration/operations/runtime#using-runtime-overrides-for-deprecated-features for how to apply a temporary and highly discouraged override.
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.120][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener '0_listener'
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.123][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener '1_listener'
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.126][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener '2_listener'
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.127][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener '3_listener'
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.128][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener '4_listener'
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.130][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener '5_listener'
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.132][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener '6_listener'
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.134][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener 'mtls_untrusted_regional_transparent_tunnel_listener'
Dec 11 00:11:26 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:26.135][234999][info][upstream] [source/common/listener_manager/lds_api.cc:109] lds: add/update listener 'mtls_app_trusted_regional_transparent_tunnel_listener'
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.097][234999][critical][main] [source/exe/terminate_handler.cc:36] std::terminate called! Uncaught unknown exception, see trace.
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.097][234999][critical][backtrace] [./source/server/backtrace.h:113] Backtrace (use tools/stack_decode.py to get line numbers):
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.097][234999][critical][backtrace] [./source/server/backtrace.h:114] Envoy version: 5eaabe0bbaad4612cb85473cd151039d8f1a2760/1.34.2-dev/Clean/RELEASE/BoringSSL
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.097][234999][critical][backtrace] [./source/server/backtrace.h:116] Address mapping: 558d8afcc000-558d8ee2f000 /usr/local/bin/envoy
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.100][234999][critical][backtrace] [./source/server/backtrace.h:123] #0: [0x558d8da5784f]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.102][234999][critical][backtrace] [./source/server/backtrace.h:123] #1: [0x558d8edd8673]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.104][234999][critical][backtrace] [./source/server/backtrace.h:123] #2: [0x558d8e3b120b]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.106][234999][critical][backtrace] [./source/server/backtrace.h:121] #3: Envoy::Filesystem::WatcherImpl::onInotifyEvent() [0x558d8e3990c3]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.108][234999][critical][backtrace] [./source/server/backtrace.h:123] #4: [0x558d8e3998d2]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.109][234999][critical][backtrace] [./source/server/backtrace.h:123] #5: [0x558d8e393de6]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.111][234999][critical][backtrace] [./source/server/backtrace.h:121] #6: Envoy::Event::FileEventImpl::mergeInjectedEventsAndRunCb() [0x558d8e394eb5]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.113][234999][critical][backtrace] [./source/server/backtrace.h:123] #7: [0x558d8e710823]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.115][234999][critical][backtrace] [./source/server/backtrace.h:121] #8: event_base_loop [0x558d8e70d4a1]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.117][234999][critical][backtrace] [./source/server/backtrace.h:121] #9: Envoy::Server::InstanceBase::run() [0x558d8daa2b99]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.119][234999][critical][backtrace] [./source/server/backtrace.h:121] #10: Envoy::MainCommonBase::run() [0x558d8da4327a]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.121][234999][critical][backtrace] [./source/server/backtrace.h:121] #11: Envoy::MainCommon::main() [0x558d8da44234]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.123][234999][critical][backtrace] [./source/server/backtrace.h:121] #12: main [0x558d8afcc11c]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.123][234999][critical][backtrace] [./source/server/backtrace.h:123] #13: [0x7f1d54073efb]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.123][234999][critical][backtrace] [./source/server/backtrace.h:121] #14: __libc_start_main [0x7f1d54073fbb]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.124][234999][critical][backtrace] [./source/server/backtrace.h:121] #15: _start [0x558d8afcc02e]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.124][234999][critical][backtrace] [./source/server/backtrace.h:129] Caught Aborted, suspect faulting address 0x395f7
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.124][234999][critical][backtrace] [./source/server/backtrace.h:113] Backtrace (use tools/stack_decode.py to get line numbers):
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.124][234999][critical][backtrace] [./source/server/backtrace.h:114] Envoy version: 5eaabe0bbaad4612cb85473cd151039d8f1a2760/1.34.2-dev/Clean/RELEASE/BoringSSL
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.124][234999][critical][backtrace] [./source/server/backtrace.h:116] Address mapping: 558d8afcc000-558d8ee2f000 /usr/local/bin/envoy
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.124][234999][critical][backtrace] [./source/server/backtrace.h:123] #0: [0x7f1d54089c90]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.124][234999][critical][backtrace] [./source/server/backtrace.h:121] #1: gsignal [0x7f1d54089bde]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.124][234999][critical][backtrace] [./source/server/backtrace.h:121] #2: abort [0x7f1d54072832]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.126][234999][critical][backtrace] [./source/server/backtrace.h:123] #3: [0x558d8da5785c]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.128][234999][critical][backtrace] [./source/server/backtrace.h:123] #4: [0x558d8edd8673]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.129][234999][critical][backtrace] [./source/server/backtrace.h:123] #5: [0x558d8e3b120b]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.129][234999][critical][backtrace] [./source/server/backtrace.h:121] #6: Envoy::Filesystem::WatcherImpl::onInotifyEvent() [0x558d8e3990c3]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.131][234999][critical][backtrace] [./source/server/backtrace.h:123] #7: [0x558d8e3998d2]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.133][234999][critical][backtrace] [./source/server/backtrace.h:123] #8: [0x558d8e393de6]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.133][234999][critical][backtrace] [./source/server/backtrace.h:121] #9: Envoy::Event::FileEventImpl::mergeInjectedEventsAndRunCb() [0x558d8e394eb5]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:123] #10: [0x558d8e710823]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:121] #11: event_base_loop [0x558d8e70d4a1]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:121] #12: Envoy::Server::InstanceBase::run() [0x558d8daa2b99]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:121] #13: Envoy::MainCommonBase::run() [0x558d8da4327a]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:121] #14: Envoy::MainCommon::main() [0x558d8da44234]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:121] #15: main [0x558d8afcc11c]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:123] #16: [0x7f1d54073efb]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:121] #17: __libc_start_main [0x7f1d54073fbb]
Dec 11 00:11:30 dbletE9433T node-envoy[234999]: [2025-12-11 00:11:30.135][234999][critical][backtrace] [./source/server/backtrace.h:121] #18: _start [0x558d8afcc02e]
```

In this change, we are making the `inotify` and `kqueue` watchers handle
callback errors gracefully by catching any exceptions using
`TRY_ASSERT_MAIN_THREAD`, logging errors instead of propagating them and
always returning the `OkStatus` to the event loop.

---

**Commit Message:** filesystem: Fix crash when watch callback returns
error or throws
**Additional Description:** Make `inotify` and `kqueue` watchers handle
callback errors gracefully.
**Risk Level:** Low
**Testing:** CI
**Docs Changes:** N/A
**Release Notes:** N/A

---------

Signed-off-by: Rohit Agrawal <rohit.agrawal@salesforce.com>
Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
wdauchy added a commit to wdauchy/envoy that referenced this pull request Feb 26, 2026
The LEDS subscription callback lambda captured `used_load_assignment`
by value as a raw pointer to the object owned by the
`cluster_load_assignment_` unique_ptr. When a subsequent EDS update
reassigned `cluster_load_assignment_`, the old object was destroyed
but existing LEDS subscriptions (not recreated for unchanged configs)
still held the dangling pointer. When the LEDS subscription later
fired its callback (e.g. onConfigUpdateFailed), dereferencing this
pointer caused a segfault.

Stack trace:

  #0: [0x77b9d6de8330]
  envoyproxy#1: Envoy::Upstream::EdsClusterImpl::BatchUpdateHelper::batchUpdate()
  envoyproxy#2: Envoy::Upstream::PrioritySetImpl::batchHostUpdate()
  envoyproxy#3: std::__1::__function::__func<>::operator()()
  envoyproxy#4: Envoy::Upstream::LedsSubscription::onConfigUpdateFailed()
  envoyproxy#5: Envoy::Config::GrpcSubscriptionImpl::onConfigUpdateFailed()
  envoyproxy#6: event_process_active_single_queue
  envoyproxy#7: event_base_loop
  envoyproxy#8: Envoy::Server::InstanceBase::run()

Fix by capturing `this` and accessing `cluster_load_assignment_`
directly, which always reflects the current valid assignment.

Signed-off-by: William Dauchy <william.dauchy@datadoghq.com>
wdauchy added a commit to wdauchy/envoy that referenced this pull request Feb 26, 2026
The LEDS subscription callback lambda captured `used_load_assignment`
by value as a raw pointer to the object owned by the
`cluster_load_assignment_` unique_ptr. When a subsequent EDS update
reassigned `cluster_load_assignment_`, the old object was destroyed
but existing LEDS subscriptions (not recreated for unchanged configs)
still held the dangling pointer. When the LEDS subscription later
fired its callback (e.g. onConfigUpdateFailed), dereferencing this
pointer caused a segfault.

Stack trace:

  #0: [0x77b9d6de8330]
  envoyproxy#1: Envoy::Upstream::EdsClusterImpl::BatchUpdateHelper::batchUpdate()
  envoyproxy#2: Envoy::Upstream::PrioritySetImpl::batchHostUpdate()
  envoyproxy#3: std::__1::__function::__func<>::operator()()
  envoyproxy#4: Envoy::Upstream::LedsSubscription::onConfigUpdateFailed()
  envoyproxy#5: Envoy::Config::GrpcSubscriptionImpl::onConfigUpdateFailed()
  envoyproxy#6: event_process_active_single_queue
  envoyproxy#7: event_base_loop
  envoyproxy#8: Envoy::Server::InstanceBase::run()

Fix by capturing `this` and accessing `cluster_load_assignment_`
directly, which always reflects the current valid assignment.

Signed-off-by: William Dauchy <william.dauchy@datadoghq.com>
wdauchy added a commit to wdauchy/envoy that referenced this pull request Feb 27, 2026
The LEDS subscription callback lambda captured `used_load_assignment`
by value as a raw pointer to the object owned by the
`cluster_load_assignment_` unique_ptr. When a subsequent EDS update
reassigned `cluster_load_assignment_`, the old object was destroyed
but existing LEDS subscriptions (not recreated for unchanged configs)
still held the dangling pointer. When the LEDS subscription later
fired its callback (e.g. onConfigUpdateFailed), dereferencing this
pointer caused a segfault.

Stack trace:

  #0: [0x77b9d6de8330]
  envoyproxy#1: Envoy::Upstream::EdsClusterImpl::BatchUpdateHelper::batchUpdate()
  envoyproxy#2: Envoy::Upstream::PrioritySetImpl::batchHostUpdate()
  envoyproxy#3: std::__1::__function::__func<>::operator()()
  envoyproxy#4: Envoy::Upstream::LedsSubscription::onConfigUpdateFailed()
  envoyproxy#5: Envoy::Config::GrpcSubscriptionImpl::onConfigUpdateFailed()
  envoyproxy#6: event_process_active_single_queue
  envoyproxy#7: event_base_loop
  envoyproxy#8: Envoy::Server::InstanceBase::run()

Fix by capturing `this` and accessing `cluster_load_assignment_`
directly, which always reflects the current valid assignment.

Signed-off-by: William Dauchy <william.dauchy@datadoghq.com>
botengyao pushed a commit that referenced this pull request Mar 2, 2026
Commit Message:
The LEDS subscription callback lambda captured `used_load_assignment` by
value as a raw pointer to the object owned by the
`cluster_load_assignment_` unique_ptr. When a subsequent EDS update
reassigned `cluster_load_assignment_`, the old object was destroyed but
existing LEDS subscriptions (not recreated for unchanged configs) still
held the dangling pointer. When the LEDS subscription later fired its
callback (e.g. onConfigUpdateFailed), dereferencing this pointer caused
a segfault.

Stack trace:
```
  #0: [0x77b9d6de8330]
  #1: Envoy::Upstream::EdsClusterImpl::BatchUpdateHelper::batchUpdate()
  #2: Envoy::Upstream::PrioritySetImpl::batchHostUpdate()
  #3: std::__1::__function::__func<>::operator()()
  #4: Envoy::Upstream::LedsSubscription::onConfigUpdateFailed()
  #5: Envoy::Config::GrpcSubscriptionImpl::onConfigUpdateFailed()
  #6: event_process_active_single_queue
  #7: event_base_loop
  #8: Envoy::Server::InstanceBase::run()
```

Fix by capturing `this` and accessing `cluster_load_assignment_`
directly, which always reflects the current valid assignment.
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: William Dauchy <william.dauchy@datadoghq.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.

1 participant