Skip to content

Update thrifty.hh - #15

Closed
fidelchen wants to merge 1 commit into
meta:masterfrom
fidelchen:patch-1
Closed

fidelchen wants to merge 1 commit into
meta:masterfrom
fidelchen:patch-1

Conversation

@fidelchen

Copy link
Copy Markdown

change thrifty.yy.h to thrifty.h

change thrifty.yy.h to thrifty.h
@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@djwatson

djwatson commented May 9, 2014

Copy link
Copy Markdown

I'm pretty sure this is dependent on the version of yacc / bison, as it is definitely generated as thrifty.yy.h for me. Probably requires changes to configure.ac too?

@fidelchen

Copy link
Copy Markdown
Author

I am not familiar on autoconf, but thrifty.h also writed in compiler/Makefile.am.

@djwatson

djwatson commented May 9, 2014

Copy link
Copy Markdown

Is anything actually broken here? Are you getting an error message?

@fidelchen

Copy link
Copy Markdown
Author

compile success.oh yeah!

@djwatson djwatson closed this May 12, 2014
ghost pushed a commit that referenced this pull request Feb 6, 2016
…er-free in a test

Summary:
Building/testing with gcc-4.9+ASAN would fail with this SIOF error:

  =================================================================
  ==2063684==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x000000eb4440 at pc 0x4e965e bp 0x7ffeb572d3f0 sp 0x7ffeb572d3e8
  READ of size 4 at 0x000000eb4440 thread T0
      #0 0x4e965d in apache::thrift::BaseThriftServer::BaseThriftServer() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x4e965d)
      #1 0x4daaf7 in apache::thrift::ThriftServer::ThriftServer(std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > const&, bool) thrift/lib/cpp2/server/ThriftServer.cpp:94
      #2 0x4daa29 in apache::thrift::ThriftServer::ThriftServer() thrift/lib/cpp2/server/ThriftServer.cpp:88
      #3 0x44f587 in void __gnu_cxx::new_allocator<apache::thrift::ThriftServer>::construct<apache::thrift::ThriftServer>(apache::thrift::ThriftServer*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44f587)
      #4 0x44efd9 in std::enable_if<std::allocator_traits<std::allocator<apache::thrift::ThriftServer> >::__construct_helper<apache::thrift::ThriftServer>::type::value, void>::type std::allocator_traits<std::allocator<apache::thrift::ThriftServer> >::_S_construct<apache::thrift::ThriftServer>(std::allocator<apache::thrift::ThriftServer>&, apache::thrift::ThriftServer*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44efd9)
      #5 0x44eb23 in decltype (_S_construct({parm#1}, {parm#2})) std::allocator_traits<std::allocator<apache::thrift::ThriftServer> >::construct<apache::thrift::ThriftServer>(std::allocator<apache::thrift::ThriftServer>&, apache::thrift::ThriftServer*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44eb23)
      #6 0x44e5ac in std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<apache::thrift::ThriftServer>) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44e5ac)
      #7 0x44dd7e in void __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2> >::construct<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2>, std::allocator<apache::thrift::ThriftServer> const>(std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2>*, std::allocator<apache::thrift::ThriftServer> const&&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44dd7e)
      #8 0x44d4ee in std::enable_if<std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2> > >::__construct_helper<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2>, std::allocator<apache::thrift::ThriftServer> const>::type::value, void>::type std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2> > >::_S_construct<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2>, std::allocator<apache::thrift::ThriftServer> const>(std::allocator<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2> >&, std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2>*, std::allocator<apache::thrift::ThriftServer> const&&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44d4ee)
      #9 0x44c10e in decltype (_S_construct({parm#1}, {parm#2}, (forward<std::allocator<apache::thrift::ThriftServer> const>)({parm#3}))) std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2> > >::construct<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2>, std::allocator<apache::thrift::ThriftServer> const>(std::allocator<std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2> >&, std::_Sp_counted_ptr_inplace<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>, (__gnu_cxx::_Lock_policy)2>*, std::allocator<apache::thrift::ThriftServer> const&&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44c10e)
      #10 0x44abb7 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>>(std::_Sp_make_shared_tag, apache::thrift::ThriftServer*, std::allocator<apache::thrift::ThriftServer> const&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44abb7)
      #11 0x448143 in std::__shared_ptr<apache::thrift::ThriftServer, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<apache::thrift::ThriftServer>>(std::_Sp_make_shared_tag, std::allocator<apache::thrift::ThriftServer> const&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x448143)
      #12 0x44496d in std::shared_ptr<apache::thrift::ThriftServer>::shared_ptr<std::allocator<apache::thrift::ThriftServer>>(std::_Sp_make_shared_tag, std::allocator<apache::thrift::ThriftServer> const&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x44496d)
      #13 0x43f179 in std::shared_ptr<apache::thrift::ThriftServer> std::allocate_shared<apache::thrift::ThriftServer, std::allocator<apache::thrift::ThriftServer>>(std::allocator<apache::thrift::ThriftServer> const&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x43f179)
      #14 0x437d94 in std::shared_ptr<apache::thrift::ThriftServer> std::make_shared<apache::thrift::ThriftServer>() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x437d94)
      #15 0x43158b in apache::thrift::TestThriftServerFactory<StreamingServiceInterface>::create() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/lib/cpp2/test/StreamingTest+0x43158b)
      #16 0x41e676 in __static_initialization_and_destruction_0 thrift/lib/cpp2/test/StreamingTest.cpp:57
      #17 0x41e946 in _GLOBAL__sub_I_factory thrift/lib/cpp2/test/StreamingTest.cpp:219
      #18 0xa63eee in __libc_csu_init /home/engshare/third-party2/glibc/2.20/src/glibc-2.20/csu/elf-init.c:88
      #19 0x7fd9cc787084 in __libc_start_main (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libc.so.6+0x20084)
      #0 0x414ba5 in _start /home/engshare/third-party2/glibc/2.20/src/glibc-2.20/csu/../sysdeps/x86_64/start.S:122

