Skip to content

heap-use-after-free when shutting down envoy. #733

Closed
@fengli79

Description

@fengli79
caught SIGTERM
main dispatch loop exited
exiting
WARNING: ThreadSanitizer: heap-use-after-free (pid=806410)
Read of size 8 at 0x7b54000006c0 by main thread:
 #0 event_del third_party/libevent/src/event.c:2288:2
 #1 Event::ImplBase::~ImplBase() third_party/envoy/src/source/common/event/event_impl_base.cc:9:3
 #2 ~FileEventImpl third_party/envoy/src/source/common/event/file_event_impl.h:13:7
 #3 Event::FileEventImpl::~FileEventImpl() third_party/envoy/src/source/common/event/file_event_impl.h:13
 #4 operator() unique_ptr.h:76:2
 #5 ~unique_ptr unique_ptr.h:236
 #6 ~HotRestartImpl third_party/envoy/src/source/exe/hot_restart.h:79
 #7 Server::HotRestartImpl::~HotRestartImpl() third_party/envoy/src/source/exe/hot_restart.h:79
 #8 operator() unique_ptr.h:76:2
 #9 ~unique_ptr unique_ptr.h:236
 #10 main third_party/envoy/src/source/exe/main.cc:57
Previous write of size 8 at 0x7b54000006c0 by main thread:
 #0 free third_party/llvm/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:629:3
 #1 event_mm_free_ third_party/libevent/src/event.c:2826:3
 #2 event_base_free third_party/libevent/src/event.c:842
 #3 ~unique_ptr unique_ptr.h:236:4
 #4 Event::DispatcherImpl::~DispatcherImpl() third_party/envoy/src/source/common/event/dispatcher_impl.cc:25
 #5 Event::DispatcherImpl::~DispatcherImpl() third_party/envoy/src/source/common/event/dispatcher_impl.cc:25:35
 #6 operator() unique_ptr.h:76:2
 #7 ~unique_ptr unique_ptr.h:236
 #8 Server::ConnectionHandlerImpl::~ConnectionHandlerImpl() third_party/envoy/src/source/server/connection_handler_impl.cc:19 
 #9 Server::InstanceImpl::~InstanceImpl() third_party/envoy/src/source/server/server.cc:356:32
 #10 main third_party/envoy/src/source/exe/main.cc:57:1
SUMMARY: ThreadSanitizer: heap-use-after-free third_party/libevent/src/event.c:2288:2 in event_del

I get a tsan heap use after free error. Which happens when shutting down envoy with sigterm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions