thrift/lib/cpp2/test/StreamingTest.cpp: fix SIOF bug and heap-use-after-free in a test
thrift/lib/cpp2/test/StreamingTest.cpp: fix SIOF bug and heap-use-after-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

getyourguide/fbthrift,SergeyMakarenko/fbthrift,getyourguide/fbthrift,LinusU/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,SergeyMakarenko/fbthrift,LinusU/fbthrift,facebook/fbthrift,getyourguide/fbthrift,facebook/fbthrift,LinusU/fbthrift,facebook/fbthrift,facebook/fbthrift,SergeyMakarenko/fbthrift,SergeyMakarenko/fbthrift,SergeyMakarenko/fbthrift,SergeyMakarenko/fbthrift,SergeyMakarenko/fbthrift,getyourguide/fbthrift,LinusU/fbthrift,facebook/fbthrift,facebook/fbthrift,LinusU/fbthrift,getyourguide/fbthrift,facebook/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,LinusU/fbthrift,LinusU/fbthrift,LinusU/fbthrift,SergeyMakarenko/fbthrift,LinusU/fbthrift,SergeyMakarenko/fbthrift,LinusU/fbthrift,SergeyMakarenko/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,LinusU/fbthrift,facebook/fbthrift,SergeyMakarenko/fbthrift,facebook/fbthrift,SergeyMakarenko/fbthrift