The fix is to make "sst" a meyers singleton. This is only a test, and it now works, so not worth seeing if we might actually need folly::Singleton.
There was also a heap use after free:

  [==========] Running 1 test from 1 test case.
  [----------] Global test environment set-up.
  [----------] 1 test from FetcherHandlerTest
  [ RUN      ] FetcherHandlerTest.example_pass
  =================================================================
  ==2542675==ERROR: AddressSanitizer: heap-use-after-free on address 0x61100003be00 at pc 0x51a786 bp 0x7fe84e344a60 sp 0x7fe84e344a58
  READ of size 4 at 0x61100003be00 thread T5
      #0 0x51a785 in folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::Try(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) folly/futures/Try-inl.h:26
      #1 0x518eac in void folly::Optional<folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >::construct<folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) folly/Optional.h:266
      #2 0x517b49 in folly::Optional<folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >::Optional(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) folly/Optional.h:128
      #3 0x515297 in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::Core(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) folly/futures/detail/Core.h:88
      #4 0x5143e0 in folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > folly::makeFuture<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) folly/futures/Future-inl.h:543
      #5 0x50954d in folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::ensure<apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}>(apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4})::{lambda(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&)#1}::operator()(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x50954d)
      #6 0x50a8d5 in std::enable_if<folly::detail::callableResult<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&>::ReturnsFuture::value, folly::detail::callableResult<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&>::Return>::type folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::thenImplementation<folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::ensure<apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}>(apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4})::{lambda(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&)#1}, folly::detail::callableResult<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&>, true, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >(apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}, {lambda(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&)#1}::argResult<true, apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >)::{lambda(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >)#1}::operator()(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x50a8d5)
      #7 0x50ecad in operator() folly/futures/detail/Core.h:137
      #8 0x50dd99 in _M_invoke third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2069
      #9 0x51909e in std::function<void (folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&)>::operator()(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) const third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2439
      #10 0x5172c2 in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::doCallback() folly/futures/detail/Core.h:355
      #11 0x51503b in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#2}::operator()() const (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51503b)
      #12 0x5175c3 in bool folly::detail::FSM<folly::detail::State>::updateState<folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#1}, folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#2}>(folly::detail::State, folly::detail::State, folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#1} const&, folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#2} const&) folly/futures/detail/FSM.h:100
      #13 0x5150b8 in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback() folly/futures/detail/Core.h:309
      #14 0x5141d4 in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::setResult(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) folly/futures/detail/Core.h:204
      #15 0x513c2a in folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::setTry(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) folly/futures/Promise-inl.h:117
      #16 0x5128d4 in void folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::setValue<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >(std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >&&) folly/futures/Promise-inl.h:126
      #17 0x508a26 in apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda(std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >)#1}::operator()(std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >) const (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x508a26)
      #18 0x5097d5 in _M_invoke third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2039
      #19 0x51fb74 in std::function<void (std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > const&)>::operator()(std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > const&) const third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2439
      #20 0x51f1a3 in apache::thrift::tutorial::fetcher::HttpFetcher::readEOF() thrift/tutorial/cpp/async/fetcher/HttpFetcher.cpp:88
      #21 0x83c394 in folly::AsyncSocket::handleRead() folly/io/async/AsyncSocket.cpp:1405
      #22 0x83a742 in folly::AsyncSocket::ioReady(unsigned short) folly/io/async/AsyncSocket.cpp:1245
      #23 0x8448f7 in folly::AsyncSocket::IoHandler::handlerReady(unsigned short) folly/io/async/AsyncSocket.h:634
      #24 0x860b30 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:160
      #25 0xa51889 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390
      #26 0xa51a8f in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532
      #27 0x84c201 in folly::EventBase::loopBody(int) folly/io/async/EventBase.cpp:335
      #28 0x84bcc6 in folly::EventBase::loop() folly/io/async/EventBase.cpp:287
      #29 0x84d3d2 in folly::EventBase::loopForever() folly/io/async/EventBase.cpp:435
      #30 0x67e771 in wangle::IOThreadPoolExecutor::threadRun(std::shared_ptr<wangle::ThreadPoolExecutor::Thread>) wangle/concurrent/IOThreadPoolExecutor.cpp:149
      #31 0x693623 in void std::_Mem_fn<void (wangle::ThreadPoolExecutor::*)(std::shared_ptr<wangle::ThreadPoolExecutor::Thread>)>::operator()<std::shared_ptr<wangle::ThreadPoolExecutor::Thread>&, void>(wangle::ThreadPoolExecutor*, std::shared_ptr<wangle::ThreadPoolExecutor::Thread>&) const (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x693623)
      #32 0x691902 in void std::_Bind<std::_Mem_fn<void (wangle::ThreadPoolExecutor::*)(std::shared_ptr<wangle::ThreadPoolExecutor::Thread>)> (wangle::ThreadPoolExecutor*, std::shared_ptr<wangle::ThreadPoolExecutor::Thread>)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:1264
      #33 0x68e593 in void std::_Bind<std::_Mem_fn<void (wangle::ThreadPoolExecutor::*)(std::shared_ptr<wangle::ThreadPoolExecutor::Thread>)> (wangle::ThreadPoolExecutor*, std::shared_ptr<wangle::ThreadPoolExecutor::Thread>)>::operator()<, void>() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x68e593)
      #34 0x68b733 in std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void (wangle::ThreadPoolExecutor::*)(std::shared_ptr<wangle::ThreadPoolExecutor::Thread>)> (wangle::ThreadPoolExecutor*, std::shared_ptr<wangle::ThreadPoolExecutor::Thread>)> >::_M_invoke(std::_Any_data const&) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2039
      #35 0x43827b in std::function<void ()>::operator()() const third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2439
      #36 0x4b5eb7 in void std::_Bind_simple<std::function<void ()> ()>::_M_invoke<>(std::_Index_tuple<>) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:1700
      #37 0x4b4dae in std::_Bind_simple<std::function<void ()> ()>::operator()() third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:1688
      #38 0x4b2f17 in std::thread::_Impl<std::_Bind_simple<std::function<void ()> ()> >::_M_run() third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/thread:115
      #39 0x7fe853c6c360 in execute_native_thread_routine (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libstdc++.so.6+0xe5360)
      #40 0x7fe8543067f0 in start_thread (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libpthread.so.0+0x77f0)
      #41 0x7fe854d5046c in __clone (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libc.so.6+0x10d46c)

  0x61100003be00 is located 64 bytes inside of 208-byte region [0x61100003bdc0,0x61100003be90)
  freed by thread T5 here:
      #0 0x7fe855b89937 in operator delete(void*) (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libasan.so.1+0x59937)
      #1 0x518f5d in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::detachOne() folly/futures/detail/Core.h:364
      #2 0x51b424 in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::detachPromise() folly/futures/detail/Core.h:221
      #3 0x519e6e in folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::detach() folly/futures/Promise-inl.h:72
      #4 0x517c5d in folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::~Promise() folly/futures/Promise-inl.h:64
      #5 0x51e799 in void __gnu_cxx::new_allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >::destroy<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >(folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51e799)
      #6 0x51e64d in std::enable_if<std::allocator_traits<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > >::__destroy_helper<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >::type::value, void>::type std::allocator_traits<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > >::_S_destroy<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >(std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >&, folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51e64d)
      #7 0x51e545 in void std::allocator_traits<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > >::destroy<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >(std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >&, folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >*) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/bits/alloc_traits.h:398
      #8 0x51e2c8 in std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>::_M_dispose() third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/bits/shared_ptr_base.h:524
      #9 0x422436 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/bits/shared_ptr_base.h:149
      #10 0x41f177 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/bits/shared_ptr_base.h:666
      #11 0x511ad7 in std::__shared_ptr<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x511ad7)
      #12 0x511af1 in std::shared_ptr<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >::~shared_ptr() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x511af1)
      #13 0x508a45 in apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda(std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >)#1}::~basic_fbstring() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x508a45)
      #14 0x509fdd in _M_destroy third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:1894
      #15 0x509947 in _M_manager third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:1918
      #16 0x418581 in std::_Function_base::~_Function_base() third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:1998
      #17 0x511831 in std::function<void (std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > const&)>::~function() third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2142
      #18 0x51fdd2 in apache::thrift::tutorial::fetcher::HttpFetcher::~HttpFetcher() thrift/tutorial/cpp/async/fetcher/HttpFetcher.h:33
      #19 0x51fe37 in apache::thrift::tutorial::fetcher::HttpFetcher::~HttpFetcher() thrift/tutorial/cpp/async/fetcher/HttpFetcher.h:33
      #20 0x508d4b in apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}::operator()() const (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x508d4b)
      #21 0x50952f in folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::ensure<apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}>(apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4})::{lambda(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&)#1}::operator()(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x50952f)
      #22 0x50a8d5 in std::enable_if<folly::detail::callableResult<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&>::ReturnsFuture::value, folly::detail::callableResult<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&>::Return>::type folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::thenImplementation<folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > folly::Future<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::ensure<apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}>(apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4})::{lambda(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&)#1}, folly::detail::callableResult<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> >, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&>, true, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >(apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}, {lambda(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&)#1}::argResult<true, apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#4}, folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >)::{lambda(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >)#1}::operator()(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x50a8d5)
      #23 0x50ecad in operator() folly/futures/detail/Core.h:137
      #24 0x50dd99 in _M_invoke third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2069
      #25 0x51909e in std::function<void (folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&)>::operator()(folly::Try<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >&&) const third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2439
      #26 0x5172c2 in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::doCallback() folly/futures/detail/Core.h:355
      #27 0x51503b in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#2}::operator()() const (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51503b)
      #28 0x5175c3 in bool folly::detail::FSM<folly::detail::State>::updateState<folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#1}, folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#2}>(folly::detail::State, folly::detail::State, folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#1} const&, folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback()::{lambda()#2} const&) folly/futures/detail/FSM.h:100
      #29 0x5150b8 in folly::detail::Core<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::maybeCallback() folly/futures/detail/Core.h:309

  previously allocated by thread T2 here:
      #0 0x7fe855b894bf in operator new(unsigned long) (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libasan.so.1+0x594bf)
      #1 0x517c05 in folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >::Promise() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x517c05)
      #2 0x51d6e3 in void __gnu_cxx::new_allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >::construct<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >>(folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51d6e3)
      #3 0x51d501 in std::enable_if<std::allocator_traits<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > >::__construct_helper<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >>::type::value, void>::type std::allocator_traits<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > >::_S_construct<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >>(std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >&, folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51d501)
      #4 0x51d2eb in decltype (_S_construct({parm#1}, {parm#2})) std::allocator_traits<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > >::construct<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >>(std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >&, folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51d2eb)
      #5 0x51d07e in std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51d07e)
      #6 0x51c6e6 in void __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2> >::construct<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const>(std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>*, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const&&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51c6e6)
      #7 0x51bbed in std::enable_if<std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2> > >::__construct_helper<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const>::type::value, void>::type std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2> > >::_S_construct<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const>(std::allocator<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2> >&, std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>*, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const&&) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/bits/alloc_traits.h:247
      #8 0x51a70e in decltype (_S_construct({parm#1}, {parm#2}, (forward<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const>)({parm#3}))) std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2> > >::construct<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const>(std::allocator<std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2> >&, std::_Sp_counted_ptr_inplace<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >, (__gnu_cxx::_Lock_policy)2>*, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const&&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51a70e)
      #9 0x518b99 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >>(std::_Sp_make_shared_tag, folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >*, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x518b99)
      #10 0x51676b in std::__shared_ptr<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >>(std::_Sp_make_shared_tag, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x51676b)
      #11 0x514edf in std::shared_ptr<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >::shared_ptr<std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >>(std::_Sp_make_shared_tag, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x514edf)
      #12 0x513b01 in std::shared_ptr<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > std::allocate_shared<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > >>(std::allocator<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > const&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x513b01)
      #13 0x512762 in std::shared_ptr<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > std::make_shared<folly::Promise<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >>() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x512762)
      #14 0x508e59 in apache::thrift::tutorial::fetcher::FetcherHandler::future_fetchHttp(apache::thrift::tutorial::fetcher::FetchHttpRequest const&) thrift/tutorial/cpp/async/fetcher/FetcherHandler.cpp:35
      #15 0x520405 in apache::thrift::tutorial::fetcher::FetcherSvIf::async_tm_fetchHttp(std::unique_ptr<apache::thrift::HandlerCallback<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::default_delete<apache::thrift::HandlerCallback<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > >, apache::thrift::tutorial::fetcher::FetchHttpRequest const&)::{lambda()#1}::operator()() const (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x520405)
      #16 0x520ae2 in future_catching<apache::thrift::tutorial::fetcher::FetcherSvIf::async_tm_fetchHttp(std::unique_ptr<apache::thrift::HandlerCallback<std::basic_fbstring<char> > >, const apache::thrift::tutorial::fetcher::FetchHttpRequest&)::<lambda()> > thrift/lib/cpp2/GeneratedCodeHelper.h:1090
      #17 0x520966 in async_tm<apache::thrift::tutorial::fetcher::FetcherSvIf::async_tm_fetchHttp(std::unique_ptr<apache::thrift::HandlerCallback<std::basic_fbstring<char> > >, const apache::thrift::tutorial::fetcher::FetchHttpRequest&)::<lambda()> > thrift/lib/cpp2/GeneratedCodeHelper.h:1127
      #18 0x52046b in apache::thrift::tutorial::fetcher::FetcherSvIf::async_tm_fetchHttp(std::unique_ptr<apache::thrift::HandlerCallback<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > >, std::default_delete<apache::thrift::HandlerCallback<std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > > > >, apache::thrift::tutorial::fetcher::FetchHttpRequest const&) _build/dbg/thrift/tutorial/cpp/async/fetcher/if-cpp2.thrift-gen/fetcher/gen-cpp2/Fetcher.cpp:29
      #19 0x53ba31 in void apache::thrift::tutorial::fetcher::FetcherAsyncProcessor::process_fetchHttp<apache::thrift::CompactProtocolReader, apache::thrift::CompactProtocolWriter>(std::unique_ptr<apache::thrift::ResponseChannel::Request, std::default_delete<apache::thrift::ResponseChannel::Request> >, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >, std::unique_ptr<apache::thrift::CompactProtocolReader, std::default_delete<apache::thrift::CompactProtocolReader> >, apache::thrift::Cpp2RequestContext*, folly::EventBase*, apache::thrift::concurrency::ThreadManager*) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x53ba31)
      #20 0x53ca85 in void apache::thrift::GeneratedAsyncProcessor::processInThread<apache::thrift::CompactProtocolReader, apache::thrift::CompactProtocolWriter, void (apache::thrift::tutorial::fetcher::FetcherAsyncProcessor::*)(std::unique_ptr<apache::thrift::ResponseChannel::Request, std::default_delete<apache::thrift::ResponseChannel::Request> >, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >, std::unique_ptr<apache::thrift::CompactProtocolReader, std::default_delete<apache::thrift::CompactProtocolReader> >, apache::thrift::Cpp2RequestContext*, folly::EventBase*, apache::thrift::concurrency::ThreadManager*), apache::thrift::tutorial::fetcher::FetcherAsyncProcessor>(std::unique_ptr<apache::thrift::ResponseChannel::Request, std::default_delete<apache::thrift::ResponseChannel::Request> >, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >, std::unique_ptr<apache::thrift::CompactProtocolReader, std::default_delete<apache::thrift::CompactProtocolReader> >, apache::thrift::Cpp2RequestContext*, folly::EventBase*, apache::thrift::concurrency::ThreadManager*, apache::thrift::concurrency::PRIORITY, bool, void (apache::thrift::tutorial::fetcher::FetcherAsyncProcessor::*)(std::unique_ptr<apache::thrift::ResponseChannel::Request, std::default_delete<apache::thrift::ResponseChannel::Request> >, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >, std::unique_ptr<apache::thrift::CompactProtocolReader, std::default_delete<apache::thrift::CompactProtocolReader> >, apache::thrift::Cpp2RequestContext*, folly::EventBase*, apache::thrift::concurrency::ThreadManager*), apache::thrift::tutorial::fetcher::FetcherAsyncProcessor*)::{lambda()#1}::operator()() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x53ca85)
      #21 0x55b10a in std::_Function_handler<void (), void apache::thrift::GeneratedAsyncProcessor::processInThread<apache::thrift::CompactProtocolReader, apache::thrift::CompactProtocolWriter, void (apache::thrift::tutorial::fetcher::FetcherAsyncProcessor::*)(std::unique_ptr<apache::thrift::ResponseChannel::Request, std::default_delete<apache::thrift::ResponseChannel::Request> >, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >, std::unique_ptr<apache::thrift::CompactProtocolReader, std::default_delete<apache::thrift::CompactProtocolReader> >, apache::thrift::Cpp2RequestContext*, folly::EventBase*, apache::thrift::concurrency::ThreadManager*), apache::thrift::tutorial::fetcher::FetcherAsyncProcessor>(std::unique_ptr<apache::thrift::ResponseChannel::Request, std::default_delete<apache::thrift::ResponseChannel::Request> >, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >, std::unique_ptr<apache::thrift::CompactProtocolReader, std::default_delete<apache::thrift::CompactProtocolReader> >, apache::thrift::Cpp2RequestContext*, folly::EventBase*, apache::thrift::concurrency::ThreadManager*, apache::thrift::concurrency::PRIORITY, bool, void (apache::thrift::tutorial::fetcher::FetcherAsyncProcessor::*)(std::unique_ptr<apache::thrift::ResponseChannel::Request, std::default_delete<apache::thrift::ResponseChannel::Request> >, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >, std::unique_ptr<apache::thrift::CompactProtocolReader, std::default_delete<apache::thrift::CompactProtocolReader> >, apache::thrift::Cpp2RequestContext*, folly::EventBase*, apache::thrift::concurrency::ThreadManager*), apache::thrift::tutorial::fetcher::FetcherAsyncProcessor*)::{lambda()#1}>::_M_invoke(std::_Any_data const&) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2039
      #22 0x43827b in std::function<void ()>::operator()() const third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/functional:2439
      #23 0x526dc0 in apache::thrift::EventTask::run() thrift/lib/cpp2/async/AsyncProcessor.h:61
      #24 0x43594a in apache::thrift::concurrency::ThreadManager::Task::run() thrift/lib/cpp/concurrency/ThreadManager-impl.h:59
      #25 0x455b8f in apache::thrift::concurrency::ThreadManager::ImplT<folly::LifoSemImpl<std::atomic, folly::Baton<std::atomic> > >::Worker<folly::LifoSemImpl<std::atomic, folly::Baton<std::atomic> > >::run() thrift/lib/cpp/concurrency/ThreadManager.tcc:122
      #26 0x79d9e5 in apache::thrift::concurrency::PthreadThread::threadMain(void*) thrift/lib/cpp/concurrency/PosixThreadFactory.cpp:194
      #27 0x7fe8543067f0 in start_thread (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libpthread.so.0+0x77f0)

  Thread T5 created by T3 here:
      #0 0x7fe855b5753a in pthread_create (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libasan.so.1+0x2753a)
      #1 0x7fe853c6daff in std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libstdc++.so.6+0xe6aff)
      #2 0x472a4e in std::thread::thread<std::function<void ()>>(std::function<void ()>&&) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/thread:135
      #3 0x469114 in wangle::NamedThreadFactory::newThread(std::function<void ()>&&) (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x469114)
      #4 0x684ed7 in wangle::ThreadPoolExecutor::addThreads(unsigned long) wangle/concurrent/ThreadPoolExecutor.cpp:92
      #5 0x684b1b in wangle::ThreadPoolExecutor::setNumThreads(unsigned long) wangle/concurrent/ThreadPoolExecutor.cpp:76
      #6 0x45febf in apache::thrift::ThriftServer::setup() thrift/lib/cpp2/server/ThriftServer.cpp:290
      #7 0x460b19 in apache::thrift::ThriftServer::serve() thrift/lib/cpp2/server/ThriftServer.cpp:351
      #8 0x61ddaa in apache::thrift::util::ScopedServerThread::Helper::run() thrift/lib/cpp/util/ScopedServerThread.cpp:173
      #9 0x79d9e5 in apache::thrift::concurrency::PthreadThread::threadMain(void*) thrift/lib/cpp/concurrency/PosixThreadFactory.cpp:194
      #10 0x7fe8543067f0 in start_thread (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libpthread.so.0+0x77f0)

  Thread T3 created by T0 here:
      #0 0x7fe855b5753a in pthread_create (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libasan.so.1+0x2753a)
      #1 0x79c951 in apache::thrift::concurrency::PthreadThread::start() thrift/lib/cpp/concurrency/PosixThreadFactory.cpp:108
      #2 0x61e9a0 in apache::thrift::util::ScopedServerThread::start(std::shared_ptr<apache::thrift::server::TServer> const&) thrift/lib/cpp/util/ScopedServerThread.cpp:259
      #3 0x430dd8 in apache::thrift::ScopedServerInterfaceThread::ScopedServerInterfaceThread(std::shared_ptr<apache::thrift::AsyncProcessorFactory>, std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > const&, unsigned short) thrift/lib/cpp2/util/ScopedServerInterfaceThread.cpp:41
      #4 0x415c3b in FetcherHandlerTest_example_pass_Test::TestBody() thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest.cpp:94
      #5 0x99e3b7 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) src/gtest.cc:2364
      #6 0x99e3b7 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) src/gtest.cc:2400
      #7 0x9902e4 in testing::Test::Run() src/gtest.cc:2437
      #8 0x9904b7 in testing::TestInfo::Run() src/gtest.cc:2612
      #9 0x9906d4 in testing::TestInfo::Run() src/gtest.cc:2587
      #10 0x9906d4 in testing::TestCase::Run() src/gtest.cc:2730
      #11 0x991bce in testing::TestCase::Run() src/gtest.cc:4571
      #12 0x991bce in testing::internal::UnitTestImpl::RunAllTests() src/gtest.cc:4602
      #13 0x991e39 in testing::internal::UnitTestImpl::RunAllTests() src/gtest.cc:4519
      #14 0x991e39 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) src/gtest.cc:2364
      #15 0x991e39 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) src/gtest.cc:2400
      #16 0x991e39 in testing::UnitTest::Run() src/gtest.cc:4223
      #17 0x6734e1 in RUN_ALL_TESTS() third-party2/gtest/1.7.0/gcc-4.9-glibc-2.20-fb/e9936bf/include/gtest/gtest.h:2326
      #18 0x67343d in main common/gtest/LightMain.cpp:9
      #19 0x7fe854c630f5 in __libc_start_main (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libc.so.6+0x200f5)
      #20 0x414be5 (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x414be5)

  Thread T2 created by T0 here:
      #0 0x7fe855b5753a in pthread_create (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libasan.so.1+0x2753a)
      #1 0x79c951 in apache::thrift::concurrency::PthreadThread::start() thrift/lib/cpp/concurrency/PosixThreadFactory.cpp:108
      #2 0x4501c7 in apache::thrift::concurrency::ThreadManager::ImplT<folly::LifoSemImpl<std::atomic, folly::Baton<std::atomic> > >::addWorker(unsigned long) thrift/lib/cpp/concurrency/ThreadManager.tcc:161
      #3 0x44f868 in apache::thrift::concurrency::SimpleThreadManager<folly::LifoSemImpl<std::atomic, folly::Baton<std::atomic> > >::start() (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x44f868)
      #4 0x430c96 in apache::thrift::ScopedServerInterfaceThread::ScopedServerInterfaceThread(std::shared_ptr<apache::thrift::AsyncProcessorFactory>, std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > const&, unsigned short) thrift/lib/cpp2/util/ScopedServerInterfaceThread.cpp:34
      #5 0x415c3b in FetcherHandlerTest_example_pass_Test::TestBody() thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest.cpp:94
      #6 0x99e3b7 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) src/gtest.cc:2364
      #7 0x99e3b7 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) src/gtest.cc:2400
      #8 0x9902e4 in testing::Test::Run() src/gtest.cc:2437
      #9 0x9904b7 in testing::TestInfo::Run() src/gtest.cc:2612
      #10 0x9906d4 in testing::TestInfo::Run() src/gtest.cc:2587
      #11 0x9906d4 in testing::TestCase::Run() src/gtest.cc:2730
      #12 0x991bce in testing::TestCase::Run() src/gtest.cc:4571
      #13 0x991bce in testing::internal::UnitTestImpl::RunAllTests() src/gtest.cc:4602
      #14 0x991e39 in testing::internal::UnitTestImpl::RunAllTests() src/gtest.cc:4519
      #15 0x991e39 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) src/gtest.cc:2364
      #16 0x991e39 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) src/gtest.cc:2400
      #17 0x991e39 in testing::UnitTest::Run() src/gtest.cc:4223
      #18 0x6734e1 in RUN_ALL_TESTS() third-party2/gtest/1.7.0/gcc-4.9-glibc-2.20-fb/e9936bf/include/gtest/gtest.h:2326
      #19 0x67343d in main common/gtest/LightMain.cpp:9
      #20 0x7fe854c630f5 in __libc_start_main (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libc.so.6+0x200f5)
      #21 0x414be5 (/data/users/meyering/fbsource/fbcode/_build/dbg/thrift/tutorial/cpp/async/fetcher/FetcherHandlerTest+0x414be5)

