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

Wangle doesn't compile with fresh folly #10

Closed
vadimkantorov opened this issue Oct 2, 2015 · 2 comments
Closed

Wangle doesn't compile with fresh folly #10

vadimkantorov opened this issue Oct 2, 2015 · 2 comments

Comments

@vadimkantorov
Copy link

Hi,

It seems the operator-> (https://github.com/facebook/folly/blob/e845ef57f1f368944123e4a50bd4d1616a363efa/folly/Singleton.h#L453) was removed at some point, so wangle compiles no more.

By fresh folly I mean commit 8f1e662a59dec3476bf626b283effaa8a88acdd5 (and Singleton.h https://github.com/facebook/folly/blob/8f1e662a59dec3476bf626b283effaa8a88acdd5/folly/Singleton.h).

Vadim

@vadimkantorov
Copy link
Author

I could fix the compilation by replacing "->" to ".get()->" on line 62 of wangle/concurrent/GlobalExecutor.cpp

@djwatson
Copy link

djwatson commented Nov 9, 2015

Wangle was pushed, should be fixed?

@djwatson djwatson closed this as completed Nov 9, 2015
@lixiangnlp lixiangnlp mentioned this issue Nov 10, 2015
facebook-github-bot pushed a commit that referenced this issue May 15, 2017
Summary:
[Wangle] Fix ASAN-reported `heap-use-after-free` in `FilePoller`.

The problem is that if the polling function is currently running while `FilePoller` dtor is called, then the polling function will continue to run to completion, which may include referencing into the destructed `FilePoller`. We must ensure that the polling function is not running between cancelling it and destructing the `FilePoller` instance.

Discovered while running some unrelated test case from some unrelated internal project with ASAN. A cleaned-up version of the ASAN report follows:
```lang=none
ERROR: AddressSanitizer: heap-use-after-free
READ of size 8 at 0x602000008370 thread T2 (file-poller)
     #4 wangle/util/FilePoller.cpp:90            wangle::FilePoller::checkFiles()
     #5 wangle/util/FilePoller.cpp:69            wangle::FilePoller::init(std::chrono::duration<...>)::$_2::operator()() const
     #6 folly/Function.h:298                     void folly::detail::function::FunctionTraits<...>::callSmall<...>(folly::detail::function::Data&)
     #7 folly/Function.h:314                     folly::detail::function::FunctionTraits<...>::operator()()
     #8 folly/experimental/FunctionScheduler.cpp:432 folly::FunctionScheduler::runOneFunction(std::unique_lock<...>&, std::chrono::time_point<...>)
     #9 folly/experimental/FunctionScheduler.cpp:384 folly::FunctionScheduler::run()
    #10 folly/experimental/FunctionScheduler.cpp:334 folly::FunctionScheduler::start()::$_2::operator()() const

0x602000008370 is located 0 bytes inside of 16-byte region [0x602000008370,0x602000008380)
freed by thread T0 here:
     #0 ??:?                                     operator delete(void*)
     #5 wangle/util/FilePoller.h:97              wangle::FilePoller::FileData::~FileData()
     #6 folly/Traits.h:475                       std::pair<...>::~pair()
    #14 wangle/util/FilePoller.cpp:59            wangle::FilePoller::~FilePoller()
    #15 wangle/util/FilePoller.cpp:59            wangle::FilePoller::~FilePoller()
    #18 thrift/lib/cpp2/security/SecurityKillSwitchPoller.cpp:64 apache::thrift::SecurityKillSwitchPoller::~SecurityKillSwitchPoller()
    #19 thrift/lib/cpp2/server/ThriftServer.cpp:150 apache::thrift::ThriftServer::~ThriftServer()
    #26 folly/Traits.h:498                       std::shared_ptr<...>::~shared_ptr()
    #27 thrift/lib/cpp2/util/ScopedServerInterfaceThread.h:36 apache::thrift::ScopedServerInterfaceThread::~ScopedServerInterfaceThread()

previously allocated by thread T0 here:
     #0 ??:?                                     operator new(unsigned long)
     #4 wangle/util/FilePoller.h:99              wangle::FilePoller::FileData::FileData(std::function<...>, std::function<...>, std::function<...>)
     #5 wangle/util/FilePoller.cpp:117           wangle::FilePoller::addFileToTrack(std::__cxx11::basic_string<...> const&, std::function<...>, std::function<...>, std::function<...>)
     #6 thrift/lib/cpp2/security/SecurityKillSwitchPoller.cpp:50 apache::thrift::SecurityKillSwitchPoller::SecurityKillSwitchPoller(bool)
     #7 thrift/lib/cpp2/security/SecurityKillSwitchPoller.cpp:42 apache::thrift::SecurityKillSwitchPoller::SecurityKillSwitchPoller()
     #8 thrift/lib/cpp2/server/ThriftServer.cpp:95 apache::thrift::ThriftServer::ThriftServer(std::__cxx11::basic_string<...> const&, bool)
     #9 thrift/lib/cpp2/server/ThriftServer.cpp:93 apache::thrift::ThriftServer::ThriftServer()
    #18 thrift/lib/cpp2/util/ScopedServerInterfaceThread.cpp:35 apache::thrift::ScopedServerInterfaceThread::ScopedServerInterfaceThread(std::shared_ptr<...>, folly::SocketAddress const&, folly::Function<...>)
    #19 thrift/lib/cpp2/util/ScopedServerInterfaceThread.cpp:52 apache::thrift::ScopedServerInterfaceThread::ScopedServerInterfaceThread(std::shared_ptr<...>, std::__cxx11::basic_string<...> const&, unsigned short, folly::Function<...>)

Thread T2 (file-poller) created by T0 here:
     #0 ??:?                                     pthread_create
     #4 folly/experimental/FunctionScheduler.cpp:334 folly::FunctionScheduler::start()
     #5 wangle/util/FilePoller.cpp:28            wangle::(anonymous namespace)::PollerContext::PollerContext()
     #6 wangle/util/FilePoller.cpp:45            wangle::(anonymous namespace)::$_0::operator()() const
     #9 folly/Singleton-inl.h:258                folly::detail::SingletonHolder<...>::createInstance()
    #10 folly/Singleton-inl.h:123                folly::detail::SingletonHolder<...>::try_get()
    #11 folly/Singleton.h:564                    folly::Singleton<...>::try_get()
    #12 wangle/util/FilePoller.cpp:62            wangle::FilePoller::init(std::chrono::duration<...>)
    #13 wangle/util/FilePoller.cpp:56            wangle::FilePoller::FilePoller(std::chrono::duration<...>)
    #15 thrift/lib/cpp2/security/SecurityKillSwitchPoller.cpp:45 apache::thrift::SecurityKillSwitchPoller::SecurityKillSwitchPoller(bool)
    #16 thrift/lib/cpp2/security/SecurityKillSwitchPoller.cpp:42 apache::thrift::SecurityKillSwitchPoller::SecurityKillSwitchPoller()
    #17 thrift/lib/cpp2/server/ThriftServer.cpp:95 apache::thrift::ThriftServer::ThriftServer(std::__cxx11::basic_string<...> const&, bool)
    #18 thrift/lib/cpp2/server/ThriftServer.cpp:93 apache::thrift::ThriftServer::ThriftServer()
    #27 thrift/lib/cpp2/util/ScopedServerInterfaceThread.cpp:35 apache::thrift::ScopedServerInterfaceThread::ScopedServerInterfaceThread(std::shared_ptr<...>, folly::SocketAddress const&, folly::Function<...>)
    #28 thrift/lib/cpp2/util/ScopedServerInterfaceThread.cpp:52 apache::thrift::ScopedServerInterfaceThread::ScopedServerInterfaceThread(std::shared_ptr<...>, std::__cxx11::basic_string<...> const&, unsigned short, folly::Function<...>)
```

Reviewed By: siyengar

Differential Revision: D5059743

fbshipit-source-id: b8de4c3c86a36c747efe31875ed712a4b77ce7af
This was referenced Jun 21, 2017
facebook-github-bot pushed a commit that referenced this issue Dec 19, 2017
Summary:
This diff fixes the following memory leak:

```
xbu@devvm149:[~/fbsource/fbcode]: ASAN_OPTIONS=detect_leaks=1 buck test mode/dbg-asan wangle/acceptor/... -- --gtest-verbose-level 4 --no-print-passing --extended-tests
Building: finished in 0.6 sec (100%) 313/313 jobs, 0 updated, 0.0% cache miss
  Total time: 1.3 sec
TestPilot test runner for Facebook. See https://fburl.com/testpilot for details.
Testpilot build a22a8825fb55ce2ee4f36dd7a7705c900fc0d0b8 at Fri Dec 15 09:19:24 2017 by lpetre from /usr/local/fbprojects/packages/testinfra.testpilot/370/t.par
Trace available for this run at /tmp/testpilot.20171218-123822.3529484.log
Discovering tests
Running 45 tests
Started new test run: https://our.intern.facebook.com/intern/testinfra/testrun/805811534
      ☢ wangle/acceptor/test:EvbHandshakeHelperTest - EvbHandshakeHelperTest.TestDropConnection 0.008s 45/45 (FATAL)
Test appears to have passed but the binary exited with non-zero exit code 1.
This usually means something has crashed after the test was done.
Unfiltered output from the test binary:

Note: Google Test filter = EvbHandshakeHelperTest.TestDropConnection
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from EvbHandshakeHelperTest
[ RUN      ] EvbHandshakeHelperTest.TestDropConnection
[       OK ] EvbHandshakeHelperTest.TestDropConnection (8 ms)
[----------] 1 test from EvbHandshakeHelperTest (8 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (8 ms total)
[  PASSED  ] 1 test.

=================================================================
==3529740==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2848 byte(s) in 1 object(s) allocated from:
    #0 0xe08a18 in operator new(unsigned long) (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xe08a18)
    #1 0x4706f8 in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #2 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #3 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #4 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #5 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #6 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #7 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #8 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #9 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #10 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #11 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #12 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #13 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #14 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #15 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #16 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #17 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530
    #18 0x4ef004 in std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::operator()() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1520
    #19 0x4ee828 in std::thread::_Impl<std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)> >::_M_run() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/thread:115
    #20 0x7f4ab08d9170 in execute_native_thread_routine /home/engshare/third-party2/libgcc/5.x/src/gcc-5/x86_64-facebook-linux/libstdc++-v3/src/c++11/../../../.././libstdc++-v3/src/c++11/thread.cc:84
    #21 0x7f4aafdba7a8 in start_thread /home/engshare/third-party2/glibc/2.23/src/glibc-2.23/nptl/pthread_create.c:333

Indirect leak of 1024 byte(s) in 1 object(s) allocated from:
    #0 0xecfc60 in realloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecfc60)
    #1 0x7f4ab0e293fb in CRYPTO_realloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:379
    #2 0x7f4ab0efc144 in sk_dup /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/stack/stack.c:99
    #3 0x7f4ab12a93d3 in ssl_create_cipher_list /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_ciph.c:1678
    #4 0x7f4ab12a0753 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2053
    #5 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #6 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #7 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #8 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #9 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #10 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #11 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #12 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #13 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #14 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #15 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #16 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #17 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #18 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #19 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #20 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #21 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #22 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #23 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #24 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #25 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #26 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #27 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #28 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #29 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40

Indirect leak of 1024 byte(s) in 1 object(s) allocated from:
    #0 0xecfc60 in realloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecfc60)
    #1 0x7f4ab0e293fb in CRYPTO_realloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:379
    #2 0x7f4ab0efbf37 in sk_insert /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/stack/stack.c:186
    #3 0x7f4ab12a93ba in ssl_create_cipher_list /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_ciph.c:1670
    #4 0x7f4ab12a0753 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2053
    #5 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #6 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #7 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #8 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #9 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #10 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #11 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #12 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #13 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #14 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #15 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #16 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #17 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #18 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #19 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #20 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #21 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #22 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #23 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #24 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #25 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #26 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #27 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #28 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #29 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40

Indirect leak of 832 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab12a05b5 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:1988
    #3 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #4 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #5 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #6 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #7 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #8 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #9 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #10 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #11 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #12 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #13 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #14 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #15 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #16 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #17 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #18 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #19 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #20 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #21 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #22 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #23 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #24 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #25 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #26 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #27 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #28 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530
    #29 0x4ef004 in std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::operator()() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1520

Indirect leak of 752 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab12a377e in ssl_cert_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_cert.c:204
    #3 0x7f4ab12a06ac in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2037
    #4 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #5 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #6 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #7 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #8 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #9 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #10 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #11 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #12 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #13 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #14 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #15 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #16 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #17 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #18 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #19 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #20 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #21 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #22 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #23 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #24 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #25 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #26 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #27 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #28 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #29 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530

Indirect leak of 280 byte(s) in 1 object(s) allocated from:
    #0 0xe08a18 in operator new(unsigned long) (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xe08a18)
    #1 0x472618 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:104
    #2 0x47252b in std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:478
    #3 0x4720b4 in std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2> >&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/allocated_ptr.h:102
    #4 0x471d5c in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:615
    #5 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #6 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #7 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #8 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #9 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #10 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #11 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #12 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #13 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #14 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #15 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #16 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #17 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #18 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #19 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #20 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #21 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #22 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #23 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #24 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #25 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530
    #26 0x4ef004 in std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::operator()() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1520
    #27 0x4ee828 in std::thread::_Impl<std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)> >::_M_run() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/thread:115
    #28 0x7f4ab08d9170 in execute_native_thread_routine /home/engshare/third-party2/libgcc/5.x/src/gcc-5/x86_64-facebook-linux/libstdc++-v3/src/c++11/../../../.././libstdc++-v3/src/c++11/thread.cc:84
    #29 0x7f4aafdba7a8 in start_thread /home/engshare/third-party2/glibc/2.23/src/glibc-2.23/nptl/pthread_create.c:333

Indirect leak of 176 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab0efc668 in lh_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/lhash/lhash.c:138
    #3 0x7f4ab12a0706 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2046
    #4 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #5 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #6 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #7 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #8 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #9 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #10 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #11 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #12 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #13 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #14 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #15 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #16 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #17 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #18 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #19 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #20 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #21 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #22 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #23 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #24 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #25 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #26 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #27 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #28 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #29 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530

Indirect leak of 144 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab0f59a3e in X509_STORE_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/x509/x509_lu.c:186
    #3 0x7f4ab12a0718 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2049
    #4 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #5 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #6 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #7 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #8 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #9 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #10 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #11 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #12 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #13 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #14 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #15 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #16 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #17 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #18 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #19 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #20 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #21 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #22 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #23 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #24 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #25 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #26 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #27 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #28 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #29 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530

Indirect leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab0efc68a in lh_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/lhash/lhash.c:140
    #3 0x7f4ab12a0706 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2046
    #4 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #5 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #6 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #7 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #8 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #9 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #10 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #11 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #12 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #13 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #14 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #15 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #16 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #17 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #18 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #19 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #20 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #21 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #22 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #23 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #24 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #25 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #26 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #27 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #28 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #29 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab0f5d2e2 in X509_VERIFY_PARAM_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/x509/x509_vpm.c:176
    #3 0x7f4ab12a0772 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2063
    #4 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #5 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #6 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #7 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #8 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #9 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #10 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #11 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #12 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #13 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #14 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #15 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #16 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #17 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #18 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #19 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #20 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #21 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #22 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #23 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #24 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #25 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #26 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #27 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #28 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #29 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab0f5d2e2 in X509_VERIFY_PARAM_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/x509/x509_vpm.c:176
    #3 0x7f4ab0f59a90 in X509_STORE_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/x509/x509_lu.c:196
    #4 0x7f4ab12a0718 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2049
    #5 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #6 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #7 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #8 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #9 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #10 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #11 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #12 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #13 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #14 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #15 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #16 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #17 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #18 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #19 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #20 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #21 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #22 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #23 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #24 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #25 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #26 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #27 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #28 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #29 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40

Indirect leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab0f5d315 in X509_VERIFY_PARAM_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/x509/x509_vpm.c:181
    #3 0x7f4ab12a0772 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2063
    #4 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #5 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #6 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/alloc_traits.h:517
    #7 0x4722cc in std::_Sp_counted_ptr_inplace<folly::SSLContext, std::allocator<folly::SSLContext>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::SSLContext>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:522
    #8 0x471db1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::SSLContext, std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, folly::SSLContext*, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:617
    #9 0x471b13 in std::__shared_ptr<folly::SSLContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1096
    #10 0x471ab7 in std::shared_ptr<folly::SSLContext>::shared_ptr<std::allocator<folly::SSLContext>>(std::_Sp_make_shared_tag, std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:319
    #11 0x471a3b in std::shared_ptr<folly::SSLContext> std::allocate_shared<folly::SSLContext, std::allocator<folly::SSLContext>>(std::allocator<folly::SSLContext> const&) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:619
    #12 0x470d6a in std::shared_ptr<folly::SSLContext> std::make_shared<folly::SSLContext>() third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/bits/shared_ptr.h:635
    #13 0x47071d in EvbHandshakeHelperTest::SetUp()::{lambda()#1}::operator()() const wangle/acceptor/test/EvbHandshakeHelperTest.cpp:43
    #14 0x470454 in void folly::detail::function::FunctionTraits<void ()>::callSmall<EvbHandshakeHelperTest::SetUp()::{lambda()#1}>(folly::detail::function::Data&) folly/Function.h:314
    #15 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #16 0x785481 in folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3::operator()() folly/io/async/EventBase.cpp:581
    #17 0x78517f in void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_3>(folly::detail::function::Data&) folly/Function.h:321
    #18 0x4e91f9 in folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:330
    #19 0x7a56bd in folly::EventBase::FunctionRunner::messageAvailable(folly::Function<void ()>&&) folly/io/async/EventBase.cpp:59
    #20 0x79628c in folly::NotificationQueue<folly::Function<void ()> >::Consumer::consumeMessages(bool, unsigned long*) folly/io/async/NotificationQueue.h:703
    #21 0x7a5701 in folly::NotificationQueue<folly::Function<void ()> >::Consumer::handlerReady(unsigned short) folly/io/async/NotificationQueue.h:640
    #22 0x7b0864 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
    #23 0xfb0cb8 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
    #24 0xfb0f7f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
    #25 0x77c545 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:314
    #26 0x77b366 in folly::EventBase::loop() folly/io/async/EventBase.cpp:253
    #27 0x77fffd in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:451
    #28 0x4e6ad4 in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40
    #29 0x4ef13c in void std::_Bind_simple<void (*(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*>))(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true>*, folly::Range<char const*> const&)>::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/functional:1530

Indirect leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0xecf7f8 in malloc (/data/users/xbu/fbsource/fbcode/buck-out/dbg-asan/gen/wangle/acceptor/test/EvbHandshakeHelperTest+0xecf7f8)
    #1 0x7f4ab0e292e8 in CRYPTO_malloc /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/mem.c:346
    #2 0x7f4ab0f5d315 in X509_VERIFY_PARAM_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/x509/x509_vpm.c:181
    #3 0x7f4ab0f59a90 in X509_STORE_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/crypto/x509/x509_lu.c:196
    #4 0x7f4ab12a0718 in SSL_CTX_new /home/engshare/third-party2/openssl/1.0.2/src/openssl-1.0.2/ssl/ssl_lib.c:2049
    #5 0x6ebf18 in folly::SSLContext::SSLContext(folly::SSLContext::SSLVersion) folly/io/async/SSLContext.cpp:39
    #6 0x472c22 in void __gnu_cxx::new_allocator<folly::SSLContext>::construct<folly::SSLContext>(folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c++/trunk/ext/new_allocator.h:120
    #7 0x4727d7 in void std::allocator_traits<std::allocator<folly::SSLContext> >::construct<folly::SSLContext>(std::allocator<folly::SSLContext>&, folly::SSLContext*) third-party-buck/gcc-5-glibc-2.23/build/libgcc/include/c+(Truncated to 64511B by TestPilot; full output here: everstore://GPc2hQG7w0VgXwsHAAAAAADBLqhJbswMAAAz:Full_Test_Output:)
Finished test run: https://our.intern.facebook.com/intern/testinfra/testrun…
facebook-github-bot pushed a commit that referenced this issue Dec 3, 2021
…ations

Summary:
Acceptor keeps track of the number of outstanding pending handshakes through
`numPendingSSLConns_`. This counter is incremented right before an
AcceptorHandshakeManager is allocated, and it is decremented when the
handshake manager invokes `sslConnectionReady` or `sslConnectionError`.

Prior to this diff, the timeout path relied on an implementation detail of the
underlying helper to properly decrement this counter. The implementation
assumed that a timeout occurred, calling `helper_->dropConnection()` would
synchronously cause `connectionError()` to be raised, which would be forwarded
to the acceptor.

For example, if a client only sent a ClientHello and stopped future data,
the timeout stack would look something like:

```
#4 0x7f5db75591d7 in wangle::AcceptorHandshakeManager::connectionError(folly::AsyncTransport*, folly::exception_wrapper, folly::Optional<wangle::SSLErrorEnum>) wangle/acceptor/AcceptorHandshakeManager.cpp:84
 #5 0x7f5db7560f92 in wangle::FizzAcceptorHandshakeHelper::fizzHandshakeError(fizz::server::AsyncFizzServerT<fizz::server::ServerStateMachine>*, folly::exception_wrapper) wangle/acceptor/FizzAcceptorHandshakeHelper.cpp:137
 #6 0x7f5db7582a3b in fizz::server::AsyncFizzServerT<fizz::server::ServerStateMachine>::deliverHandshakeError(folly::exception_wrapper) ./buck-out/dev/gen/aab7ed39/fizz/server/async_fizz_server#header-mode-symlink-tree-with-header-map,headers/fizz/server/AsyncFizzServer-inl.h:239
 #7 0x7f5db7582be0 in fizz::server::AsyncFizzServerT<fizz::server::ServerStateMachine>::deliverAllErrors(folly::AsyncSocketException const&, bool) ./buck-out/dev/gen/aab7ed39/fizz/server/async_fizz_server#header-mode-symlink-tree-with-header-map,headers/fizz/server/AsyncFizzServer-inl.h:229
 #8 0x7f5db7576a05 in fizz::server::AsyncFizzServerT<fizz::server::ServerStateMachine>::closeNow() ./buck-out/dev/gen/aab7ed39/fizz/server/async_fizz_server#header-mode-symlink-tree-with-header-map,headers/fizz/server/AsyncFizzServer-inl.h:139
 #9 0x7f5dc7958576 in wangle::FizzAcceptorHandshakeHelper::dropConnection(wangle::SSLErrorEnum) ./buck-out/dev/gen/aab7ed39/wangle/acceptor/acceptor#header-mode-symlink-tree-with-header-map,headers/wangle/acceptor/FizzAcceptorHandshakeHelper.h:191
 #10 0x7f5db75357b3 in wangle::PeekingAcceptorHandshakeHelper::dropConnection(wangle::SSLErrorEnum) buck-out/dev/gen/aab7ed39/wangle/acceptor/acceptor#header-mode-symlink-tree-with-header-map,headers/wangle/acceptor/PeekingAcceptorHandshakeHelper.h:86
 #11 0x7f5db7559732 in wangle::AcceptorHandshakeManager::timeoutExpired() wangle/acceptor/AcceptorHandshakeManager.cpp:99
```

This only happens because `dropConnection()` would close the underlying socket,
which shows up as an I/O error on the handshaker (both for Fizz and for
OpenSSL).

This is the case for all existing implementations of handshake helpers.

This diff documents this behavior as required for handshake helper
implementations and adds a few debugging checks for verifying this property.

Reviewed By: knekritz

Differential Revision: D32302133

fbshipit-source-id: e0d9007954242a724dc7cb2b2d5073cac307bf4e
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

No branches or pull requests

2 participants