I'll leave that for a separate diff by someone else.

Reviewed By: alandau

Differential Revision: D2907366

fb-gh-sync-id: 3ba28c9f8361fabdff38faeb923997fd9f41da15
facebook-github-bot pushed a commit that referenced this pull request Oct 19, 2020
Summary:
Pull Request resolved: facebookexperimental/rust-shed#15

With the update from rustc 1.44 to 1.47 the doctests started to break when building a crate that depends on a different crate of the same name, see this: rust-lang/cargo#6819

This diff also removes the TravisCI build as it was broken and unused for some time.

Reviewed By: krallin

Differential Revision: D24390815

fbshipit-source-id: fa9c78ef394640afbf8c419f8276bbf339960406
facebook-github-bot pushed a commit that referenced this pull request Apr 18, 2022
Summary:
Fix `TMemoryBuffer::ensureCanWrite` for the empty buffer. Previously there was a UB because null pointer wasn't handled properly:

```
thrift/lib/cpp/transport/TBufferTransports.cpp:458:10: runtime error: applying non-zero offset 107271103209344 to null pointer
    #0 0x7f90a738cc31 in apache::thrift::transport::TMemoryBuffer::ensureCanWrite(unsigned int) thrift/lib/cpp/transport/TBufferTransports.cpp:458
    #1 0x7f90a7769b4e in apache::thrift::transport::TMemoryBuffer::getWritePtr(unsigned int) thrift/lib/cpp/transport/TBufferTransports.h:809
    #2 0x7f90a7769ae0 in apache::thrift::async::detail::TFramedACReadState::getReadBuffer(void**, unsigned long*) thrift/lib/cpp/async/TFramedAsyncChannel.cpp:
86
    #3 0x30909b in apache::thrift::async::TStreamAsyncChannel<apache::thrift::async::detail::TFramedACWriteRequest, apache::thrift::async::detail::TFramedACRea
dState>::getReadBuffer(void**, unsigned long*) thrift/lib/cpp/async/TStreamAsyncChannel-inl.h:260
    #4 0x7f90a767028d in folly::AsyncSocket::prepareReadBuffer(void**, unsigned long*) folly/io/async/AsyncSocket.cpp:2517
    #5 0x7f90a7677cf2 in folly::AsyncSocket::processNormalRead() folly/io/async/AsyncSocket.cpp:2869
    #6 0x7f90a767a1f4 in folly::AsyncSocket::handleRead() folly/io/async/AsyncSocket.cpp:2977
    #7 0x7f90a766d89a in folly::AsyncSocket::ioReady(unsigned short) folly/io/async/AsyncSocket.cpp:2398
    #8 0x7f90a76a442a in folly::AsyncSocket::IoHandler::handlerReady(unsigned short) folly/io/async/AsyncSocket.h:1294
    #9 0x7f90a75998d3 in folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:159
    #10 0x7f90a6943608 in event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390:5
    #11 0x7f90a6943608 in event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532:4
    #12 0x7f90a754aa23 in (anonymous namespace)::EventBaseBackend::eb_event_base_loop(int) folly/io/async/EventBase.cpp:74
    #13 0x7f90a7538e16 in folly::EventBase::loopBody(int, bool) folly/io/async/EventBase.cpp:381
    #14 0x7f90a75377f2 in folly::EventBase::loop() folly/io/async/EventBase.cpp:305
    #15 0x33722c in SocketPairTest<apache::thrift::async::TFramedAsyncChannel>::loop(unsigned int) thrift/lib/cpp/test/TAsyncChannelTest.cpp:506
    #16 0x3043a3 in SocketPairTest<apache::thrift::async::TFramedAsyncChannel>::runWithTimeout(unsigned int) thrift/lib/cpp/test/TAsyncChannelTest.cpp:513
    #17 0x3035f9 in SocketPairTest<apache::thrift::async::TFramedAsyncChannel>::run() thrift/lib/cpp/test/TAsyncChannelTest.cpp:509
    #18 0x2f6766 in TAsyncChannelTest_TestMultiSendRecvFramedQueued_Test::TestBody() thrift/lib/cpp/test/TAsyncChannelTest.cpp:729
    #19 0x7f90a6cc9fbf in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char c
onst*) /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2607:27
    #20 0x7f90a6cc9fbf in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char cons
t*) /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2643:52
    #21 0x7f90a6cb9ad5 in testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2682:50
    #22 0x7f90a6cb9ad5 in testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2672:6
    #23 0x7f90a6cb9c64 in testing::TestInfo::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2861:14
    #24 0x7f90a6cb9c64 in testing::TestInfo::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2833:6
    #25 0x7f90a6cba321 in testing::TestSuite::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:3015:31
    #26 0x7f90a6cba321 in testing::TestSuite::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2993:6
    #27 0x7f90a6cbab1e in testing::internal::UnitTestImpl::RunAllTests() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:5
855:47
    #28 0x7f90a6cb9d2c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl
*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2607:27
    #29 0x7f90a6cb9d2c in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*,
bool (testing::internal::UnitTestImpl::*)(), char const*) /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2643:52
    #30 0x7f90a6cb9d2c in testing::UnitTest::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:5438:55
    #31 0x7f90a75dbae0 in RUN_ALL_TESTS() third-party-buck/platform010/build/googletest/include/gtest/gtest.h:2490
    #32 0x7f90a75db758 in main common/gtest/LightMain.cpp:20
    #33 0x7f90a4e9b656 in __libc_start_call_main /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #34 0x7f90a4e9b717 in __libc_start_main_impl /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../csu/libc-start.c:409:3
    #35 0x2ecbe0 in _start /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../sysdeps/x86_64/start.S:116
```

Reviewed By: iahs

Differential Revision: D35723595

fbshipit-source-id: 3b0f3104a0e4551a94fcb45f2ccadcca85b699cd
meta-codesync Bot pushed a commit that referenced this pull request Jun 24, 2026
Summary:
Reproduces a heap-use-after-free where `Cpp2Channel::writeError` invokes `messageSendError()` on a freed `TransportUpgradeSendCallback` during connection teardown.

ASAN report:
```
==189==ERROR: AddressSanitizer: heap-use-after-free on address 0x506004b07dc0 at pc 0x55944737a034 bp 0x7f8fddb88a90 sp 0x7f8fddb88a88
READ of size 8 at 0x506004b07dc0 thread T529
SCARINESS: 51 (8-byte-read-heap-use-after-free)
    #0 0x55944737a033 in apache::thrift::Cpp2Channel::writeError(unsigned long, apache::thrift::transport::TTransportException const&) fbcode/thrift/lib/cpp2/async/Cpp2Channel.cpp:150
...
    #8 0x5594466740a8 in folly::futures::detail::CoreBase::doCallback(folly::ExecutorKeepAlive<folly::Executor>&&, folly::futures::detail::State) fbcode/folly/futures/detail/Core.cpp:614
    #9 0x55944666eb6a in folly::futures::detail::CoreBase::setResult_(folly::ExecutorKeepAlive<folly::Executor>&&) fbcode/folly/futures/detail/Core.cpp:515
    #10 0x55944663d29c in folly::futures::detail::Core<folly::Unit>::setResult(folly::ExecutorKeepAlive<folly::Executor>&&, folly::Try<folly::Unit>&&) fbcode/folly/futures/detail/Core.h:670
    #11 0x55944663d29c in folly::futures::detail::Core<folly::Unit>::setResult(folly::Try<folly::Unit>&&) fbcode/folly/futures/detail/Core.h:656
    #12 0x55944663d29c in folly::Promise<folly::Unit>::setTry(folly::Try<folly::Unit>&&) fbcode/folly/futures/Promise-inl.h:131
    #13 0x5594474b048d in folly::SharedPromise<folly::Unit>::setTry(folly::Try<folly::Unit>&&) fbcode/folly/futures/SharedPromise-inl.h:97
...
    #34 0x55944734a943 in wangle::OutputBufferingHandler::runLoopCallback() fbcode/wangle/channel/OutputBufferingHandler.h:64
    #35 0x55944668c0d7 in folly::EventBase::runLoopCallbackList(boost::intrusive::list<folly::EventBase::LoopCallback, boost::intrusive::constant_time_size<false>>&, folly::EventBase::LoopCallbacksDeadline const&) fbcode/folly/io/async/EventBase.cpp:1028
    #36 0x55944667f94b in folly::EventBase::runLoopCallbacks() fbcode/folly/io/async/EventBase.cpp:1049
    #37 0x55944668a0f8 in folly::EventBase::loopMain(int, folly::EventBase::LoopOptions) fbcode/folly/io/async/EventBase.cpp:657
    #38 0x55944668781a in folly::EventBase::loopBody(int, folly::EventBase::LoopOptions) fbcode/folly/io/async/EventBase.cpp:539
    #39 0x55944668781a in folly::EventBase::loop() fbcode/folly/io/async/EventBase.cpp:500
    #40 0x55944668d708 in folly::EventBase::loopForever() fbcode/folly/io/async/EventBase.cpp:811
    #41 0x5594467155ff in folly::IOThreadPoolExecutor::threadRun(std::shared_ptr<folly::ThreadPoolExecutor::Thread>) fbcode/folly/executors/IOThreadPoolExecutor.cpp:288
...
    #46 0x7f9316b2ce4b in __GI___clone3 /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
0x506004b07dc0 is located 0 bytes inside of 56-byte region [0x506004b07dc0,0x506004b07df8)
freed by thread T529 here:
    #0 0x55946670ff02 in operator delete(void*, unsigned long) (/thatch_package/thatch_vm/thatch_vm+0x2befaf02) (BuildId: 56231c3862d0070bdddfcef427b9b87e7d419753)
    #1 0x559449700745 in std::default_delete<apache::thrift::MessageChannel::SendCallback>::operator()(apache::thrift::MessageChannel::SendCallback*) const fbcode/third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:85
    #2 0x559449700745 in std::unique_ptr<apache::thrift::MessageChannel::SendCallback, std::default_delete<apache::thrift::MessageChannel::SendCallback>>::~unique_ptr() fbcode/third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:361
    #3 0x559449700745 in apache::thrift::Cpp2Connection::~Cpp2Connection() fbcode/thrift/lib/cpp2/server/Cpp2Connection.cpp:165
    #4 0x559449701ef0 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() fbcode/third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:186
    #5 0x559449701ef0 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() fbcode/third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:767
    #6 0x559449701ef0 in std::__shared_ptr<apache::thrift::Cpp2Connection, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() fbcode/third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1216
    #7 0x559449701ef0 in std::__shared_ptr<apache::thrift::Cpp2Connection, (__gnu_cxx::_Lock_policy)2>::reset() fbcode/third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1334
    #8 0x559449701ef0 in apache::thrift::Cpp2Connection::stop() fbcode/thrift/lib/cpp2/server/Cpp2Connection.cpp:226
    #9 0x5594496f06b4 in apache::thrift::Cpp2Connection::channelClosed(folly::exception_wrapper&&)::$_0::operator()() const fbcode/thrift/lib/cpp2/server/Cpp2Connection.cpp:753
    #10 0x5594496f06b4 in void folly::catch_exception<apache::thrift::Cpp2Connection::channelClosed(folly::exception_wrapper&&)::$_0&, void (*)() noexcept, void>(apache::thrift::Cpp2Connection::channelClosed(folly::exception_wrapper&&)::$_0&, void (*&&)() noexcept) fbcode/folly/lang/Exception.h:361
    #11 0x5594496f06b4 in folly::detail::ScopeGuardImpl<apache::thrift::Cpp2Connection::channelClosed(folly::exception_wrapper&&)::$_0, true>::execute() fbcode/folly/ScopeGuard.h:181
    #12 0x5594496f06b4 in folly::detail::ScopeGuardImpl<apache::thrift::Cpp2Connection::channelClosed(folly::exception_wrapper&&)::$_0, true>::~ScopeGuardImpl() fbcode/folly/ScopeGuard.h:154
    #13 0x5594496f06b4 in apache::thrift::Cpp2Connection::channelClosed(folly::exception_wrapper&&) fbcode/thrift/lib/cpp2/server/Cpp2Connection.cpp:757
    #14 0x5594499f1274 in apache::thrift::HeaderServerChannel::messageReceiveErrorWrapped(folly::exception_wrapper&&) fbcode/thrift/lib/cpp2/async/HeaderServerChannel.cpp:443
    #15 0x5594473469e9 in apache::thrift::Cpp2Channel::readException(wangle::HandlerContext<int, std::pair<std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>, apache::thrift::transport::THeader*>>*, folly::exception_wrapper) fbcode/thrift/lib/cpp2/async/Cpp2Channel.cpp:123
    #16 0x559447357e7f in wangle::ContextImpl<apache::thrift::Cpp2Channel>::readException(folly::exception_wrapper) fbcode/wangle/channel/HandlerContext-inl.h:303
    #17 0x55944735df83 in wangle::ContextImpl<apache::thrift::FramingHandler>::fireReadException(folly::exception_wrapper) fbcode/wangle/channel/HandlerContext-inl.h:214
    #18 0x559446f1ae77 in wangle::Handler<folly::IOBufQueue&, std::pair<std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>, std::unique_ptr<apache::thrift::transport::THeader, std::default_delete<apache::thrift::transport::THeader>>>, std::pair<std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>, apache::thrift::transport::THeader*>, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>>::readException(wangle::HandlerContext<std::pair<std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>, std::unique_ptr<apache::thrift::transport::THeader, std::default_delete<apache::thrift::transport::THeader>>>, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>>*, folly::exception_wrapper) fbcode/wangle/channel/Handler.h:66
    #19 0x559447360c1f in wangle::ContextImpl<apache::thrift::FramingHandler>::readException(folly::exception_wrapper) fbcode/wangle/channel/HandlerContext-inl.h:303
    #20 0x5594473690f3 in wangle::ContextImpl<apache::thrift::TAsyncTransportHandler>::fireReadException(folly::exception_wrapper) fbcode/wangle/channel/HandlerContext-inl.h:214
    #21 0x559447370f3a in apache::thrift::TAsyncTransportHandler::readErr(folly::AsyncSocketException const&) fbcode/thrift/lib/cpp2/async/TAsyncTransportHandler.h:132
    #22 0x5594494daea2 in fizz::AsyncFizzBase::deliverError(folly::AsyncSocketException const&, bool) fbcode/fizz/protocol/AsyncFizzBase.cpp:330
    #23 0x559449ae75f7 in fizz::server::AsyncFizzServerT<fizz::server::ServerStateMachine>::deliverAllErrors(folly::AsyncSocketException const&, bool) fbcode/fizz/server/AsyncFizzServer-inl.h:283
    #24 0x559449ae3b79 in fizz::server::AsyncFizzServerT<fizz::server::ServerStateMachine>::transportError(folly::AsyncSocketException const&) fbcode/fizz/server/AsyncFizzServer-inl.h:253
    #25 0x5594494dce93 in fizz::AsyncFizzBase::readErr(folly::AsyncSocketException const&) fbcode/fizz/protocol/AsyncFizzBase.cpp:449
    #26 0x5594494dce93 in non-virtual thunk to fizz::AsyncFizzBase::readErr(folly::AsyncSocketException const&) fbcode/fizz/protocol/AsyncFizzBase.h
    #27 0x559446f0a4a2 in folly::AsyncSocket::invokeAllErrors(folly::AsyncSocketException const&) fbcode/folly/io/async/AsyncSocket.cpp:4300
    #28 0x559446f0a4a2 in folly::AsyncSocket::finishFail(folly::AsyncSocketException const&) fbcode/folly/io/async/AsyncSocket.cpp:4317
    #29 0x559446f0a4a2 in folly::AsyncSocket::failWrite(char const*, folly::AsyncWriter::WriteCallback*, unsigned long, folly::AsyncSocketException const&) fbcode/folly/io/async/AsyncSocket.cpp:4420
    #30 0x559446f08bea in folly::AsyncSocket::writeImpl(folly::AsyncWriter::WriteCallback*, iovec const*, unsigned long, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>&&, unsigned long, folly::WriteFlags) fbcode/folly/io/async/AsyncSocket.cpp:2012
    #31 0x559446f09753 in folly::AsyncSocket::writeChainImpl(folly::AsyncWriter::WriteCallback*, iovec*, unsigned long, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>&&, folly::WriteFlags) fbcode/folly/io/async/AsyncSocket.cpp:1937
    #32 0x559446ed1e75 in folly::AsyncSocket::writeChain(folly::AsyncWriter::WriteCallback*, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>&&, folly::WriteFlags) fbcode/folly/io/async/AsyncSocket.cpp:1907
...
    #44 0x5594494d95a9 in fizz::AsyncFizzBase::writeChain(folly::AsyncWriter::WriteCallback*, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>&&, folly::WriteFlags) fbcode/fizz/protocol/AsyncFizzBase.cpp:218
    #45 0x55944736fd3d in apache::thrift::TAsyncTransportHandler::write(wangle::HandlerContext<folly::IOBufQueue&, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>>*, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>) fbcode/thrift/lib/cpp2/async/TAsyncTransportHandler.h:91
    #46 0x55944736c9a1 in wangle::ContextImpl<apache::thrift::TAsyncTransportHandler>::write(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>) fbcode/wangle/channel/HandlerContext-inl.h:319
    #47 0x55944736dad1 in non-virtual thunk to wangle::ContextImpl<apache::thrift::TAsyncTransportHandler>::write(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>>) fbcode/wangle/channel/HandlerContext-inl.h
```

Reviewed By: mshneer

Differential Revision: D109055907

fbshipit-source-id: 67f3cdba1b327e11b19eef44831b9905cc3e2048
meta-codesync Bot pushed a commit that referenced this pull request Oct 20, 2026
Summary:
**TL;DR:** More tests for `cpp.allocator` unions: every member kind, a stateful allocator, equal-allocator moves and more deserialization cases. Tests only.

## Why

The existing tests check the allocator only on flat `cpp.use_allocator` members (a string, a list or set of ints). These check that the allocator also reaches container elements and the fields of nested structs and unions, and cover a stateful allocator that does not propagate.

## Notes

New tests:
- `UnionPmr` members `aa_string_list`, `aa_map`, `aa_child` and `aa_inner`, exercised by the copy, move, assignment, swap, container, `op::decode` and deserialization tests.
- `StatefulUnion` (`ScopedStatefulAlloc`): copies and a deserialization round trip.
- `FieldRefUsesUnionAllocatorForNestedMembers`.
- `EqualAllocatorMovesTakeOverMember`, with the new `RefChildUnionPmr` whose member struct has a `cpp.ref` field: moves between equal allocators keep that field's pointer and allocate nothing.
- `EmptyUnionKeepsAllocator` and `UnionInsideAllocatorAwareStruct` for each serializer.

___

landed-with-radar-review

Differential Revision: D124167217

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

3 participants