Skip to content

Fix build error for gcc 4.8.2 (Ubuntu): missing definition of std::mutex - #2

Closed
curtmcd wants to merge 1 commit into
meta:masterfrom
curtmcd:master
Closed

curtmcd wants to merge 1 commit into
meta:masterfrom
curtmcd:master

Conversation

@curtmcd

@curtmcd curtmcd commented Apr 7, 2015

Copy link
Copy Markdown

This change is intended to fix the compile error below.

In file included from /home/csm/fboss/fboss/agent/hw/bcm/BcmSwitchEventManager.cpp:10:0:
/home/csm/fboss/fboss/agent/hw/bcm/BcmSwitchEventManager.h:47:3: error: 'mutex' in namespace 'std' does not name a type
   std::mutex lock_;
   ^

$ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a
Linux irp100-v01g15 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

@oridb

oridb commented Apr 11, 2015

Copy link
Copy Markdown
Contributor

This seems resolved after resyncing the open source and internal repositories.

@oridb oridb closed this Apr 11, 2015
facebook-github-bot pushed a commit that referenced this pull request Nov 17, 2021
Summary:
Also fixes an undefined behavior in our code:
```
    #0 0xca4b378 in facebook::fboss::phy::BaldEagle::fwSerdesParamsEyes(facebook::fboss::MdioController<facebook::fboss::YampMdio>::FullyLockedMdio&, facebook::fboss::phy::BaldEagle::LaneMode, facebook::fboss::LaneID)::$_46::operator()(int) const (/tmp/setup_link_test_bin-6.5.21+0xca4b378)
    #1 0xca3d48c in facebook::fboss::phy::BaldEagle::fwSerdesParamsEyes(facebook::fboss::MdioController<facebook::fboss::YampMdio>::FullyLockedMdio&, facebook::fboss::phy::BaldEagle::LaneMode, facebook::fboss::LaneID) (/tmp/setup_link_test_bin-6.5.21+0xca3d48c)
    #2 0xca3a8b1 in facebook::fboss::phy::BaldEagle::getPortInfo(facebook::fboss::Port const*, std::vector<facebook::fboss::LaneID, std::allocator<facebook::fboss::LaneID> > const&, std::vector<facebook::fboss::LaneID, std::allocator<facebook::fboss::LaneID> > const&) (/tmp/setup_link_test_bin-6.5.21+0xca3a8b1)
    #3 0x72b0706 in facebook::fboss::YampPhyInterfaceHandler::getPortInfo(int, facebook::fboss::Port const*, facebook::fboss::phy::PhyPortConfig) (/tmp/setup_link_test_bin-6.5.21+0x72b0706)
    #4 0x71c15d6 in std::_Function_handler<void (), facebook::fboss::YampPort::updateStats()::$_10>::_M_invoke(std::_Any_data const&) (/tmp/setup_link_test_bin-6.5.21+0x71c15d6)
    #5 0x71a0578 in facebook::fboss::Pim::runOnPimThreadAfterDelay(std::function<void ()>, unsigned int)::'lambda'()::operator()() const::'lambda'()::operator()() const (/tmp/setup_link_test_bin-6.5.21+0x71a0578)
    #6 0x1073e68e in folly::TimeoutManager::CobTimeouts::CobTimeout::timeoutExpired() (/tmp/setup_link_test_bin-6.5.21+0x1073e68e)
    #7 0x107182ef in folly::AsyncTimeout::libeventCallback(int, short, void*) (/tmp/setup_link_test_bin-6.5.21+0x107182ef)
    #8 0x14b144f7 in event_process_active (/tmp/setup_link_test_bin-6.5.21+0x14b144f7)
    #9 0x14b14717 in event_base_loop (/tmp/setup_link_test_bin-6.5.21+0x14b14717)
    #10 0x1071e2b3 in folly::EventBase::loopBody(int, bool) (/tmp/setup_link_test_bin-6.5.21+0x1071e2b3)
    #11 0x1071d780 in folly::EventBase::loop() (/tmp/setup_link_test_bin-6.5.21+0x1071d780)
    #12 0x107216fd in folly::EventBase::loopForever() (/tmp/setup_link_test_bin-6.5.21+0x107216fd)
    #13 0x7fc324218660 in execute_native_thread_routine (/usr/local/fbcode/platform009/lib/libstdc++.so.6+0xd9660)
    #14 0x7fc3240da20b in start_thread (/usr/local/fbcode/platform009/lib/libpthread.so.0+0x920b)
    #15 0x7fc323feb16e in clone (/usr/local/fbcode/platform009/lib/libc.so.6+0x11816e)

UndefinedBehaviorSanitizer: float-cast-overflow fboss/lib/phy/facebook/credo/yamp/BaldEagle.cpp:1455:22 in
```

Reviewed By: birdsoup

Differential Revision: D32162784

fbshipit-source-id: f12a5d5a4f1dd2e9a2b7cef89fb6c268e2d4e587
facebook-github-bot pushed a commit that referenced this pull request Mar 15, 2022
Summary:
On Elbert, sometimes when we fail a test, we trigger ThreadSanitizer error due to thread leakage. This is messing up the logs for finding the real error. Example:
https://www.internalfb.com/intern/sandcastle/job/18014399092681044/insights
```
WARNING: ThreadSanitizer: thread leak (pid=1196365)
  Thread T114 (tid=1197183, finished) created by main thread at:
    #0 pthread_create <null> (setup_qsfp_test_bin-credo-0.7.2+0xb4e184d)
    #1 CredoDebugCreateInterface(CredoContext*, CredoDebugInterface**) <null> (setup_qsfp_test_bin-credo-0.7.2+0xb2ff2c7)
    #2 facebook::fboss::SaiApiTable::queryApis(_sai_service_method_table_t*, std::set<_sai_api_t, std::less<_sai_api_t>, std::allocator<_sai_api_t> > const&) <null> (setup_qsfp_test_bin-credo-0.7.2+0x7a2b979)
    #3 facebook::fboss::SaiElbert8DDPhyPlatform::preHwInitialized() <null> (setup_qsfp_test_bin-credo-0.7.2+0x3fe8e50)
    #4 facebook::fboss::ElbertPhyManager::initExternalPhyMap() <null> (setup_qsfp_test_bin-credo-0.7.2+0x3f52e01)
    #5 facebook::fboss::WedgeManager::initExternalPhyMap() <null> (setup_qsfp_test_bin-credo-0.7.2+0x3ede87d)
    #6 facebook::fboss::ElbertManager::initExternalPhyMap() <null> (setup_qsfp_test_bin-credo-0.7.2+0x3f01cbb)
    #7 facebook::fboss::QsfpServiceHandler::init() <null> (setup_qsfp_test_bin-credo-0.7.2+0x3eb01bc)
    #8 facebook::fboss::setupThriftServer(std::unique_ptr<facebook::fboss::WedgeManager, std::default_delete<facebook::fboss::WedgeManager> >) <null> (setup_qsfp_test_bin-credo-0.7.2+0x3ead2b6)
    #9 facebook::fboss::HwQsfpEnsemble::init() <null> (setup_qsfp_test_bin-credo-0.7.2+0x3eabd50)
    #10 facebook::fboss::HwTest::SetUp() <null> (setup_qsfp_test_bin-credo-0.7.2+0x3e95920)
    #11 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) <null> (setup_qsfp_test_bin-credo-0.7.2+0xabcdb8f)
    #12 __libc_start_main <null> (libc.so.6+0x25dc4)

ThreadSanitizer: thread leak (/tmp/setup_qsfp_test_bin-credo-0.7.2+0xb4e184d) in pthread_create
==================
ThreadSanitizer: reported 1 warnings
```

Calling the SAI destructor from our destructor should clean that up no matter how the program ends. (exception, gtest abort, normal exit, etc.)

Also, when we fail in Setup(), the error is condition never satisfied. It's not clear which condition is failing.

Reviewed By: jasmeetbagga

Differential Revision: D34468555

fbshipit-source-id: dd0adf4579c404cf7e98e18d1b4f903bc16b5aa6
facebook-github-bot pushed a commit that referenced this pull request Jul 26, 2022
…ld boot.

Summary:
The following sequence is currently broken after the introduction of new port programming
1. cold boot agent + qsfp
2. warm boot qsfp ---------> This causes port flaps

This is because of the following code https://fburl.com/code/fxwph3cy
When qsfp service warm boots in step #2, it retrieves the last cold boot time from agent which is non-zero. QSFP service thinks it needs to cold boot as well and resets the data path in optics causing ports to flap.

In this change, I update the agent config timestamps in the warm boot state file that is written on a graceful exit. On a qsfp service warmboot, the qsfp service will retrieve the timestamps from this cache and use that to figure out if it needs to cold boot or warmboot.

Reviewed By: rajank7

Differential Revision: D38132129

fbshipit-source-id: 8e7fefdb1bd46f69b2c2832471cc45b477751526
facebook-github-bot pushed a commit that referenced this pull request Aug 12, 2022
Summary:
This happened during an on-diff link test:
```
ThreadSanitizer:DEADLYSIGNAL
==3804651==ERROR: ThreadSanitizer: SEGV on unknown address 0x0000003a0deb (pc 0x56253d46afc2 bp 0x7f5fceda87e0 sp 0x7f5fceda87d0 T3804675)
==3804651==The signal is caused by a READ memory access.
    #0 facebook::fboss::fsdb::FsdbPubSubManager::publishState(facebook::fboss::fsdb::OperDelta&&) <null> (setup_qsfp_test_bin-credo-0.7.2+0x4b04fc2)
    #1 facebook::fboss::fsdb::FsdbComponentSyncer::publishDelta(facebook::fboss::fsdb::OperDelta&&, bool) <null> (setup_qsfp_test_bin-credo-0.7.2+0x4afb231)
    #2 facebook::fboss::fsdb::FsdbStateComponentSyncer<facebook::fboss::cfg::QsfpServiceConfig>::publisherStateChanged(facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)::'lambda'()::operator()() const <null> (setup_qsfp_test_bin-credo-0.7.2+0x4af553e)
    #3 void folly::detail::function::FunctionTraits<void ()>::callSmall<facebook::fboss::fsdb::FsdbStateComponentSyncer<facebook::fboss::cfg::QsfpServiceConfig>::publisherStateChanged(facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)::'lambda'()>(folly::detail::function::Data&) <null> (setup_qsfp_test_bin-credo-0.7.2+0x4af5389)
    #4 void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_4>(folly::detail::function::Data&) <null> (setup_qsfp_test_bin-credo-0.7.2+0xc1dda4a)
    #5 bool folly::AtomicNotificationQueue<folly::Function<void ()> >::drive<folly::EventBase::FuncRunner&>(folly::EventBase::FuncRunner&) <null> (setup_qsfp_test_bin-credo-0.7.2+0xc1dcd22)
    #6 folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::execute() <null> (setup_qsfp_test_bin-credo-0.7.2+0xc1d722c)
    #7 non-virtual thunk to folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::handlerReady(unsigned short) <null> (setup_qsfp_test_bin-credo-0.7.2+0xc1dedfd)
    #8 folly::EventHandler::libeventCallback(int, short, void*) <null> (setup_qsfp_test_bin-credo-0.7.2+0xc1e287c)
    #9 event_base_loop <null> (setup_qsfp_test_bin-credo-0.7.2+0xcd43578)
    #10 (anonymous namespace)::EventBaseBackend::eb_event_base_loop(int) <null> (setup_qsfp_test_bin-credo-0.7.2+0xc1d95aa)
    #11 folly::EventBase::loopMain(int, bool) <null> (setup_qsfp_test_bin-credo-0.7.2+0xc1d6127)
    #12 folly::EventBase::loopForever() <null> (setup_qsfp_test_bin-credo-0.7.2+0xc1d9fa4)
    #13 folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&) <null> (setup_qsfp_test_bin-credo-0.7.2+0xc140edf)
    #14 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > > >::_M_run() <null> (setup_qsfp_test_bin-credo-0.7.2+0xc14190b)
    #15 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)
    #16 __tsan_thread_start_func <null> (setup_qsfp_test_bin-credo-0.7.2+0xd17efae)
    #17 start_thread <null> (libc.so.6+0x979be)
    #18 clone <null> (libc.so.6+0x127b9f)
```

Publishers are currently protected by publisherMutex_. But here we have publishState()->publishImpl(). We lock in publishImpl(). But publishState() does this without lock:
```
  publishImpl(statePathPublisher_.get(), std::move(pubUnit));
```

If the other thread is calling createStateDeltaPublisher(), this pointer could be half written. We obtain this garbage pointer. Then obtain the lock while trying to use this garbage.

Also, removeStateDeltaPublisher() is completely unprotected. It seems to be used only in tests. But adding locks there for completeness.

Reviewed By: jasmeetbagga

Differential Revision: D38337566

fbshipit-source-id: 08c2f83bfaae649baa591549a53fa1a94d22e313
facebook-github-bot pushed a commit that referenced this pull request Aug 12, 2022
Summary:
Using command from test plan:
```
==================
WARNING: ThreadSanitizer: data race on vptr (ctor/dtor vs virtual call) (pid=2900615)
  Read of size 8 at 0x7b5400005000 by thread T7:
    #0 folly::AsyncTimeout::libeventCallback(int, short, void*) folly/io/async/AsyncTimeout.cpp:174 (libfolly_io_async_async_base.so+0x46551)
    #1 event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390:5 (libevent-1.4.so.2+0x85e8)
    #2 event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532:4 (libevent-1.4.so.2+0x85e8)
    #3 folly::EventBase::loopMain(int, bool) folly/io/async/EventBase.cpp:400 (libfolly_io_async_async_base.so+0x55033)
    #4 folly::EventBase::loopBody(int, bool) folly/io/async/EventBase.cpp:326 (libfolly_io_async_async_base.so+0x54655)
    #5 folly::EventBase::loop() folly/io/async/EventBase.cpp:305 (libfolly_io_async_async_base.so+0x544cd)
    #6 folly::EventBase::loopForever() folly/io/async/EventBase.cpp:545 (libfolly_io_async_async_base.so+0x58632)
    #7 folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40 (libfolly_io_async_scoped_event_base_thread.so+0xc592)
    #8 void std::__invoke_impl<void, void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >(std::__invoke_other, void (*&&)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*&&, folly::EventBase*&&, folly::Baton<true, std::atomic>*&&, folly::Range<char const*>&&) third-party-buck/platform009/build/libgcc/include/c++/9.x/bits/invoke.h:60 (libfolly_io_async_scoped_event_base_thread.so+0x18545)
    #9 std::__invoke_result<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >::type std::__invoke<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >(void (*&&)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*&&, folly::EventBase*&&, folly::Baton<true, std::atomic>*&&, folly::Range<char const*>&&) third-party-buck/platform009/build/libgcc/include/c++/9.x/bits/invoke.h:95 (libfolly_io_async_scoped_event_base_thread.so+0x18267)
    #10 void std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) third-party-buck/platform009/build/libgcc/include/c++/9.x/thread:244 (libfolly_io_async_scoped_event_base_thread.so+0x18193)
    #11 std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > >::operator()() third-party-buck/platform009/build/libgcc/include/c++/9.x/thread:251 (libfolly_io_async_scoped_event_base_thread.so+0x180c8)
    #12 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > > >::_M_run() third-party-buck/platform009/build/libgcc/include/c++/9.x/thread:195 (libfolly_io_async_scoped_event_base_thread.so+0x1784f)
    #13 execute_native_thread_routine /home/engshare/third-party2/libgcc/9.x/src/gcc-9.x/x86_64-facebook-linux/libstdc++-v3/src/c++11/../../../.././libstdc++-v3/src/c++11/thread.cc:80:18 (libstdc++.so.6+0xd9660)

  Previous write of size 8 at 0x7b5400005000 by main thread (mutexes: write M118355245544776416):
    #0 facebook::fboss::fsdb::FsdbSubscriber<facebook::fboss::fsdb::OperState>::FsdbSubscriber(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*, folly::EventBase*, std::function<void (facebook::fboss::fsdb::OperState&&)>, bool, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>) fboss/fsdb/client/FsdbSubscriber.h:44 (libfboss_fsdb_client_fsdb_pub_sub.so+0x16eb06)
    #1 facebook::fboss::fsdb::FsdbStateSubscriber::FsdbStateSubscriber(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*, folly::EventBase*, std::function<void (facebook::fboss::fsdb::OperState&&)>, bool, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>) fboss/fsdb/client/FsdbStateSubscriber.h:14 (libfboss_fsdb_client_fsdb_pub_sub.so+0x16e7d4)
    #2 std::_MakeUniq<facebook::fboss::fsdb::FsdbStateSubscriber>::__single_object std::make_unique<facebook::fboss::fsdb::FsdbStateSubscriber, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*, folly::EventBase*, std::function<void (facebook::fboss::fsdb::OperState&&)>&, bool&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*&&, folly::EventBase*&&, std::function<void (facebook::fboss::fsdb::OperState&&)>&, bool&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>&) third-party-buck/platform009/build/libgcc/include/c++/9.x/bits/unique_ptr.h:857 (libfboss_fsdb_client_fsdb_pub_sub.so+0x16d101)
    #3 _ZZN8facebook5fboss4fsdb17FsdbPubSubManager19addSubscriptionImplINS1_19FsdbStateSubscriberEEEvRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EESt8functionIFvNS1_16FsdbStreamClient5StateESI_EENT_19FsdbSubUnitUpdateCbEbRKSB_iENKUlTyRSL_E_clISt13unordered_mapISB_St10unique_ptrISH_St14default_deleteISH_EESt4hashISB_ESt8equal_toISB_ESaISt4pairISN_SW_EEEEEDaSP_ fboss/fsdb/client/FsdbPubSubManager.cpp:243 (libfboss_fsdb_client_fsdb_pub_sub.so+0x16c8cd)
    #4 _ZN5folly16SynchronizedBaseINS_12SynchronizedISt13unordered_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt10unique_ptrIN8facebook5fboss4fsdb16FsdbStreamClientESt14default_deleteISD_EESt4hashIS8_ESt8equal_toIS8_ESaISt4pairIKS8_SG_EEENS_15SharedMutexImplILb0EvSt6atomicNS_24SharedMutexPolicyDefaultEEEEELNS_6detail22SynchronizedMutexLevelE2EE9withWLockIZNSC_17FsdbPubSubManager19addSubscriptionImplINSC_19FsdbStateSubscriberEEEvRKSt6vectorIS8_SaIS8_EESt8functionIFvNSD_5StateES18_EENT_19FsdbSubUnitUpdateCbEbRSM_iEUlTyRS1B_E_EEDaOS1B_ folly/Synchronized.h:305 (libfboss_fsdb_client_fsdb_pub_sub.so+0x16c6a7)
    #5 void facebook::fboss::fsdb::FsdbPubSubManager::addSubscriptionImpl<facebook::fboss::fsdb::FsdbStateSubscriber>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, facebook::fboss::fsdb::FsdbStateSubscriber::FsdbSubUnitUpdateCb, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) fboss/fsdb/client/FsdbPubSubManager.cpp:240 (libfboss_fsdb_client_fsdb_pub_sub.so+0x139f75)
    #6 facebook::fboss::fsdb::FsdbPubSubManager::addStatePathSubscription(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, std::function<void (facebook::fboss::fsdb::OperState&&)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) fboss/fsdb/client/FsdbPubSubManager.cpp:190 (libfboss_fsdb_client_fsdb_pub_sub.so+0x139d50)
    #7 facebook::fboss::TestSubscription<thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > >::TestSubscription(facebook::fboss::fsdb::FsdbPubSubManager*, thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > >) fboss/qsfp_service/fsdb/facebook/test/QsfpFsdbSyncerTest.cpp:69 (fsdb-syncer-test+0x104e5d)
    #8 facebook::fboss::TestSubscription<thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > > facebook::fboss::QsfpFsdbTcvrMgrTest::subscribe<thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > >(thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > >) fboss/qsfp_service/fsdb/facebook/test/QsfpFsdbSyncerTest.cpp:158 (fsdb-syncer-test+0xe3417)
    #9 facebook::fboss::QsfpFsdbTcvrMgrTest_testTcvrMgrConfigUpdate_Test::TestBody() fboss/qsfp_service/fsdb/facebook/test/QsfpFsdbSyncerTest.cpp:195 (fsdb-syncer-test+0xe2cd0)
    #10 testing::Test::Run() /home/engshare/third-party2/googletest/20201023/src/googletest/googletest/src/gtest.cc:2680:50 (libgtest.so.1.10.0+0x4d6a5)
    #11 testing::Test::Run() /home/engshare/third-party2/googletest/20201023/src/googletest/googletest/src/gtest.cc:2670:6 (libgtest.so.1.10.0+0x4d6a5)
    #12 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x218a)

  Location is heap block of size 592 at 0x7b5400005000 allocated by main thread:
    #0 operator new(unsigned long) <null> (fsdb-syncer-test+0x110b2c)
    #1 std::_MakeUniq<facebook::fboss::fsdb::FsdbStateSubscriber>::__single_object std::make_unique<facebook::fboss::fsdb::FsdbStateSubscriber, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*, folly::EventBase*, std::function<void (facebook::fboss::fsdb::OperState&&)>&, bool&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*&&, folly::EventBase*&&, std::function<void (facebook::fboss::fsdb::OperState&&)>&, bool&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>&) third-party-buck/platform009/build/libgcc/include/c++/9.x/bits/unique_ptr.h:857 (libfboss_fsdb_client_fsdb_pub_sub.so+0x16cf9f)
    #2 _ZZN8facebook5fboss4fsdb17FsdbPubSubManager19addSubscriptionImplINS1_19FsdbStateSubscriberEEEvRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EESt8functionIFvNS1_16FsdbStreamClient5StateESI_EENT_19FsdbSubUnitUpdateCbEbRKSB_iENKUlTyRSL_E_clISt13unordered_mapISB_St10unique_ptrISH_St14default_deleteISH_EESt4hashISB_ESt8equal_toISB_ESaISt4pairISN_SW_EEEEEDaSP_ fboss/fsdb/client/FsdbPubSubManager.cpp:243 (libfboss_fsdb_client_fsdb_pub_sub.so+0x16c8cd)
    #3 _ZN5folly16SynchronizedBaseINS_12SynchronizedISt13unordered_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt10unique_ptrIN8facebook5fboss4fsdb16FsdbStreamClientESt14default_deleteISD_EESt4hashIS8_ESt8equal_toIS8_ESaISt4pairIKS8_SG_EEENS_15SharedMutexImplILb0EvSt6atomicNS_24SharedMutexPolicyDefaultEEEEELNS_6detail22SynchronizedMutexLevelE2EE9withWLockIZNSC_17FsdbPubSubManager19addSubscriptionImplINSC_19FsdbStateSubscriberEEEvRKSt6vectorIS8_SaIS8_EESt8functionIFvNSD_5StateES18_EENT_19FsdbSubUnitUpdateCbEbRSM_iEUlTyRS1B_E_EEDaOS1B_ folly/Synchronized.h:305 (libfboss_fsdb_client_fsdb_pub_sub.so+0x16c6a7)
    #4 void facebook::fboss::fsdb::FsdbPubSubManager::addSubscriptionImpl<facebook::fboss::fsdb::FsdbStateSubscriber>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, facebook::fboss::fsdb::FsdbStateSubscriber::FsdbSubUnitUpdateCb, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) fboss/fsdb/client/FsdbPubSubManager.cpp:240 (libfboss_fsdb_client_fsdb_pub_sub.so+0x139f75)
    #5 facebook::fboss::fsdb::FsdbPubSubManager::addStatePathSubscription(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, std::function<void (facebook::fboss::fsdb::OperState&&)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) fboss/fsdb/client/FsdbPubSubManager.cpp:190 (libfboss_fsdb_client_fsdb_pub_sub.so+0x139d50)
    #6 facebook::fboss::TestSubscription<thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > >::TestSubscription(facebook::fboss::fsdb::FsdbPubSubManager*, thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > >) fboss/qsfp_service/fsdb/facebook/test/QsfpFsdbSyncerTest.cpp:69 (fsdb-syncer-test+0x104e5d)
    #7 facebook::fboss::TestSubscription<thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > > facebook::fboss::QsfpFsdbTcvrMgrTest::subscribe<thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > >(thriftpath::ChildThriftPath<facebook::fboss::cfg::QsfpServiceConfig, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::QsfpServiceData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > >) fboss/qsfp_service/fsdb/facebook/test/QsfpFsdbSyncerTest.cpp:158 (fsdb-syncer-test+0xe3417)
    #8 facebook::fboss::QsfpFsdbTcvrMgrTest_testTcvrMgrConfigUpdate_Test::TestBody() fboss/qsfp_service/fsdb/facebook/test/QsfpFsdbSyncerTest.cpp:195 (fsdb-syncer-test+0xe2cd0)
    #9 testing::Test::Run() /home/engshare/third-party2/googletest/20201023/src/googletest/googletest/src/gtest.cc:2680:50 (libgtest.so.1.10.0+0x4d6a5)
    #10 testing::Test::Run() /home/engshare/third-party2/googletest/20201023/src/googletest/googletest/src/gtest.cc:2670:6 (libgtest.so.1.10.0+0x4d6a5)
    #11 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x218a)

  Mutex M118355245544776416 is already destroyed.

  Thread T7 'FsdbReconnectTh' (tid=2901715, running) created by main thread at:
    #0 pthread_create <null> (fsdb-syncer-test+0x1744ed)
    #1 __gthread_create /home/engshare/third-party2/libgcc/9.x/src/gcc-9.x/x86_64-facebook-linux/libstdc++-v3/include/x86_64-facebook-linux/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd993c)
    #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /home/engshare/third-party2/libgcc/9.x/src/gcc-9.x/x86_64-facebook-linux/libstdc++-v3/src/c++11/../../../.././libstdc++-v3/src/c++11/thread.cc:135:37 (libstdc++.so.6+0xd993c)
    #3 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::EventBase::Options, folly::EventBaseManager*, folly::Range<char const*>) folly/io/async/ScopedEventBaseThread.cpp:68 (libfolly_io_async_scoped_event_base_thread.so+0xc060)
    #4 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::EventBaseManager*, folly::Range<char const*>) folly/io/async/ScopedEventBaseThread.cpp:60 (libfolly_io_async_scoped_event_base_thread.so+0xb4b8)
    #5 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::Range<char const*>) folly/io/async/ScopedEventBaseThread.cpp:53 (libfolly_io_async_scoped_event_base_thread.so+0xb672)
    #6 facebook::fboss::fsdb::FsdbPubSubManager::FsdbPubSubManager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) fboss/fsdb/client/FsdbPubSubManager.h:139 (libfboss_fsdb_client_fsdb_pub_sub.so+0x1371f2)
    #7 std::_MakeUniq<facebook::fboss::fsdb::FsdbPubSubManager>::__single_object std::make_unique<facebook::fboss::fsdb::FsdbPubSubManager, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) third-party-buck/platform009/build/libgcc/include/c++/9.x/bits/unique_ptr.h:857 (libfboss_fsdb_client_fsdb_syncer.so+0x10247)
    #8 facebook::fboss::fsdb::FsdbSyncManager::FsdbSyncManager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) fboss/fsdb/client/FsdbSyncManager.cpp:12 (libfboss_fsdb_client_fsdb_syncer.so+0x100be)
    #9 facebook::fboss::QsfpFsdbSyncManager::QsfpFsdbSyncManager() fboss/qsfp_service/fsdb/QsfpFsdbSyncManager.cpp:17 (libfboss_qsfp_service_fsdb_fsdb-syncer.so+0x33191)
    #10 std::_MakeUniq<facebook::fboss::QsfpFsdbSyncManager>::__single_object std::make_unique<facebook::fboss::QsfpFsdbSyncManager>() third-party-buck/platform009/build/libgcc/include/c++/9.x/bits/unique_ptr.h:857 (libfboss_qsfp_service_platforms_wedge_wedge-platform.so+0x1ec45f)
    #11 facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode) fboss/qsfp_service/platforms/wedge/WedgeManager.cpp:63 (libfboss_qsfp_service_platforms_wedge_wedge-platform.so+0x1ebcab)
    #12 facebook::fboss::MockWedgeManager::MockWedgeManager(int, int) fboss/qsfp_service/platforms/wedge/tests/MockWedgeManager.h:25 (libfboss_qsfp_service_test_transceiver_manager_test_helper.so+0x5408f)
    #13 std::_MakeUniq<facebook::fboss::MockWedgeManager>::__single_object std::make_unique<facebook::fboss::MockWedgeManager, int const&>(int const&) third-party-buck/platform009/build/libgcc/include/c++/9.x/bits/unique_ptr.h:857 (libfboss_qsfp_service_test_transceiver_manager_test_helper.so+0x42edb)
    #14 facebook::fboss::TransceiverManagerTestHelper::resetTransceiverManager() fboss/qsfp_service/test/TransceiverManagerTestHelper.cpp:35 (libfboss_qsfp_service_test_transceiver_manager_test_helper.so+0x43138)
    #15 facebook::fboss::QsfpFsdbTcvrMgrTest_testTcvrMgrConfigUpdate_Test::TestBody() fboss/qsfp_service/fsdb/facebook/test/QsfpFsdbSyncerTest.cpp:191 (fsdb-syncer-test+0xe2c53)
    #16 testing::Test::Run() /home/engshare/third-party2/googletest/20201023/src/googletest/googletest/src/gtest.cc:2680:50 (libgtest.so.1.10.0+0x4d6a5)
    #17 testing::Test::Run() /home/engshare/third-party2/googletest/20201023/src/googletest/googletest/src/gtest.cc:2670:6 (libgtest.so.1.10.0+0x4d6a5)
    #18 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x218a)

ThreadSanitizer: data race on vptr (ctor/dtor vs virtual call) folly/io/async/AsyncTimeout.cpp:174 in folly::AsyncTimeout::libeventCallback(int, short, void*)
==================
```

What's going on here?

In FsdbStreamClient constructor, we immediately schedule the periodic reconnect on the reconnect thread. The periodic call back is implemented in folly::AsyncTimeout like this:
```
  auto timeout = reinterpret_cast<AsyncTimeout*>(arg);
...
  timeout->timeoutExpired();
```
We're arg being passed in as a void*. timeoutExpired() is a virtual function we overrided.

If this gets called after the base class constructor FsdbStreamClient has finished but before child constructor classes like FsdbDeltaSubscriber has started, the vtable will point at the base class so virtual method calls have incorrect behavior.

See https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces#data-race-on-vptr-during-construction

IMHO, this is probably benign. Because the wrong vtable doesn't actually trigger wrong behavior if nobody override timeoutExpired() in child classes or call virtual methods from the base class implementation. But let's fix this to shut up the warning and prevent future problems.

FsdbStreamClient is not an AsyncTimeout. It needed an AsyncTimeout. So making it a member instead of a parent is probably a better fit. That avoids this hard problem altogether. So we don't need to add start() and stop() from everywhere.

Reviewed By: jasmeetbagga

Differential Revision: D37692128

fbshipit-source-id: fadf86ff7850d37cae49c651cca29c1d2b819b2b
facebook-github-bot pushed a commit that referenced this pull request Aug 16, 2022
…members

Summary:
```
❯ buck test mode/dev-tsan //fboss/facebook/mka_service/mka_module/tests:MKAModuleTest -- --stress-runs 100 --regex MKAModuleTest.WarmBootConfigLoad
...
Summary
  Pass: 78
  Fail: 1
    ✗ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
  Fatal: 21
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ☢ fboss/facebook/mka_service/mka_module/tests:MKAModuleTest - MKAModuleTest.WarmBootConfigLoad
    ...and 11 more not shown...
```
Problem 1:
```
ThreadSanitizer: data race third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/basic_string.h:926 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::length() const
==================
==================
WARNING: ThreadSanitizer: data race (pid=1286130)
  Read of size 8 at 0x7b84000a3548 by thread T50 (mutexes: write M341564816177216360, read M730281896454009712):
    #0 memcmp <null> (MKAModuleTest+0x26ebb7)
    #1 std::char_traits<char>::compare(char const*, char const*, unsigned long) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/char_traits.h:361 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x8931c)
    #2 __gnu_cxx::__enable_if<__is_char<char>::__value, bool>::__type std::operator==<char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/basic_string.h:6236 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x89286)
    #3 std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/stl_function.h:356 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x89141)
    #4 std::__detail::_Hashtable_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo>, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >::_M_equals(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::__detail::_Hash_node_value<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo>, true> const&) const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/hashtable_policy.h:1616 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x88f93)
    #5 std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_before_node(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long) const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/hashtable.h:1821 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x88a98)
    #6 std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_node(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long) const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/hashtable.h:795 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x89ed5)
    #7 std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::find(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/hashtable.h:1591 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x8d553)
    #8 std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, facebook::fboss::PacketStreamService::ClientInfo, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo> > >::find(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unordered_map.h:880 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x8cf85)
    #9 auto facebook::fboss::PacketStreamService::send(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, facebook::fboss::TPacket&&)::$_3::operator()<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, facebook::fboss::PacketStreamService::ClientInfo, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo> > > const>(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, facebook::fboss::PacketStreamService::ClientInfo, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo> > > const&) const fboss/agent/thrift_packet_stream/PacketStreamService.cpp:71 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x8c334)
    #10 auto folly::SynchronizedBase<folly::Synchronized<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, facebook::fboss::PacketStreamService::ClientInfo, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, facebook::fboss::PacketStreamService::ClientInfo> > >, folly::SharedMutexImpl<false, void, std::atomic, folly::SharedMutexPolicyDefault> >, (folly::detail::SynchronizedMutexLevel)2>::withRLock<facebook::fboss::PacketStreamService::send(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, facebook::fboss::TPacket&&)::$_3>(facebook::fboss::PacketStreamService::send(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, facebook::fboss::TPacket&&)::$_3&&) const folly/Synchronized.h:342 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x8c254)
    #11 facebook::fboss::PacketStreamService::send(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, facebook::fboss::TPacket&&) fboss/agent/thrift_packet_stream/PacketStreamService.cpp:70 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x8c1cb)
    #12 facebook::fboss::BidirectionalPacketStream::send(facebook::fboss::TPacket&&) fboss/agent/thrift_packet_stream/BidirectionalPacketStream.cpp:265 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0xb92b0)
    #13 facebook::fboss::AsyncThriftPacketTransport::send(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> > const&) fboss/agent/thrift_packet_stream/AsyncThriftPacketTransport.cpp:19 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0x6e131)
    #14 auto facebook::fboss::mka::MKASession::timeoutExpired(folly::Synchronized<std::unique_ptr<facebook::fboss::mka::MKAParticipant, std::default_delete<facebook::fboss::mka::MKAParticipant> >, folly::SharedMutexImpl<false, void, std::atomic, folly::SharedMutexPolicyDefault> >&)::$_8::operator()<std::unique_ptr<facebook::fboss::mka::MKAParticipant, std::default_delete<facebook::fboss::mka::MKAParticipant> > >(std::unique_ptr<facebook::fboss::mka::MKAParticipant, std::default_delete<facebook::fboss::mka::MKAParticipant> >&) const fboss/facebook/mka_service/mka_module/MKASession.cpp:627 (libfboss_facebook_mka_service_mka_module_mka_module.so+0x15e1c3)
    #15 auto folly::SynchronizedBase<folly::Synchronized<std::unique_ptr<facebook::fboss::mka::MKAParticipant, std::default_delete<facebook::fboss::mka::MKAParticipant> >, folly::SharedMutexImpl<false, void, std::atomic, folly::SharedMutexPolicyDefault> >, (folly::detail::SynchronizedMutexLevel)2>::withWLock<facebook::fboss::mka::MKASession::timeoutExpired(folly::Synchronized<std::unique_ptr<facebook::fboss::mka::MKAParticipant, std::default_delete<facebook::fboss::mka::MKAParticipant> >, folly::SharedMutexImpl<false, void, std::atomic, folly::SharedMutexPolicyDefault> >&)::$_8>(facebook::fboss::mka::MKASession::timeoutExpired(folly::Synchronized<std::unique_ptr<facebook::fboss::mka::MKAParticipant, std::default_delete<facebook::fboss::mka::MKAParticipant> >, folly::SharedMutexImpl<false, void, std::atomic, folly::SharedMutexPolicyDefault> >&)::$_8&&) folly/Synchronized.h:305 (libfboss_facebook_mka_service_mka_module_mka_module.so+0x11c014)
    #16 facebook::fboss::mka::MKASession::timeoutExpired(folly::Synchronized<std::unique_ptr<facebook::fboss::mka::MKAParticipant, std::default_delete<facebook::fboss::mka::MKAParticipant> >, folly::SharedMutexImpl<false, void, std::atomic, folly::SharedMutexPolicyDefault> >&) fboss/facebook/mka_service/mka_module/MKASession.cpp:619 (libfboss_facebook_mka_service_mka_module_mka_module.so+0x11bf1a)
    #17 facebook::fboss::mka::MKASession::timeoutExpired() fboss/facebook/mka_service/mka_module/MKASession.cpp:659 (libfboss_facebook_mka_service_mka_module_mka_module.so+0x11c219)
    #18 facebook::fboss::mka::MKASession::MKASession(facebook::fboss::mka::MKASessionConfig const&, folly::EventBase*, std::unique_ptr<facebook::fboss::AsyncPacketTransport::ReadCallback, std::default_delete<facebook::fboss::AsyncPacketTransport::ReadCallback> >, std::shared_ptr<facebook::fboss::AsyncPacketTransport>, std::shared_ptr<facebook::fboss::mka::MacsecHandler>, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>)::$_37::operator()() const fboss/facebook/mka_service/mka_module/MKASession.cpp:133 (libfboss_facebook_mka_service_mka_module_mka_module.so+0x131375)
    #19 folly::detail::async_timeout_wrapper<facebook::fboss::mka::MKASession::MKASession(facebook::fboss::mka::MKASessionConfig const&, folly::EventBase*, std::unique_ptr<facebook::fboss::AsyncPacketTransport::ReadCallback, std::default_delete<facebook::fboss::AsyncPacketTransport::ReadCallback> >, std::shared_ptr<facebook::fboss::AsyncPacketTransport>, std::shared_ptr<facebook::fboss::mka::MacsecHandler>, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>)::$_37>::timeoutExpired() folly/io/async/AsyncTimeout.h:255 (libfboss_facebook_mka_service_mka_module_mka_module.so+0x13132c)
    #20 folly::AsyncTimeout::libeventCallback(int, short, void*) folly/io/async/AsyncTimeout.cpp:174 (libfolly_io_async_async_base.so+0x41e6b)
    #21 event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390:5 (libevent-1.4.so.2+0x8608)
    #22 event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532:4 (libevent-1.4.so.2+0x8608)
    #23 folly::EventBase::loopMain(int, bool) folly/io/async/EventBase.cpp:400 (libfolly_io_async_async_base.so+0x49c47)
    #24 folly::EventBase::loopBody(int, bool) folly/io/async/EventBase.cpp:326 (libfolly_io_async_async_base.so+0x4940f)
    #25 folly::EventBase::loop() folly/io/async/EventBase.cpp:305 (libfolly_io_async_async_base.so+0x49298)
    #26 folly::EventBase::loopForever() folly/io/async/EventBase.cpp:545 (libfolly_io_async_async_base.so+0x5c7bf)
    #27 folly::IOThreadPoolExecutor::threadRun(std::shared_ptr<folly::ThreadPoolExecutor::Thread>) folly/executors/IOThreadPoolExecutor.cpp:250 (libfolly_executors_io_thread_pool_executor.so+0x15b72)
    #28 void std::__invoke_impl<void, void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&>(std::__invoke_memfun_deref, void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:74 (libfolly_executors_thread_pool_executor.so+0x56191)
    #29 std::__invoke_result<void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&>::type std::__invoke<void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&>(void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:96 (libfolly_executors_thread_pool_executor.so+0x55f07)
    #30 void std::_Bind<void (folly::ThreadPoolExecutor::* (folly::ThreadPoolExecutor*, std::shared_ptr<folly::ThreadPoolExecutor::Thread>))(std::shared_ptr<folly::ThreadPoolExecutor::Thread>)>::__call<void, 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/functional:420 (libfolly_executors_thread_pool_executor.so+0x55e6a)
    #31 void std::_Bind<void (folly::ThreadPoolExecutor::* (folly::ThreadPoolExecutor*, std::shared_ptr<folly::ThreadPoolExecutor::Thread>))(std::shared_ptr<folly::ThreadPoolExecutor::Thread>)>::operator()<void>() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/functional:503 (libfolly_executors_thread_pool_executor.so+0x55dc6)
    #32 void folly::detail::function::FunctionTraits<void ()>::callSmall<std::_Bind<void (folly::ThreadPoolExecutor::* (folly::ThreadPoolExecutor*, std::shared_ptr<folly::ThreadPoolExecutor::Thread>))(std::shared_ptr<folly::ThreadPoolExecutor::Thread>)> >(folly::detail::function::Data&) folly/Function.h:363 (libfolly_executors_thread_pool_executor.so+0x55a5d)
    #33 folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:392 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xad423)
    #34 folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()::operator()() folly/executors/thread_factory/NamedThreadFactory.h:40 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xad3bc)
    #35 void std::__invoke_impl<void, folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()>(std::__invoke_other, folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:61 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xad34d)
    #36 std::__invoke_result<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()>::type std::__invoke<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()>(folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:96 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xad29d)
    #37 void std::thread::_Invoker<std::tuple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:253 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xad245)
    #38 std::thread::_Invoker<std::tuple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()> >::operator()() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:260 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xad1e5)
    #39 std::thread::_State_impl<std::thread::_Invoker<std::tuple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()> > >::_M_run() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:211 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xacf79)
    #40 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)

  Previous write of size 8 at 0x7b84000a3548 by thread T44:
    #0 memcpy <null> (MKAModuleTest+0x26d4b6)
    #1 std::char_traits<char>::copy(char*, char const*, unsigned long) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/char_traits.h:409 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0x70881)
    #2 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy(char*, char const*, unsigned long) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/basic_string.h:359 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0x703d2)
    #3 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/basic_string.tcc:272 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0x6ff46)
    #4 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/basic_string.h:1386 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0x6fe19)
    #5 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/basic_string.h:680 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0x6e7b5)
    #6 facebook::fboss::BidirectionalPacketStream::clientConnected(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) fboss/agent/thrift_packet_stream/BidirectionalPacketStream.cpp:280 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0x77e3a)
    #7 facebook::fboss::PacketStreamService::connect(std::unique_ptr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) fboss/agent/thrift_packet_stream/PacketStreamService.cpp:59 (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x5aab9)
    #8 virtual thunk to facebook::fboss::PacketStreamService::connect(std::unique_ptr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) fboss/agent/thrift_packet_stream/PacketStreamService.cpp (libfboss_agent_thrift_packet_stream_packet_stream_server.so+0x5bf5d)
    #9 apache::thrift::ServiceHandler<facebook::fboss::PacketStream>::semifuture_connect(std::unique_ptr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) buck-out/dev/gen/aab7ed39/fboss/agent/if/packet_stream-cpp2-packet_stream.thrift/gen-cpp2/PacketStream.cpp:35 (libfboss_agent_if_packet_stream-cpp2-services.so+0x91d45)
    #10 apache::thrift::ServiceHandler<facebook::fboss::PacketStream>::future_connect(std::unique_ptr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) buck-out/dev/gen/aab7ed39/fboss/agent/if/packet_stream-cpp2-packet_stream.thrift/gen-cpp2/PacketStream.cpp:41 (libfboss_agent_if_packet_stream-cpp2-services.so+0x91b8e)
    #11 apache::thrift::ServiceHandler<facebook::fboss::PacketStream>::async_tm_connect(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<facebook::fboss::TPacket> >, std::default_delete<apache::thrift::HandlerCallback<apache::thrift::ServerStream<facebook::fboss::TPacket> > > >, std::unique_ptr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) buck-out/dev/gen/aab7ed39/fboss/agent/if/packet_stream-cpp2-packet_stream.thrift/gen-cpp2/PacketStream.cpp:60 (libfboss_agent_if_packet_stream-cpp2-services.so+0x8cc76)
    #12 void facebook::fboss::PacketStreamAsyncProcessor::executeRequest_connect<apache::thrift::CompactProtocolReader, apache::thrift::CompactProtocolWriter>(apache::thrift::ServerRequest&&) buck-out/dev/gen/aab7ed39/fboss/agent/if/packet_stream-cpp2-packet_stream.thrift/gen-cpp2/PacketStream.tcc:71 (libfboss_agent_if_packet_stream-cpp2-services.so+0xbdf18)
    #13 void apache::thrift::detail::ap::execute<facebook::fboss::PacketStreamAsyncProcessor>(facebook::fboss::PacketStreamAsyncProcessor*, apache::thrift::ServerRequest&&, apache::thrift::protocol::PROTOCOL_TYPES, apache::thrift::AsyncProcessorFactory::MethodMetadata const&) thrift/lib/cpp2/GeneratedCodeHelper.h:1235 (libfboss_agent_if_packet_stream-cpp2-services.so+0xba361)
    #14 facebook::fboss::PacketStreamAsyncProcessor::executeRequest(apache::thrift::ServerRequest&&, apache::thrift::AsyncProcessorFactory::MethodMetadata const&) buck-out/dev/gen/aab7ed39/fboss/agent/if/packet_stream-cpp2-packet_stream.thrift/gen-cpp2/PacketStream.cpp:295 (libfboss_agent_if_packet_stream-cpp2-services.so+0x9081c)
    #15 apache::thrift::(anonymous namespace)::MultiplexAsyncProcessor::executeRequest(apache::thrift::ServerRequest&&, apache::thrift::AsyncProcessorFactory::MethodMetadata const&) thrift/lib/cpp2/async/MultiplexAsyncProcessor.cpp:332 (libthrift_lib_cpp2_async_multiplex_async_processor.so+0x7f3df)
    #16 apache::thrift::detail::ap::processViaExecuteRequest(apache::thrift::AsyncProcessor*, std::unique_ptr<apache::thrift::ResponseChannelRequest, apache::thrift::RequestsRegistry::Deleter>, apache::thrift::SerializedCompressedRequest&&, apache::thrift::AsyncProcessorFactory::MethodMetadata const&, apache::thrift::protocol::PROTOCOL_TYPES, apache::thrift::Cpp2RequestContext*, apache::thrift::concurrency::ThreadManager*)::'lambda'(bool)::operator()(bool) thrift/lib/cpp2/GeneratedCodeHelper.h:1023 (libthrift_lib_cpp2_server.so+0x385b76)
    #17 apache::thrift::detail::ap::processViaExecuteRequest(apache::thrift::AsyncProcessor*, std::unique_ptr<apache::thrift::ResponseChannelRequest, apache::thrift::RequestsRegistry::Deleter>, apache::thrift::SerializedCompressedRequest&&, apache::thrift::AsyncProcessorFactory::MethodMetadata const&, apache::thrift::protocol::PROTOCOL_TYPES, apache::thrift::Cpp2RequestContext*, apache::thrift::concurrency::ThreadManager*)::'lambda'()::operator()() thrift/lib/cpp2/GeneratedCodeHelper.h:1032 (libthrift_lib_cpp2_server.so+0x385ed7)
    #18 void folly::detail::function::FunctionTraits<void ()>::callBig<apache::thrift::detail::ap::processViaExecuteRequest(apache::thrift::AsyncProcessor*, std::unique_ptr<apache::thrift::ResponseChannelRequest, apache::thrift::RequestsRegistry::Deleter>, apache::thrift::SerializedCompressedRequest&&, apache::thrift::AsyncProcessorFactory::MethodMetadata const&, apache::thrift::protocol::PROTOCOL_TYPES, apache::thrift::Cpp2RequestContext*, apache::thrift::concurrency::ThreadManager*)::'lambda'()>(folly::detail::function::Data&) folly/Function.h:377 (libthrift_lib_cpp2_server.so+0x385d7d)
    #19 folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:392 (libthrift_lib_cpp_concurrency_thread_manager.so+0x985b3)
    #20 apache::thrift::concurrency::FunctionRunner::run() thrift/lib/cpp/concurrency/FunctionRunner.h:138 (libthrift_lib_cpp_concurrency_thread_manager.so+0x97f1a)
    #21 virtual thunk to apache::thrift::concurrency::FunctionRunner::run() thrift/lib/cpp/concurrency/FunctionRunner.h (libthrift_lib_cpp_concurrency_thread_manager.so+0x98131)
    #22 apache::thrift::concurrency::ThreadManager::Task::run()::'lambda'()::operator()() const thrift/lib/cpp/concurrency/ThreadManager.cpp:178 (libthrift_lib_cpp_concurrency_thread_manager.so+0xb73d9)
    #23 apache::thrift::concurrency::ThreadManager::Task::run() folly/lang/Exception.h:285 (libthrift_lib_cpp_concurrency_thread_manager.so+0xb6a85)
    #24 apache::thrift::concurrency::ThreadManager::Impl::Worker::run() thrift/lib/cpp/concurrency/ThreadManager.cpp:653 (libthrift_lib_cpp_concurrency_thread_manager.so+0xb63b8)
    #25 apache::thrift::concurrency::PthreadThread::threadMain(void*) thrift/lib/cpp/concurrency/PosixThreadFactory.cpp:210 (libthrift_lib_cpp_concurrency_posix_thread_factory.so+0xacd7)

  Location is heap block of size 4736 at 0x7b84000a2800 allocated by main thread:
    #0 operator new(unsigned long, std::align_val_t) <null> (MKAModuleTest+0x202b2b)
    #1 __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/ext/new_allocator.h:125 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xb1046)
    #2 std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/allocator.h:197 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xb0f09)
    #3 std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> >&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/allocated_ptr.h:97 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xb0b1e)
    #4 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(facebook::fboss::BidirectionalPacketStream*&, std::_Sp_alloc_shared_tag<std::allocator<facebook::fboss::BidirectionalPacketStream> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:704 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xb082c)
    #5 std::__shared_ptr<facebook::fboss::BidirectionalPacketStream, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<facebook::fboss::BidirectionalPacketStream>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(std::_Sp_alloc_shared_tag<std::allocator<facebook::fboss::BidirectionalPacketStream> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1398 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xb073f)
    #6 std::shared_ptr<facebook::fboss::BidirectionalPacketStream>::shared_ptr<std::allocator<facebook::fboss::BidirectionalPacketStream>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(std::_Sp_alloc_shared_tag<std::allocator<facebook::fboss::BidirectionalPacketStream> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr.h:409 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xb0617)
    #7 std::shared_ptr<facebook::fboss::BidirectionalPacketStream> std::allocate_shared<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(std::allocator<facebook::fboss::BidirectionalPacketStream> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr.h:862 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xb0496)
    #8 std::shared_ptr<facebook::fboss::BidirectionalPacketStream> std::make_shared<facebook::fboss::BidirectionalPacketStream, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr.h:878 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa7095)
    #9 facebook::fboss::mka::MKAModule::MKAModule(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, unsigned short, unsigned short, unsigned short, bool) fboss/facebook/mka_service/mka_module/MKAModule.cpp:149 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa5f5a)
    #10 std::_MakeUniq<facebook::fboss::mka::MKAModule>::__single_object std::make_unique<facebook::fboss::mka::MKAModule, bool, char const (&) [12], double const&, unsigned short&, unsigned short, unsigned short, bool&>(bool&&, char const (&) [12], double const&, unsigned short&, unsigned short&&, unsigned short&&, bool&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962 (MKAModuleTest+0x1dd436)
    #11 MKAModuleTest::startMKAModule(bool) fboss/facebook/mka_service/mka_module/tests/MKAModuleTest.cpp:149 (MKAModuleTest+0x1bc348)
    #12 MKAModuleTest_WarmBootConfigLoad_Test::TestBody() fboss/facebook/mka_service/mka_module/tests/MKAModuleTest.cpp:466 (MKAModuleTest+0x15e1c7)
    #13 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2682:50 (libgtest.so.1.11.0+0x50f35)
    #14 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2672:6 (libgtest.so.1.11.0+0x50f35)
    #15 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x2161)

  Mutex M341564816177216360 is already destroyed.

  Mutex M730281896454009712 is already destroyed.

  Thread T50 'MkaIOWorker0' (tid=1291160, running) created by main thread at:
    #0 pthread_create <null> (MKAModuleTest+0x26952d)
    #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xdf5ee)
    #2 folly::NamedThreadFactory::newThread(folly::Function<void ()>&&) folly/executors/thread_factory/NamedThreadFactory.h:37 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xaab23)
    #3 folly::ThreadPoolExecutor::addThreads(unsigned long) folly/executors/ThreadPoolExecutor.cpp:218 (libfolly_executors_thread_pool_executor.so+0x1ed65)
    #4 folly::ThreadPoolExecutor::ensureActiveThreads() folly/executors/ThreadPoolExecutor.cpp:502 (libfolly_executors_thread_pool_executor.so+0x217ab)
    #5 folly::IOThreadPoolExecutor::getEventBase() folly/executors/IOThreadPoolExecutor.cpp:173 (libfolly_executors_io_thread_pool_executor.so+0x163dc)
    #6 facebook::fboss::mka::MKAModule::MKAModule(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, unsigned short, unsigned short, unsigned short, bool) fboss/facebook/mka_service/mka_module/MKAModule.cpp:152 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa5f05)
    #7 std::_MakeUniq<facebook::fboss::mka::MKAModule>::__single_object std::make_unique<facebook::fboss::mka::MKAModule, bool, char const (&) [12], double const&, unsigned short&, unsigned short, unsigned short, bool&>(bool&&, char const (&) [12], double const&, unsigned short&, unsigned short&&, unsigned short&&, bool&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962 (MKAModuleTest+0x1dd436)
    #8 MKAModuleTest::startMKAModule(bool) fboss/facebook/mka_service/mka_module/tests/MKAModuleTest.cpp:149 (MKAModuleTest+0x1bc348)
    #9 MKAModuleTest_WarmBootConfigLoad_Test::TestBody() fboss/facebook/mka_service/mka_module/tests/MKAModuleTest.cpp:466 (MKAModuleTest+0x15e1c7)
    #10 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2682:50 (libgtest.so.1.11.0+0x50f35)
    #11 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2672:6 (libgtest.so.1.11.0+0x50f35)
    #12 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x2161)

  Thread T44 (tid=1291175, running) created by thread T45 at:
    #0 pthread_create <null> (MKAModuleTest+0x26952d)
    #1 apache::thrift::concurrency::PthreadThread::start() thrift/lib/cpp/concurrency/PosixThreadFactory.cpp:110 (libthrift_lib_cpp_concurrency_posix_thread_factory.so+0xbf92)
    #2 apache::thrift::concurrency::ThreadManager::Impl::addWorker(unsigned long) thrift/lib/cpp/concurrency/ThreadManager.cpp:679 (libthrift_lib_cpp_concurrency_thread_manager.so+0x62028)
    #3 apache::thrift::concurrency::(anonymous namespace)::SimpleThreadManagerImpl::start() thrift/lib/cpp/concurrency/ThreadManager.cpp:446 (libthrift_lib_cpp_concurrency_thread_manager.so+0x776c4)
    #4 apache::thrift::ThriftServer::setupThreadManager() thrift/lib/cpp2/server/ThriftServer.cpp:725 (libthrift_lib_cpp2_server.so+0x42a776)
    #5 apache::thrift::ThriftServer::setup() thrift/lib/cpp2/server/ThriftServer.cpp:471 (libthrift_lib_cpp2_server.so+0x4270ba)
    #6 apache::thrift::ThriftServer::serve() thrift/lib/cpp2/server/ThriftServer.cpp:1079 (libthrift_lib_cpp2_server.so+0x43be58)
    #7 apache::thrift::util::ScopedServerThread::Helper::run() thrift/lib/cpp2/util/ScopedServerThread.cpp:186 (libthrift_lib_cpp2_util_scoped_server_thread.so+0x118f9)
    #8 apache::thrift::concurrency::PthreadThread::threadMain(void*) thrift/lib/cpp/concurrency/PosixThreadFactory.cpp:210 (libthrift_lib_cpp_concurrency_posix_thread_factory.so+0xacd7)
```

In BidirectionalPacketStream::send(), we check clientConnected_. Then use connectedClientId_ to send. In BidirectionalPacketStream::clientConnected(), we immediately set clientConnected_ to true. Then store connectedClientId_.  So it's possible for connectedClientId_ to be half baked when send() is using it.

Setting clientConnected_ after connectedClientId_ will make sure we exit send() instead of using half baked members.

Problem 2:
```
==================
WARNING: ThreadSanitizer: data race (pid=1423249)
  Write of size 8 at 0x7b840000bfc0 by thread T44:
    #0 std::__uniq_ptr_impl<apache::thrift::Client<facebook::fboss::PacketStream>, std::default_delete<apache::thrift::Client<facebook::fboss::PacketStream> > >::reset(apache::thrift::Client<facebook::fboss::PacketStream>*) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:180 (libfboss_agent_thrift_packet_stream_packet_stream_client.so+0x70cc9)
    #1 std::unique_ptr<apache::thrift::Client<facebook::fboss::PacketStream>, std::default_delete<apache::thrift::Client<facebook::fboss::PacketStream> > >::reset(apache::thrift::Client<facebook::fboss::PacketStream>*) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:456 (libfboss_agent_thrift_packet_stream_packet_stream_client.so+0x8677e)
    #2 facebook::fboss::PacketStreamClient::cancel()::$_5::operator()() const fboss/agent/thrift_packet_stream/PacketStreamClient.cpp:156 (libfboss_agent_thrift_packet_stream_packet_stream_client.so+0x8670d)
    #3 void folly::detail::function::FunctionTraits<void ()>::callSmall<facebook::fboss::PacketStreamClient::cancel()::$_5>(folly::detail::function::Data&) folly/Function.h:363 (libfboss_agent_thrift_packet_stream_packet_stream_client.so+0x866bd)
    #4 folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:392 (libfolly_io_async_async_base.so+0x4c4c3)
    #5 folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_4::operator()() folly/io/async/EventBase.cpp:681 (libfolly_io_async_async_base.so+0x72f02)
    #6 void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_4>(folly::detail::function::Data&) folly/Function.h:377 (libfolly_io_async_async_base.so+0x72d5d)
    #7 folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:392 (libfolly_io_async_async_base.so+0x4c4c3)
    #8 folly::EventBase::FuncRunner::operator()(folly::Function<void ()>) folly/io/async/EventBase.cpp:124 (libfolly_io_async_async_base.so+0x6ecd9)
    #9 folly::AtomicNotificationQueueTaskStatus folly::detail::invokeConsumerWithTask<folly::Function<void ()>, folly::EventBase::FuncRunner&, void, void, void>(folly::EventBase::FuncRunner&, folly::Function<void ()>&&, std::shared_ptr<folly::RequestContext>&&) folly/io/async/AtomicNotificationQueue-inl.h:281 (libfolly_io_async_async_base.so+0x6e45a)
    #10 bool folly::AtomicNotificationQueue<folly::Function<void ()> >::drive<folly::EventBase::FuncRunner&>(folly::EventBase::FuncRunner&) folly/io/async/AtomicNotificationQueue-inl.h:339 (libfolly_io_async_async_base.so+0x6e066)
    #11 bool folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::drive<folly::EventBase::FuncRunner&>(folly::EventBase::FuncRunner&) folly/io/async/EventBaseAtomicNotificationQueue-inl.h:250 (libfolly_io_async_async_base.so+0x6d9cf)
    #12 folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::execute() folly/io/async/EventBaseAtomicNotificationQueue-inl.h:269 (libfolly_io_async_async_base.so+0x4c747)
    #13 folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::handlerReady(unsigned short) folly/io/async/EventBaseAtomicNotificationQueue-inl.h:261 (libfolly_io_async_async_base.so+0x78194)
    #14 non-virtual thunk to folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::handlerReady(unsigned short) folly/io/async/EventBaseAtomicNotificationQueue.h (libfolly_io_async_async_base.so+0x7826c)
    #15 folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:159 (libfolly_io_async_async_base.so+0x84b78)
    #16 event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390:5 (libevent-1.4.so.2+0x8608)
    #17 event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532:4 (libevent-1.4.so.2+0x8608)
    #18 folly::EventBase::loopMain(int, bool) folly/io/async/EventBase.cpp:400 (libfolly_io_async_async_base.so+0x49c47)
    #19 folly::EventBase::loopBody(int, bool) folly/io/async/EventBase.cpp:326 (libfolly_io_async_async_base.so+0x4940f)
    #20 folly::EventBase::loop() folly/io/async/EventBase.cpp:305 (libfolly_io_async_async_base.so+0x49298)
    #21 folly::EventBase::loopForever() folly/io/async/EventBase.cpp:545 (libfolly_io_async_async_base.so+0x5c7bf)
    #22 folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40 (libfolly_io_async_scoped_event_base_thread.so+0x8b78)
    #23 void std::__invoke_impl<void, void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >(std::__invoke_other, void (*&&)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*&&, folly::EventBase*&&, folly::Baton<true, std::atomic>*&&, folly::Range<char const*>&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:61 (libfolly_io_async_scoped_event_base_thread.so+0x101e0)
    #24 std::__invoke_result<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >::type std::__invoke<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >(void (*&&)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*&&, folly::EventBase*&&, folly::Baton<true, std::atomic>*&&, folly::Range<char const*>&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:96 (libfolly_io_async_scoped_event_base_thread.so+0xff14)
    #25 void std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:253 (libfolly_io_async_scoped_event_base_thread.so+0xfe4d)
    #26 std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > >::operator()() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:260 (libfolly_io_async_scoped_event_base_thread.so+0xfd85)
    #27 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > > >::_M_run() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:211 (libfolly_io_async_scoped_event_base_thread.so+0xf759)
    #28 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)

  Previous read of size 8 at 0x7b840000bfc0 by thread T43:
    #0 std::__uniq_ptr_impl<apache::thrift::Client<facebook::fboss::PacketStream>, std::default_delete<apache::thrift::Client<facebook::fboss::PacketStream> > >::_M_ptr() const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:173 (libfboss_agent_thrift_packet_stream_packet_stream_client.so+0x6e211)
    #1 std::unique_ptr<apache::thrift::Client<facebook::fboss::PacketStream>, std::default_delete<apache::thrift::Client<facebook::fboss::PacketStream> > >::get() const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:422 (libfboss_agent_thrift_packet_stream_packet_stream_client.so+0x6e1b5)
    #2 std::unique_ptr<apache::thrift::Client<facebook::fboss::PacketStream>, std::default_delete<apache::thrift::Client<facebook::fboss::PacketStream> > >::operator bool() const third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:436 (libfboss_agent_thrift_packet_stream_packet_stream_client.so+0x33fb5)
    #3 facebook::fboss::PacketStreamClient::isConnectedToServer() fboss/agent/thrift_packet_stream/PacketStreamClient.cpp:29 (libfboss_agent_thrift_packet_stream_packet_stream_client.so+0x33e41)
    #4 facebook::fboss::BidirectionalPacketStream::close(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) fboss/agent/thrift_packet_stream/BidirectionalPacketStream.cpp:208 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0xb5378)
    #5 facebook::fboss::AsyncThriftPacketTransport::close() fboss/agent/thrift_packet_stream/AsyncThriftPacketTransport.cpp:27 (libfboss_agent_thrift_packet_stream_bidirectional_packet_stream.so+0x6e543)
    #6 facebook::fboss::mka::MKASession::stop()::$_0::operator()() const fboss/facebook/mka_service/mka_module/MKASession.cpp:149 (libfboss_facebook_mka_service_mka_module_mka_module.so+0x157127)
    #7 void folly::detail::function::FunctionTraits<void ()>::callSmall<facebook::fboss::mka::MKASession::stop()::$_0>(folly::detail::function::Data&) folly/Function.h:363 (libfboss_facebook_mka_service_mka_module_mka_module.so+0x15704d)
    #8 folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:392 (libfolly_io_async_async_base.so+0x4c4c3)
    #9 folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_4::operator()() folly/io/async/EventBase.cpp:681 (libfolly_io_async_async_base.so+0x72f02)
    #10 void folly::detail::function::FunctionTraits<void ()>::callBig<folly::EventBase::runInEventBaseThreadAndWait(folly::Function<void ()>)::$_4>(folly::detail::function::Data&) folly/Function.h:377 (libfolly_io_async_async_base.so+0x72d5d)
    #11 folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:392 (libfolly_io_async_async_base.so+0x4c4c3)
    #12 folly::EventBase::FuncRunner::operator()(folly::Function<void ()>) folly/io/async/EventBase.cpp:124 (libfolly_io_async_async_base.so+0x6ecd9)
    #13 folly::AtomicNotificationQueueTaskStatus folly::detail::invokeConsumerWithTask<folly::Function<void ()>, folly::EventBase::FuncRunner&, void, void, void>(folly::EventBase::FuncRunner&, folly::Function<void ()>&&, std::shared_ptr<folly::RequestContext>&&) folly/io/async/AtomicNotificationQueue-inl.h:281 (libfolly_io_async_async_base.so+0x6e45a)
    #14 bool folly::AtomicNotificationQueue<folly::Function<void ()> >::drive<folly::EventBase::FuncRunner&>(folly::EventBase::FuncRunner&) folly/io/async/AtomicNotificationQueue-inl.h:339 (libfolly_io_async_async_base.so+0x6e066)
    #15 bool folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::drive<folly::EventBase::FuncRunner&>(folly::EventBase::FuncRunner&) folly/io/async/EventBaseAtomicNotificationQueue-inl.h:250 (libfolly_io_async_async_base.so+0x6d9cf)
    #16 folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::execute() folly/io/async/EventBaseAtomicNotificationQueue-inl.h:269 (libfolly_io_async_async_base.so+0x4c747)
    #17 folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::handlerReady(unsigned short) folly/io/async/EventBaseAtomicNotificationQueue-inl.h:261 (libfolly_io_async_async_base.so+0x78194)
    #18 non-virtual thunk to folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::handlerReady(unsigned short) folly/io/async/EventBaseAtomicNotificationQueue.h (libfolly_io_async_async_base.so+0x7826c)
    #19 folly::EventHandler::libeventCallback(int, short, void*) folly/io/async/EventHandler.cpp:159 (libfolly_io_async_async_base.so+0x84b78)
    #20 event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390:5 (libevent-1.4.so.2+0x8608)
    #21 event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532:4 (libevent-1.4.so.2+0x8608)
    #22 folly::EventBase::loopMain(int, bool) folly/io/async/EventBase.cpp:400 (libfolly_io_async_async_base.so+0x49c47)
    #23 folly::EventBase::loopBody(int, bool) folly/io/async/EventBase.cpp:326 (libfolly_io_async_async_base.so+0x4940f)
    #24 folly::EventBase::loop() folly/io/async/EventBase.cpp:305 (libfolly_io_async_async_base.so+0x49298)
    #25 folly::EventBase::loopForever() folly/io/async/EventBase.cpp:545 (libfolly_io_async_async_base.so+0x5c7bf)
    #26 folly::IOThreadPoolExecutor::threadRun(std::shared_ptr<folly::ThreadPoolExecutor::Thread>) folly/executors/IOThreadPoolExecutor.cpp:250 (libfolly_executors_io_thread_pool_executor.so+0x15b72)
    #27 void std::__invoke_impl<void, void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&>(std::__invoke_memfun_deref, void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:74 (libfolly_executors_thread_pool_executor.so+0x56191)
    #28 std::__invoke_result<void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&>::type std::__invoke<void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&>(void (folly::ThreadPoolExecutor::*&)(std::shared_ptr<folly::ThreadPoolExecutor::Thread>), folly::ThreadPoolExecutor*&, std::shared_ptr<folly::ThreadPoolExecutor::Thread>&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:96 (libfolly_executors_thread_pool_executor.so+0x55f07)
    #29 void std::_Bind<void (folly::ThreadPoolExecutor::* (folly::ThreadPoolExecutor*, std::shared_ptr<folly::ThreadPoolExecutor::Thread>))(std::shared_ptr<folly::ThreadPoolExecutor::Thread>)>::__call<void, 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/functional:420 (libfolly_executors_thread_pool_executor.so+0x55e6a)
    #30 void std::_Bind<void (folly::ThreadPoolExecutor::* (folly::ThreadPoolExecutor*, std::shared_ptr<folly::ThreadPoolExecutor::Thread>))(std::shared_ptr<folly::ThreadPoolExecutor::Thread>)>::operator()<void>() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/functional:503 (libfolly_executors_thread_pool_executor.so+0x55dc6)
    #31 void folly::detail::function::FunctionTraits<void ()>::callSmall<std::_Bind<void (folly::ThreadPoolExecutor::* (folly::ThreadPoolExecutor*, std::shared_ptr<folly::ThreadPoolExecutor::Thread>))(std::shared_ptr<folly::ThreadPoolExecutor::Thread>)> >(folly::detail::function::Data&) folly/Function.h:363 (libfolly_executors_thread_pool_executor.so+0x55a5d)
    #32 folly::detail::function::FunctionTraits<void ()>::operator()() folly/Function.h:392 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa9603)
    #33 folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()::operator()() folly/executors/thread_factory/NamedThreadFactory.h:40 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa959c)
    #34 void std::__invoke_impl<void, folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()>(std::__invoke_other, folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:61 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa952d)
    #35 std::__invoke_result<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()>::type std::__invoke<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()>(folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:96 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa947d)
    #36 void std::thread::_Invoker<std::tuple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:253 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa9425)
    #37 std::thread::_Invoker<std::tuple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()> >::operator()() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:260 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa93c5)
    #38 std::thread::_State_impl<std::thread::_Invoker<std::tuple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::'lambda'()> > >::_M_run() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:211 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa9159)
    #39 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)

  Location is heap block of size 4736 at 0x7b840000b400 allocated by main thread:
    #0 operator new(unsigned long, std::align_val_t) <null> (MKAModuleTest+0x1c960b)
    #1 __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/ext/new_allocator.h:125 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xad076)
    #2 std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/allocator.h:197 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xacf39)
    #3 std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, (__gnu_cxx::_Lock_policy)2> >&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/allocated_ptr.h:97 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xacb4e)
    #4 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(facebook::fboss::BidirectionalPacketStream*&, std::_Sp_alloc_shared_tag<std::allocator<facebook::fboss::BidirectionalPacketStream> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:704 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xac85c)
    #5 std::__shared_ptr<facebook::fboss::BidirectionalPacketStream, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<facebook::fboss::BidirectionalPacketStream>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(std::_Sp_alloc_shared_tag<std::allocator<facebook::fboss::BidirectionalPacketStream> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr_base.h:1398 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xac76f)
    #6 std::shared_ptr<facebook::fboss::BidirectionalPacketStream>::shared_ptr<std::allocator<facebook::fboss::BidirectionalPacketStream>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(std::_Sp_alloc_shared_tag<std::allocator<facebook::fboss::BidirectionalPacketStream> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr.h:409 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xac647)
    #7 std::shared_ptr<facebook::fboss::BidirectionalPacketStream> std::allocate_shared<facebook::fboss::BidirectionalPacketStream, std::allocator<facebook::fboss::BidirectionalPacketStream>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(std::allocator<facebook::fboss::BidirectionalPacketStream> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr.h:862 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xac4c6)
    #8 std::shared_ptr<facebook::fboss::BidirectionalPacketStream> std::make_shared<facebook::fboss::BidirectionalPacketStream, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, double&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*&&, folly::EventBase*&&, double&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/shared_ptr.h:878 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa34b5)
    #9 facebook::fboss::mka::MKAModule::MKAModule(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, unsigned short, unsigned short, unsigned short, bool) fboss/facebook/mka_service/mka_module/MKAModule.cpp:149 (libfboss_facebook_mka_service_mka_module_mka_module.so+0xa24c0)
    #10 std::_MakeUniq<facebook::fboss::mka::MKAModule>::__single_object std::make_unique<facebook::fboss::mka::MKAModule, bool, char const (&) [12], double const&, unsigned short&, unsigned short, unsigned short, bool&>(bool&&, char const (&) [12], double const&, unsigned short&, unsigned short&&, unsigned short&&, bool&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962 (MKAModuleTest+0x1b7f66)
    #11 MKAModuleTest::startMKAModule(bool) fboss/facebook/mka_service/mka_module/tests/MKAModuleTest.cpp:129 (MKAModuleTest+0x194ff8)
    #12 MKAModuleTest::SetUp() fboss/facebook/mka_service/mka_module/tests/MKAModuleTest.cpp:178 (MKAModuleTest+0x14158c)
    #13 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2677:48 (libgtest.so.1.11.0+0x50eb8)
    #14 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2672:6 (libgtest.so.1.11.0+0x50eb8)
    #15 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x2161)

  Thread T44 'mka_service' (tid=1424413, running) created by main thread at:
    #0 pthread_create <null> (MKAModuleTest+0x23000d)
    #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xdf5ee)
    #2 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::EventBase::Options, folly::EventBaseManager*, folly::Range<char const*>) folly/io/async/ScopedEventBaseThread.cpp:68 (libfolly_io_async_scoped_event_base_thread.so+0x86f4)
    #3 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::EventBaseManager*, folly::Range<char const*>) folly/io/async/Scoped…
facebook-github-bot pushed a commit that referenced this pull request Aug 18, 2022
Summary:
We have a race between FsdbStreamClient::setServerToConnect() setting serverAddress_ and FsdbStreamClient::timeoutExpired() from reconnect thread checking if it has an address for us to reconnect to.

With tests from D37376542:
```
❯ buck test mode/dev-tsan //fboss/facebook/mka_service/fsdb/tests:MKAFsdbSyncerTest -- --stress-runs 10
...
Summary
  Pass: 10
  Fatal: 10
```
```
==================
WARNING: ThreadSanitizer: data race (pid=708956)
  Read of size 2 at 0x7b4c00001c88 by thread T79:
    #0 folly::SocketAddress::getPort() const folly/SocketAddress.cpp:413 (libfolly_network_address.so+0x8bfda)
    #1 facebook::fboss::fsdb::FsdbStreamClient::timeoutExpired() fboss/fsdb/client/FsdbStreamClient.cpp:98 (libfboss_fsdb_client_fsdb_stream_client.so+0x2e858)
    #2 facebook::fboss::fsdb::FsdbStreamClient::FsdbStreamClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>)::$_16::operator()() const fboss/fsdb/client/FsdbStreamClient.cpp:34 (libfboss_fsdb_client_fsdb_stream_client.so+0x328e5)
    #3 folly::detail::async_timeout_wrapper<facebook::fboss::fsdb::FsdbStreamClient::FsdbStreamClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>)::$_16>::timeoutExpired() folly/io/async/AsyncTimeout.h:255 (libfboss_fsdb_client_fsdb_stream_client.so+0x3289c)
    #4 folly::AsyncTimeout::libeventCallback(int, short, void*) folly/io/async/AsyncTimeout.cpp:174 (libfolly_io_async_async_base.so+0x41e6b)
    #5 event_process_active /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:390:5 (libevent-1.4.so.2+0x8608)
    #6 event_base_loop /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/event.c:532:4 (libevent-1.4.so.2+0x8608)
    #7 folly::EventBase::loopMain(int, bool) folly/io/async/EventBase.cpp:400 (libfolly_io_async_async_base.so+0x49c47)
    #8 folly::EventBase::loopBody(int, bool) folly/io/async/EventBase.cpp:326 (libfolly_io_async_async_base.so+0x4940f)
    #9 folly::EventBase::loop() folly/io/async/EventBase.cpp:305 (libfolly_io_async_async_base.so+0x49298)
    #10 folly::EventBase::loopForever() folly/io/async/EventBase.cpp:545 (libfolly_io_async_async_base.so+0x5c7bf)
    #11 folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&) folly/io/async/ScopedEventBaseThread.cpp:40 (libfolly_io_async_scoped_event_base_thread.so+0x8b78)
    #12 void std::__invoke_impl<void, void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >(std::__invoke_other, void (*&&)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*&&, folly::EventBase*&&, folly::Baton<true, std::atomic>*&&, folly::Range<char const*>&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:61 (libfolly_io_async_scoped_event_base_thread.so+0x101e0)
    #13 std::__invoke_result<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >::type std::__invoke<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> >(void (*&&)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*&&, folly::EventBase*&&, folly::Baton<true, std::atomic>*&&, folly::Range<char const*>&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/invoke.h:96 (libfolly_io_async_scoped_event_base_thread.so+0xff14)
    #14 void std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:253 (libfolly_io_async_scoped_event_base_thread.so+0xfe4d)
    #15 std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > >::operator()() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:260 (libfolly_io_async_scoped_event_base_thread.so+0xfd85)
    #16 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > > >::_M_run() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/std_thread.h:211 (libfolly_io_async_scoped_event_base_thread.so+0xf759)
    #17 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)

  Previous write of size 2 at 0x7b4c00001c88 by main thread (mutexes: write M477235840850862816):
    #0 folly::SocketAddress::SocketAddress(folly::SocketAddress&&) folly/SocketAddress.h:598 (libfboss_fsdb_client_fsdb_stream_client.so+0x4ca07)
    #1 void std::_Optional_base_impl<folly::SocketAddress, std::_Optional_base<folly::SocketAddress, false, false> >::_M_construct<folly::SocketAddress>(folly::SocketAddress&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/optional:420 (libfboss_fsdb_client_fsdb_stream_client.so+0x4c70e)
    #2 std::enable_if<__and_v<std::__not_<std::is_same<std::optional<folly::SocketAddress>, std::remove_cv<std::remove_reference<folly::SocketAddress>::type>::type> >, std::__not_<std::__and_<std::is_scalar<folly::SocketAddress>, std::is_same<folly::SocketAddress, std::decay<folly::SocketAddress>::type> > >, std::is_constructible<folly::SocketAddress, folly::SocketAddress>, std::is_assignable<folly::SocketAddress&, folly::SocketAddress> >, std::optional<folly::SocketAddress>&>::type std::optional<folly::SocketAddress>::operator=<folly::SocketAddress>(folly::SocketAddress&&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/optional:810 (libfboss_fsdb_client_fsdb_stream_client.so+0x4c4a6)
    #3 facebook::fboss::fsdb::FsdbStreamClient::setServerToConnect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, bool) fboss/fsdb/client/FsdbStreamClient.cpp:92 (libfboss_fsdb_client_fsdb_stream_client.so+0x4c2a7)
    #4 auto void facebook::fboss::fsdb::FsdbPubSubManager::addSubscriptionImpl<facebook::fboss::fsdb::FsdbStateSubscriber>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, facebook::fboss::fsdb::FsdbStateSubscriber::FsdbSubUnitUpdateCb, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)::'lambda'(facebook::fboss::fsdb::FsdbStateSubscriber&)::operator()<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<facebook::fboss::fsdb::FsdbStreamClient, std::default_delete<facebook::fboss::fsdb::FsdbStreamClient> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::unique_ptr<facebook::fboss::fsdb::FsdbStreamClient, std::default_delete<facebook::fboss::fsdb::FsdbStreamClient> > > > > >(facebook::fboss::fsdb::FsdbStateSubscriber&) const fboss/fsdb/client/FsdbPubSubManager.cpp:263 (libfboss_fsdb_client_fsdb_pub_sub.so+0x155e9b)
    #5 auto folly::SynchronizedBase<folly::Synchronized<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<facebook::fboss::fsdb::FsdbStreamClient, std::default_delete<facebook::fboss::fsdb::FsdbStreamClient> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::unique_ptr<facebook::fboss::fsdb::FsdbStreamClient, std::default_delete<facebook::fboss::fsdb::FsdbStreamClient> > > > >, folly::SharedMutexImpl<false, void, std::atomic, folly::SharedMutexPolicyDefault> >, (folly::detail::SynchronizedMutexLevel)2>::withWLock<void facebook::fboss::fsdb::FsdbPubSubManager::addSubscriptionImpl<facebook::fboss::fsdb::FsdbStateSubscriber>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, facebook::fboss::fsdb::FsdbStateSubscriber::FsdbSubUnitUpdateCb, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)::'lambda'(facebook::fboss::fsdb::FsdbStateSubscriber&)>(facebook::fboss::fsdb::FsdbStateSubscriber&&) folly/Synchronized.h:305 (libfboss_fsdb_client_fsdb_pub_sub.so+0x155814)
    #6 void facebook::fboss::fsdb::FsdbPubSubManager::addSubscriptionImpl<facebook::fboss::fsdb::FsdbStateSubscriber>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, facebook::fboss::fsdb::FsdbStateSubscriber::FsdbSubUnitUpdateCb, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) fboss/fsdb/client/FsdbPubSubManager.cpp:247 (libfboss_fsdb_client_fsdb_pub_sub.so+0x1555ae)
    #7 facebook::fboss::fsdb::FsdbPubSubManager::addStatePathSubscription(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, std::function<void (facebook::fboss::fsdb::OperState&&)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) fboss/fsdb/client/FsdbPubSubManager.cpp:197 (libfboss_fsdb_client_fsdb_pub_sub.so+0x15539c)
    #8 facebook::fboss::mka::TestSubscription<thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > >::TestSubscription(facebook::fboss::fsdb::FsdbPubSubManager*, thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > >) fboss/facebook/mka_service/fsdb/tests/MKAFsdbTestUtils.h:57 (MKAFsdbSyncerTest+0x132899)
    #9 facebook::fboss::mka::TestSubscription<thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > > facebook::fboss::mka::MKAFsdbSyncerTest::subscribe<thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > >(thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > >) fboss/facebook/mka_service/fsdb/tests/MKAFsdbSyncerTest.cpp:79 (MKAFsdbSyncerTest+0x131b37)
    #10 facebook::fboss::mka::MKAFsdbSyncerTest_testSessionUpdate_Test::TestBody() fboss/facebook/mka_service/fsdb/tests/MKAFsdbSyncerTest.cpp:102 (MKAFsdbSyncerTest+0x10a03c)
    #11 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2682:50 (libgtest.so.1.11.0+0x50f35)
    #12 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2672:6 (libgtest.so.1.11.0+0x50f35)
    #13 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x2161)

  Location is heap block of size 408 at 0x7b4c00001c00 allocated by main thread:
    #0 operator new(unsigned long) <null> (MKAFsdbSyncerTest+0x14143c)
    #1 std::_MakeUniq<facebook::fboss::fsdb::FsdbStateSubscriber>::__single_object std::make_unique<facebook::fboss::fsdb::FsdbStateSubscriber, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*, folly::EventBase*, std::function<void (facebook::fboss::fsdb::OperState&&)>&, bool&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*&&, folly::EventBase*&&, std::function<void (facebook::fboss::fsdb::OperState&&)>&, bool&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962 (libfboss_fsdb_client_fsdb_pub_sub.so+0x1560f8)
    #2 auto void facebook::fboss::fsdb::FsdbPubSubManager::addSubscriptionImpl<facebook::fboss::fsdb::FsdbStateSubscriber>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, facebook::fboss::fsdb::FsdbStateSubscriber::FsdbSubUnitUpdateCb, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)::'lambda'(facebook::fboss::fsdb::FsdbStateSubscriber&)::operator()<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<facebook::fboss::fsdb::FsdbStreamClient, std::default_delete<facebook::fboss::fsdb::FsdbStreamClient> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::unique_ptr<facebook::fboss::fsdb::FsdbStreamClient, std::default_delete<facebook::fboss::fsdb::FsdbStreamClient> > > > > >(facebook::fboss::fsdb::FsdbStateSubscriber&) const fboss/fsdb/client/FsdbPubSubManager.cpp:250 (libfboss_fsdb_client_fsdb_pub_sub.so+0x155a21)
    #3 auto folly::SynchronizedBase<folly::Synchronized<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<facebook::fboss::fsdb::FsdbStreamClient, std::default_delete<facebook::fboss::fsdb::FsdbStreamClient> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::unique_ptr<facebook::fboss::fsdb::FsdbStreamClient, std::default_delete<facebook::fboss::fsdb::FsdbStreamClient> > > > >, folly::SharedMutexImpl<false, void, std::atomic, folly::SharedMutexPolicyDefault> >, (folly::detail::SynchronizedMutexLevel)2>::withWLock<void facebook::fboss::fsdb::FsdbPubSubManager::addSubscriptionImpl<facebook::fboss::fsdb::FsdbStateSubscriber>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, facebook::fboss::fsdb::FsdbStateSubscriber::FsdbSubUnitUpdateCb, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)::'lambda'(facebook::fboss::fsdb::FsdbStateSubscriber&)>(facebook::fboss::fsdb::FsdbStateSubscriber&&) folly/Synchronized.h:305 (libfboss_fsdb_client_fsdb_pub_sub.so+0x155814)
    #4 void facebook::fboss::fsdb::FsdbPubSubManager::addSubscriptionImpl<facebook::fboss::fsdb::FsdbStateSubscriber>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, facebook::fboss::fsdb::FsdbStateSubscriber::FsdbSubUnitUpdateCb, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) fboss/fsdb/client/FsdbPubSubManager.cpp:247 (libfboss_fsdb_client_fsdb_pub_sub.so+0x1555ae)
    #5 facebook::fboss::fsdb::FsdbPubSubManager::addStatePathSubscription(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, std::function<void (facebook::fboss::fsdb::OperState&&)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) fboss/fsdb/client/FsdbPubSubManager.cpp:197 (libfboss_fsdb_client_fsdb_pub_sub.so+0x15539c)
    #6 facebook::fboss::mka::TestSubscription<thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > >::TestSubscription(facebook::fboss::fsdb::FsdbPubSubManager*, thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > >) fboss/facebook/mka_service/fsdb/tests/MKAFsdbTestUtils.h:57 (MKAFsdbSyncerTest+0x132899)
    #7 facebook::fboss::mka::TestSubscription<thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > > facebook::fboss::mka::MKAFsdbSyncerTest::subscribe<thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > > >(thriftpath::ChildThriftPath<facebook::fboss::mka::MkaState, facebook::fboss::fsdb::FsdbOperStateRoot, thriftpath::Path<facebook::fboss::fsdb::MkaData, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, thriftpath::Path<facebook::fboss::fsdb::FsdbOperStateRoot, facebook::fboss::fsdb::FsdbOperStateRoot, apache::thrift::type_class::structure, folly::Unit> > >) fboss/facebook/mka_service/fsdb/tests/MKAFsdbSyncerTest.cpp:79 (MKAFsdbSyncerTest+0x131b37)
    #8 facebook::fboss::mka::MKAFsdbSyncerTest_testSessionUpdate_Test::TestBody() fboss/facebook/mka_service/fsdb/tests/MKAFsdbSyncerTest.cpp:102 (MKAFsdbSyncerTest+0x10a03c)
    #9 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2682:50 (libgtest.so.1.11.0+0x50f35)
    #10 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2672:6 (libgtest.so.1.11.0+0x50f35)
    #11 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x2161)

  Mutex M477235840850862816 is already destroyed.

  Thread T79 'FsdbReconnectTh' (tid=710754, running) created by main thread at:
    #0 pthread_create <null> (MKAFsdbSyncerTest+0x1a803d)
    #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xdf5ee)
    #2 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::EventBase::Options, folly::EventBaseManager*, folly::Range<char const*>) folly/io/async/ScopedEventBaseThread.cpp:68 (libfolly_io_async_scoped_event_base_thread.so+0x86f4)
    #3 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::EventBaseManager*, folly::Range<char const*>) folly/io/async/ScopedEventBaseThread.cpp:60 (libfolly_io_async_scoped_event_base_thread.so+0x83ed)
    #4 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::Range<char const*>) folly/io/async/ScopedEventBaseThread.cpp:53 (libfolly_io_async_scoped_event_base_thread.so+0xac91)
    #5 facebook::fboss::fsdb::FsdbPubSubManager::FsdbPubSubManager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) fboss/fsdb/client/FsdbPubSubManager.h:139 (libfboss_fsdb_client_fsdb_pub_sub.so+0x124f18)
    #6 std::_MakeUniq<facebook::fboss::fsdb::FsdbPubSubManager>::__single_object std::make_unique<facebook::fboss::fsdb::FsdbPubSubManager, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962 (libfboss_fsdb_client_fsdb_syncer.so+0x9b52)
    #7 facebook::fboss::fsdb::FsdbSyncManager::FsdbSyncManager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) fboss/fsdb/client/FsdbSyncManager.cpp:12 (libfboss_fsdb_client_fsdb_syncer.so+0x99d4)
    #8 facebook::fboss::mka::MKAFsdbSyncManager::MKAFsdbSyncManager() fboss/facebook/mka_service/fsdb/MKAFsdbSyncManager.cpp:30 (libfboss_facebook_mka_service_fsdb_fsdb_syncer.so+0x954a5)
    #9 std::_MakeUniq<facebook::fboss::mka::MKAFsdbSyncManager>::__single_object std::make_unique<facebook::fboss::mka::MKAFsdbSyncManager>() third-party-buck/platform010-compat/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962 (MKAFsdbSyncerTest+0x13d1a9)
    #10 facebook::fboss::mka::MKAFsdbSyncerTest::SetUp() fboss/facebook/mka_service/fsdb/tests/MKAFsdbSyncerTest.cpp:51 (MKAFsdbSyncerTest+0x108d91)
    #11 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2677:48 (libgtest.so.1.11.0+0x50eb8)
    #12 testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2672:6 (libgtest.so.1.11.0+0x50eb8)
    #13 main common/gtest/LightMain.cpp:20 (libcommon_gtest_light_main.so+0x2161)

ThreadSanitizer: data race folly/SocketAddress.cpp:413 in folly::SocketAddress::getPort() const
```

Reviewed By: peygar

Differential Revision: D38721759

fbshipit-source-id: 43570bd23ff2bf75cb812541ee7d022d1c012697
facebook-github-bot pushed a commit that referenced this pull request Sep 2, 2022
Summary:
Kamet and Makalu don't support I2C_RDWR function that Sandia and Lassen do. For Kamet and Makalu, we need to use I2C_SMBUS ioctl.

This code refactors the current logic in I2cDevIo so that we can support both these methods. I added an abstract class I2cDevIoImpl. We'll have two classes that will implement this -
 1) I2cRdWrIo -> for I2C_RDWR based access (implemented in this diff. Code refactored from existing I2cDevIo)
2) I2cSmbusIo -> for I2C_SMBUS based access. (implemented in next diff)

In this diff, I only implemented class #1. Next diff will implement #2.

I2cDevIo will act as the master class and instantiate one of I2cRdWrIo or I2cSmbusIo depending on what the platform supports (added this logic in next diff)

Differential Revision: D39213347

fbshipit-source-id: 01927f5503cdc7b44d1538df9fb142080c42dc7e
facebook-github-bot pushed a commit that referenced this pull request Sep 21, 2022
Summary:
Our FsdbStreamClient service loop currently fails TSAN because we've been using separate thread for Thrift and service loop, which is not supported by Thrift team. As discussed in chat, this will require considerable restructuring to fix. So temporarily ignoring TSAN here for tests to pass.

```
WARNING: ThreadSanitizer: data race on vptr (ctor/dtor vs virtual call) (pid=3501845)
  Write of size 8 at 0x7b3000070280 by thread T209:
    #0 apache::thrift::transport::TTransportException::~TTransportException() <null> (setup_qsfp_test_bin-millenio-5.5+0x4cf57ab)
    #1 void std::__exception_ptr::__dest_thunk<apache::thrift::transport::TTransportException>(void*) <null> (setup_qsfp_test_bin-millenio-5.5+0x55f1ab1)
    #2 std::__exception_ptr::exception_ptr::_M_release() <null> (libstdc++.so.6+0xa193b)
    #3 apache::thrift::rocket::RequestContextQueue::failAllScheduledWrites(folly::exception_wrapper) <null> (setup_qsfp_test_bin-millenio-5.5+0xae221ad)
    #4 apache::thrift::rocket::RocketClient::close(folly::exception_wrapper) <null> (setup_qsfp_test_bin-millenio-5.5+0xadfbaa4)
    #5 apache::thrift::rocket::Parser<apache::thrift::rocket::RocketClient>::readErr(folly::AsyncSocketException const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xae1b5d6)
    #6 folly::AsyncSocket::failConnect(char const*, folly::AsyncSocketException const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc2e0035)
    #7 folly::AsyncSocket::handleConnect() <null> (setup_qsfp_test_bin-millenio-5.5+0xc2ebdf0)
    #8 folly::AsyncSocket::handleWrite() <null> (setup_qsfp_test_bin-millenio-5.5+0xc2ea9c4)
    #9 folly::AsyncSocket::ioReady(unsigned short) <null> (setup_qsfp_test_bin-millenio-5.5+0xc2e692f)
    #10 folly::AsyncSocket::IoHandler::handlerReady(unsigned short) <null> (setup_qsfp_test_bin-millenio-5.5+0xc2f3320)
    #11 folly::EventHandler::libeventCallback(int, short, void*) <null> (setup_qsfp_test_bin-millenio-5.5+0xc402afc)
    #12 event_base_loop <null> (setup_qsfp_test_bin-millenio-5.5+0xcf5c1b8)
    #13 folly::EventBase::loopMain(int, bool) <null> (setup_qsfp_test_bin-millenio-5.5+0xc3f63a7)
    #14 folly::EventBase::loopForever() <null> (setup_qsfp_test_bin-millenio-5.5+0xc3fa224)
    #15 folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc361bff)
    #16 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > > >::_M_run() <null> (setup_qsfp_test_bin-millenio-5.5+0xc36262b)
    #17 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)

  Previous read of size 8 at 0x7b3000070280 by thread T58:
    #0 folly::exceptionStr(std::exception const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc63fdb3)
    #1 facebook::fboss::fsdb::FsdbStreamClient::serviceLoopWrapper() (.resume) <null> (setup_qsfp_test_bin-millenio-5.5+0x4c69842)
    #2 folly::resumeCoroutineWithNewAsyncStackRoot(std::__n4861::coroutine_handle<void>, folly::AsyncStackFrame&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc651151)
    #3 void folly::detail::function::FunctionTraits<void ()>::callSmall<folly::coro::detail::ViaCoroutinePromiseBase::scheduleContinuation()::'lambda'()>(folly::detail::function::Data&) <null> (setup_qsfp_test_bin-millenio-5.5+0x4c47168)
    #4 bool folly::AtomicNotificationQueue<folly::Function<void ()> >::drive<folly::EventBase::FuncRunner&>(folly::EventBase::FuncRunner&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc3fcfa2)
    #5 folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::execute() <null> (setup_qsfp_test_bin-millenio-5.5+0xc3f74ac)
    #6 non-virtual thunk to folly::EventBaseAtomicNotificationQueue<folly::Function<void ()>, folly::EventBase::FuncRunner>::handlerReady(unsigned short) <null> (setup_qsfp_test_bin-millenio-5.5+0xc3ff07d)
    #7 folly::EventHandler::libeventCallback(int, short, void*) <null> (setup_qsfp_test_bin-millenio-5.5+0xc402afc)
    #8 event_base_loop <null> (setup_qsfp_test_bin-millenio-5.5+0xcf5c1b8)
    #9 folly::EventBase::loopMain(int, bool) <null> (setup_qsfp_test_bin-millenio-5.5+0xc3f63a7)
    #10 folly::EventBase::loopForever() <null> (setup_qsfp_test_bin-millenio-5.5+0xc3fa224)
    #11 folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc361bff)
    #12 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > > >::_M_run() <null> (setup_qsfp_test_bin-millenio-5.5+0xc36262b)
    #13 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)

  Location is heap block of size 184 at 0x7b3000070200 allocated by thread T209:
    #0 malloc <null> (setup_qsfp_test_bin-millenio-5.5+0xd39d3c4)
    #1 __cxa_allocate_exception <null> (libstdc++.so.6+0xa045c)
    #2 folly::exception_wrapper::exception_wrapper<apache::thrift::transport::TTransportException, apache::thrift::transport::TTransportException, 325l>(apache::thrift::transport::TTransportException&&) <null> (setup_qsfp_test_bin-millenio-5.5+0xac66e06)
    #3 apache::thrift::rocket::RequestContextQueue::failAllScheduledWrites(folly::exception_wrapper) <null> (setup_qsfp_test_bin-millenio-5.5+0xae22180)
    #4 apache::thrift::rocket::RocketClient::close(folly::exception_wrapper) <null> (setup_qsfp_test_bin-millenio-5.5+0xadfbaa4)
    #5 apache::thrift::rocket::Parser<apache::thrift::rocket::RocketClient>::readErr(folly::AsyncSocketException const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xae1b5d6)
    #6 folly::AsyncSocket::failConnect(char const*, folly::AsyncSocketException const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc2e0035)
    #7 folly::AsyncSocket::handleConnect() <null> (setup_qsfp_test_bin-millenio-5.5+0xc2ebdf0)
    #8 folly::AsyncSocket::handleWrite() <null> (setup_qsfp_test_bin-millenio-5.5+0xc2ea9c4)
    #9 folly::AsyncSocket::ioReady(unsigned short) <null> (setup_qsfp_test_bin-millenio-5.5+0xc2e692f)
    #10 folly::AsyncSocket::IoHandler::handlerReady(unsigned short) <null> (setup_qsfp_test_bin-millenio-5.5+0xc2f3320)
    #11 folly::EventHandler::libeventCallback(int, short, void*) <null> (setup_qsfp_test_bin-millenio-5.5+0xc402afc)
    #12 event_base_loop <null> (setup_qsfp_test_bin-millenio-5.5+0xcf5c1b8)
    #13 folly::EventBase::loopMain(int, bool) <null> (setup_qsfp_test_bin-millenio-5.5+0xc3f63a7)
    #14 folly::EventBase::loopForever() <null> (setup_qsfp_test_bin-millenio-5.5+0xc3fa224)
    #15 folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc361bff)
    #16 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > > >::_M_run() <null> (setup_qsfp_test_bin-millenio-5.5+0xc36262b)
    #17 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)

  Thread T209 'qsfp_service' (tid=3503104, running) created by thread T56 at:
    #0 pthread_create <null> (setup_qsfp_test_bin-millenio-5.5+0xd3d5c0d)
    #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xdf5ee)
    #2 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::Range<char const*>) <null> (setup_qsfp_test_bin-millenio-5.5+0xc362370)
    #3 facebook::fboss::fsdb::FsdbStreamClient::FsdbStreamClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, folly::EventBase*, folly::EventBase*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>) <null> (setup_qsfp_test_bin-millenio-5.5+0x4c628b6)
    #4 facebook::fboss::fsdb::FsdbPublisher<facebook::fboss::fsdb::OperState>::FsdbPublisher(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, folly::EventBase*, folly::EventBase*, bool, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>) <null> (setup_qsfp_test_bin-millenio-5.5+0x4c3b669)
    #5 std::unique_ptr<facebook::fboss::fsdb::FsdbStatePublisher, std::default_delete<facebook::fboss::fsdb::FsdbStatePublisher> > facebook::fboss::fsdb::FsdbPubSubManager::createPublisherImpl<facebook::fboss::fsdb::FsdbStatePublisher>(std::lock_guard<std::mutex> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, int) const <null> (setup_qsfp_test_bin-millenio-5.5+0x4c3b05d)
    #6 facebook::fboss::fsdb::FsdbPubSubManager::createStatPathPublisher(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::function<void (facebook::fboss::fsdb::FsdbStreamClient::State, facebook::fboss::fsdb::FsdbStreamClient::State)>, int) <null> (setup_qsfp_test_bin-millenio-5.5+0x4c3e585)
    #7 facebook::fboss::fsdb::FsdbSyncManager::start() <null> (setup_qsfp_test_bin-millenio-5.5+0x4c35212)
    #8 void folly::detail::function::FunctionTraits<void (folly::futures::detail::CoreBase&, folly::Executor::KeepAlive<folly::Executor>&&, folly::exception_wrapper*)>::callSmall<void folly::futures::detail::Core<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >::setCallback<std::enable_if<!(folly::Future<folly::futures::detail::tryCallableResult<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > >, facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, std::enable_if<is_invocable_v<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&>, void>::type>::value_type> folly::Future<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >::thenTry<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0>(facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0&&) &&::'lambda'(folly::Executor::KeepAlive<folly::Executor>&&, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&)::ReturnsFuture::value), folly::Future<folly::futures::detail::tryCallableResult<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > >, facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, std::enable_if<is_invocable_v<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&>, void>::type>::value_type> folly::Future<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >::thenTry<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0>(facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0&&) &&::'lambda'(folly::Executor::KeepAlive<folly::Executor>&&, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&)::Return>::type folly::futures::detail::FutureBase<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >::thenImplementation<folly::Future<folly::futures::detail::tryCallableResult<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > >, facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, std::enable_if<is_invocable_v<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&>, void>::type>::value_type> folly::Future<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >::thenTry<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0>(facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0&&) &&::'lambda'(folly::Executor::KeepAlive<folly::Executor>&&, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&), folly::futures::detail::tryExecutorCallableResult<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > >, folly::Future<folly::futures::detail::tryCallableResult<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > >, facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, std::enable_if<is_invocable_v<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&>, void>::type>::value_type> folly::Future<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >::thenTry<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0>(facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0&&) &&::'lambda'(folly::Executor::KeepAlive<folly::Executor>&&, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&), void> >(facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0&&, folly::Future<folly::futures::detail::tryCallableResult<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > >, facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, std::enable_if<is_invocable_v<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&>, void>::type>::value_type> folly::Future<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >::thenTry<facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0>(facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0&&) &&::'lambda'(folly::Executor::KeepAlive<folly::Executor>&&, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&), folly::futures::detail::InlineContinuation)::'lambda'(folly::Executor::KeepAlive<folly::Executor>&&, folly::Try<std::vector<folly::Try<folly::Unit>, std::allocator<folly::Try<folly::Unit> > > >&&)>(facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode)::$_0&&, std::shared_ptr<folly::RequestContext>&&, folly::futures::detail::InlineContinuation)::'lambda'(folly::futures::detail::CoreBase&, folly::Executor::KeepAlive<folly::Executor>&&, folly::exception_wrapper*)>(folly::futures::detail::CoreBase&, folly::Executor::KeepAlive<folly::Executor>&&, folly::exception_wrapper*, folly::detail::function::Data&) <null> (setup_qsfp_test_bin-millenio-5.5+0x3fa2bda)
    #9 void folly::detail::function::FunctionTraits<void ()>::callSmall<void folly::Executor::KeepAlive<folly::Executor>::add<folly::futures::detail::CoreBase::doCallback(folly::Executor::KeepAlive<folly::Executor>&&, folly::futures::detail::State)::$_0>(folly::futures::detail::CoreBase::doCallback(folly::Executor::KeepAlive<folly::Executor>&&, folly::futures::detail::State)::$_0&&) &&::'lambda'()>(folly::detail::function::Data&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc410445)
    #10 folly::EventBase::FunctionLoopCallback::runLoopCallback() <null> (setup_qsfp_test_bin-millenio-5.5+0xc3fb315)
    #11 folly::EventBase::runLoopCallbacks() <null> (setup_qsfp_test_bin-millenio-5.5+0xc3f5590)
    #12 folly::EventBase::loopMain(int, bool) <null> (setup_qsfp_test_bin-millenio-5.5+0xc3f63b9)
    #13 folly::EventBase::loopForever() <null> (setup_qsfp_test_bin-millenio-5.5+0xc3fa224)
    #14 folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&) <null> (setup_qsfp_test_bin-millenio-5.5+0xc361bff)
    #15 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> const&), folly::EventBaseManager*, folly::EventBase*, folly::Baton<true, std::atomic>*, folly::Range<char const*> > > >::_M_run() <null> (setup_qsfp_test_bin-millenio-5.5+0xc36262b)
    #16 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4)

  Thread T58 'FsdbStatsPublis' (tid=3501909, running) created by main thread at:
    #0 pthread_create <null> (setup_qsfp_test_bin-millenio-5.5+0xd3d5c0d)
    #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xdf5ee)
    #2 folly::ScopedEventBaseThread::ScopedEventBaseThread(folly::Range<char const*>) <null> (setup_qsfp_test_bin-millenio-5.5+0xc362370)
    #3 facebook::fboss::fsdb::FsdbPubSubManager::FsdbPubSubManager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) <null> (setup_qsfp_test_bin-millenio-5.5+0x4c368b2)
    #4 facebook::fboss::fsdb::FsdbSyncManager::FsdbSyncManager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) <null> (setup_qsfp_test_bin-millenio-5.5+0x4c34d3a)
    #5 facebook::fboss::QsfpFsdbSyncManager::QsfpFsdbSyncManager() <null> (setup_qsfp_test_bin-millenio-5.5+0x4c303d8)
    #6 facebook::fboss::WedgeManager::WedgeManager(std::unique_ptr<facebook::fboss::TransceiverPlatformApi, std::default_delete<facebook::fboss::TransceiverPlatformApi> >, std::unique_ptr<facebook::fboss::PlatformMapping, std::default_delete<facebook::fboss::PlatformMapping> >, facebook::fboss::PlatformMode) <null> (setup_qsfp_test_bin-millenio-5.5+0x3f9c26f)
    #7 facebook::fboss::Minipack16QManager::Minipack16QManager() <null> (setup_qsfp_test_bin-millenio-5.5+0x3fff408)
    #8 facebook::fboss::createFBWedgeManager(std::unique_ptr<facebook::fboss::PlatformProductInfo, std::default_delete<facebook::fboss::PlatformProductInfo> >) <null> (setup_qsfp_test_bin-millenio-5.5+0x3fbfa1c)
    #9 facebook::fboss::createWedgeManager() <null> (setup_qsfp_test_bin-millenio-5.5+0x4008efe)
    #10 facebook::fboss::HwQsfpEnsemble::init() <null> (setup_qsfp_test_bin-millenio-5.5+0x3f87775)
    #11 facebook::fboss::HwTest::SetUp() <null> (setup_qsfp_test_bin-millenio-5.5+0x3f7624e)
    #12 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) <null> (setup_qsfp_test_bin-millenio-5.5+0xc71b5cf)
    #13 __libc_start_call_main <null> (libc.so.6+0x2c656)
```

Reviewed By: peygar

Differential Revision: D39152941

fbshipit-source-id: ed2351d691340eb5c1ca486fa7066b1a33f1411b
facebook-github-bot pushed a commit that referenced this pull request Dec 20, 2022
Summary:
This is the first diff of the stack that adds a speed change test. The overall idea for the test is -
1. Create a copy of the config, and modify the speeds in the original config in the cold boot iteration. Need to modify the original config and not the copy so that the trunk step of prod->trunk->prod warm boots with the new speeds
2. Verify link sanity
3. Revert back the config at the end of warm boot iteration so that the next test works with the original config.

This diff adds helper functions to do #1. Next diff adds #2 and #3.

Reviewed By: rajank7

Differential Revision:
D40725414

Privacy Context Container: L1125642

fbshipit-source-id: 83e4206db5bd9140ea5194909257ea8f2dec162e
facebook-github-bot pushed a commit that referenced this pull request Feb 10, 2023
Summary:
Fixes the following TSAN data race -

```
Write of size 8 at 0x7b8400009888 by thread T40 (mutexes: write M507916304074681368, read M61215687833552496):
  #0 facebook::fboss::QsfpModule::markLastDownTime() fboss/qsfp_service/module/QsfpModule.cpp:951 (qsfp_service+0x206ea68)
  #1 facebook::fboss::TransceiverManager::markLastDownTime(facebook::fboss::TransceiverID) fboss/qsfp_service/TransceiverManager.cpp:1279 (qsfp_service+0x2143c4a)
  #2 void facebook::fboss::markLastDownTime_impl::operator()<facebook::fboss::ALL_PORTS_DOWN_helper

Previous read of size 8 at 0x7b8400009888 by thread T75 (mutexes: read M61215687833552496, write M401237648678623312):
  #0 facebook::fboss::QsfpModule::shouldRemediateLocked() fboss/qsfp_service/module/QsfpModule.cpp:649 (qsfp_service+0x206dbeb)
  #1 facebook::fboss::QsfpModule::shouldRemediate()::$_36::operator()() const fboss/qsfp_service/module/QsfpModule.cpp:590 (qsfp_service+0x20722b0)
  #2 facebook::fboss::QsfpModule::shouldRemediate() fboss/qsfp_service/module/QsfpModule.cpp:596 (qsfp_service+0x20722b0)
  #3 facebook::fboss::TransceiverManager::triggerRemediateEvents(std::vector<facebook::fboss::TransceiverID, std::allocator<facebook::fboss::TransceiverID> > const&) fboss/qsfp_service/TransceiverManager.cpp:1257 (qsfp_service+0x212d79a)
  #4 facebook::fboss::TransceiverManager::refreshStateMachines() fboss/qsfp_service/TransceiverManager.cpp:978 (qsfp_service+0x2142a52)
```

Reviewed By: rajank7

Differential Revision:
D43183960

Privacy Context Container: L1125642

fbshipit-source-id: 9169d1ea2f03db86cbfa20b9f3e615b0871ea2ec
arajeev-ARISTA referenced this pull request in arajeev-ARISTA/fboss Sep 26, 2023
Adds arista directory w/build + packaging tools and platform scripts
facebook-github-bot pushed a commit that referenced this pull request May 25, 2024
Summary:
Fixes the following TSAN error. isExiting_ is accessed by different threads

```
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]: WARNING: ThreadSanitizer: data race (pid=2492898)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:   Read of size 1 at 0x7b6400047670 by thread T105:
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #0 facebook::fboss::TransceiverManager::updateState(std::unique_ptr<facebook::fboss::TransceiverStateMachineUpdate, std::default_delete<facebook::fboss::TransceiverStateMachineUpdate>>) <null> (qsfp_service+0x3ebb67e) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #1 facebook::fboss::TransceiverManager::updateStateBlockingWithoutWait(facebook::fboss::TransceiverID, facebook::fboss::TransceiverStateMachineEvent) <null> (qsfp_service+0x3ebb0d9) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #2 facebook::fboss::TransceiverManager::triggerProgrammingEvents() <null> (qsfp_service+0x3ebdc71) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #3 facebook::fboss::TransceiverManager::refreshStateMachines() <null> (qsfp_service+0x3ed0f97) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #4 void folly::detail::function::call_<main::$_1, true, false, void>(folly::detail::function::Data&) <null> (qsfp_service+0x2ae3ed1) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #5 folly::FunctionScheduler::runOneFunction(std::unique_lock<std::mutex>&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l>>>) <null> (qsfp_service+0x2b99dce) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #6 folly::FunctionScheduler::run() <null> (qsfp_service+0x2b999ce) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #7 std::thread::_State_impl<std::thread::_Invoker<std::tuple<folly::FunctionScheduler::start()::$_2>>>::_M_run() <null> (qsfp_service+0x2b996b3) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #8 execute_native_thread_routine <null> (libstdc++.so.6+0xdf2e4) (BuildId: a70ae4d21aeb1a5dc28aa714c5135b5d4bf393c9)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:   Previous write of size 1 at 0x7b6400047670 by main thread:
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #0 facebook::fboss::QsfpServiceSignalHandler::signalReceived(int) <null> (qsfp_service+0x2aecacf) (BuildId: b2acbcaa66db571598102646487722e03e26433d)
May 24 20:13:06 fboss323865747.snc1.facebook.com qsfp_service_for_testing[2492898]:     #1 folly::AsyncSignalHandler::libeventCallback(int, short, void*) <null> (qsfp_service+0x5d857d9) (BuildId: b2acbcaa66db571598102646487722e03e26433d)

```

Reviewed By: rajank7

Differential Revision:
D57809004

Privacy Context Container: L1125642

fbshipit-source-id: 92efcd54b676a14badabe32ef86faf039a246fdb
facebook-github-bot pushed a commit that referenced this pull request Oct 16, 2024
…aneLoopOnAllPorts(facebook::fboss::AgentEnsemble*)'

Summary:
Example of a recent failure: https://www.internalfb.com/sandcastle/workflow/743093938520839118

```
FAILED: multi_switch_agent_hw_test
: && /bin/c++ -Wall -Werror -Wno-sign-compare -Wno-maybe-uninitialized -Wno-deprecated-declarations -Os -DNDEBUG  CMakeFiles/multi_switch_agent_hw_test.dir/fboss/agent/test/agent_hw_tests/MultiSwitchAgentHwTest.cpp.o -o multi_switch_agent_hw_test  -Wl,-rpath,/usr/local/fbcode/platform010/lib:/data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/libyaml-TY3Te3S5ejn-jjt3UP2vfLUbjC90dc6PD7psoP2Mts8/lib:/data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/gflags-FHGtz15ipgdtBy8VDWwU07RNW_0yBukAYrcBYzpi1g8/lib:/data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/glog-kCh757cr82SAdy4c1gcwKKJY2dg-eTnUsnnFYmqPNS4/lib64  -Wl,--whole-archive  libacl_test_utils.a  libagent_test_utils.a  libcopp_test_utils.a  libpkt_test_utils.a  libagent_hw_test_src.a  libagent_hw_test.a  libmulti_switch_agent_ensemble.a  libolympic_qos_utils.a  libtrunk_utils.a  libtraffic_policy_utils.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/folly/lib/libfolly.a  libhw_packet_utils.a  -Wl,--no-whole-archive  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/googletest-7JnJT5CgY1LVTPmQfwvncdoArZXAShZsSsQa9C0lCU4/lib64/libgmock_main.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/googletest-7JnJT5CgY1LVTPmQfwvncdoArZXAShZsSsQa9C0lCU4/lib64/libgmock.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/googletest-7JnJT5CgY1LVTPmQfwvncdoArZXAShZsSsQa9C0lCU4/lib64/libgtest.a  libagent_test_utils.a  liblabel_forwarding_utils.a  libhw_mock.a  libagent_hw_test_constants.a  libmono_agent_ensemble.a  libmonolithic_agent_initializer.a  libagent_hw_test_thrift_handler.a  libsai_ecmp_utils.a  libsai_switch.a  libdiag_shell.a  libsai_platform.a  libthrift_handler.a  libsai_switch.a  libdiag_shell.a  libsai_platform.a  libthrift_handler.a  -Wl,--unresolved-symbols=ignore-all  libhw_trunk_counters.a  libhw_port_fb303_stats.a  libprbs_stats_entry.a  libsai_store.a  libref_map.a  -Wl,--unresolved-symbols=report-all  libsai_repl.a  libsai_api.a  libaddress_util.a  liblogging_util.a  libfunction_call_time_reporter.a  libpython_repl.a  /usr/local/fbcode/platform010/lib/libpython3.8.so  -lutil  libwedge_led_utils.a  libfboss_i2c_lib.a  libi2c_controller_stats_cpp2.a  /usr/lib64/libusb-1.0.so  /usr/lib64/libcurl.so  libbcm_yaml_config.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/yaml-cpp-qO3lWZVT4UgBNn_iIPaAGXVLKmz02GwHst9pmDKpm0o/lib/libyaml-cpp.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/libyaml-TY3Te3S5ejn-jjt3UP2vfLUbjC90dc6PD7psoP2Mts8/lib/libyaml.so  libled_structs_types_cpp2.a  libled_mapping_cpp2.a  libsai_ctrl_cpp2.a  libproduction_features_cpp2.a  libstats_test_utils.a  libaqm_test_utils.a  libport_stats_test_utils.a  libhw_resource_stats_publisher.a  libecmp_dataplane_test_util.a  libfabric_test_utils.a  libpfc_test_utils.a  libqueue_test_utils.a  libinvariant_test_utils.a  libqos_test_utils.a  libvalidated_shell_commands_cpp2.a  libprod_config_factory.a  libdscp_marking_utils.a  libolympic_qos_utils.a  libqueue_per_host_test_utils.a  libcopp_test_utils.a  libtraffic_policy_utils.a  libload_balancer_test_utils.a  libhw_copp_utils.a  libhw_test_acl_utils.a  libacl_test_utils.a  libload_balancer_utils.a  libhw_pfc_utils.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/googletest-7JnJT5CgY1LVTPmQfwvncdoArZXAShZsSsQa9C0lCU4/lib64/libgmock_main.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/googletest-7JnJT5CgY1LVTPmQfwvncdoArZXAShZsSsQa9C0lCU4/lib64/libgmock.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/googletest-7JnJT5CgY1LVTPmQfwvncdoArZXAShZsSsQa9C0lCU4/lib64/libgtest.a  libroute_scale_gen.a  libroute_test_utils.a  libl2learn_observer_util.a  libmac_test_utils.a  libsflow_shim_utils.a  libmirror_test_utils.a  libtrap_packet_utils.a  libvoq_test_utils.a  libdsf_config_utils.a  libagent_ensemble.a  libroute_distribution_gen.a  libecmp_helper.a  libmain.a  libfboss_common_init.a  libagent_hw_test_ctrl_cpp2.a  libsplit_agent_initializer.a  libmulti_switch_hw_switch_handler.a  libsw_agent_initializer.a  libsetup_thrift.a  libresourcelibutil.a  libpacket_snooper.a  libpacket_factory.a  libhw_switch_ensemble.a  libpkt_test_utils.a  libconfig_factory.a  libconfig_utils.a  libasic_test_utils.a  libport_test_utils.a  libhwagent.a  libfboss_init.a  liblinkstate_toggler.a  libtest_ensemble_if.a  libhw_link_state_toggler.a  libmultiswitch_test_server.a  libhandler.a  libpkt.a  liblog_thrift_call.a  libthrifthandler_utils.a  libsplit_agent_thrift_syncer.a  libmultiswitch_service.a  libcore.a  libmonolithic_switch_handler.a  libhw_switch.a  libhw_switch_warmboot_helper.a  libhw_switch_handler.a  libhw_switch_fb303_stats.a  libcommon_utils.a  libplatform_base.a  libagent_dir_util.a  libload_agent_config.a  libroute_update_wrapper.a  libfib_updater.a  libhw_write_behavior.a  libswitchinfo_utils.a  libcapture.a  libpacket_observer.a  libdiag_cmd_filter.a  libhw_cpu_fb303_stats.a  libhw_fb303_stats.a  libcounter_utils.a  liblldp.a  liblldp_structs_cpp2.a  librestart_time_tracker.a  libexponential_back_off.a  libphy_utils.a  libbidirectional_packet_stream.a  libasync_packet_transport.a  libpacket_stream_cpp2.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/iproute2-uZlREBVTwro6XgcS1k92RX1WsnBeZ-bwcHp9vBd4xeQ/lib/libnetlink.a  /usr/lib64/libnl-3.so  /usr/lib64/libnl-route-3.so  libthread_heartbeat.a  libsw_switch_warmboot_helper.a  libhw_asic_table.a  libplatform_mapping_utils.a  libminipack_platform_mapping.a  libelbert_platform_mapping.a  libyamp_platform_mapping.a  libfake_test_platform_mapping.a  libfuji_platform_mapping.a  libgalaxy_platform_mapping.a  libwedge100_platform_mapping.a  libwedge40_platform_mapping.a  libwedge400_platform_utils.a  libwedge400c_platform_utils.a  libdarwin_platform_mapping.a  libwedge400_platform_mapping.a  libwedge400c_platform_mapping.a  libmorgan_platform_mapping.a  libcloud_ripper_platform_mapping.a  libmontblanc_platform_mapping.a  libtahan800bc_platform_mapping.a  libstandalone_rib.a  libaddress_utils.a  libnetwork_to_route_map.a  libasync_logger.a  libcommon_file_utils.a  libhw_ctrl_cpp2.a  libloadbalancer_utils.a  libl2learn_event_observer.a  libagent_fsdb_sync_manager.a  libfsdb_syncer.a  libfsdb_pub_sub.a  libfsdb_stream_client.a  libcommon_thrift_utils.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fb303/lib/libfb303.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fb303/lib/libfb303_thrift_cpp.a  libfsdb_client.a  libthrift_service_client.a  libqsfp_cpp2.a  libfsdb_cpp2.a  libfsdb_flags.a  libcow_storage_mgr.a  libtuple_utils.a  libfboss_event_base.a  libphy_snapshot_manager.a  libsnapshot_manager.a  libalert_logger.a  libbuild_info_wrapper.a  libpacket.a  libstats.a  libutils.a  libasic_utils.a  libswitch_asics.a  libversion_util.a  libswitchid_scope_resolver.a  libmeru400biu_platform_mapping.a  libmeru400bia_platform_mapping.a  libmeru400bfu_platform_mapping.a  libmeru800bia_platform_mapping.a  libmeru800bfa_platform_mapping.a  libproduct_info.a  libjanga800bic_platform_mapping.a  libplatform_mapping.a  libfboss_config_utils.a  libexternal_phy.a  libagent_features.a  libpktutil.a  libstate.a  libfsdb_helper.a  libstate.a  libfsdb_helper.a  libstate_utils.a  liblabel_forwarding_action.a  liberror.a  libhwswitch_matcher.a  libradix_tree.a  liblacp_types.a  libfsdb_model.a  libfsdb_model_thriftpath_cpp2.a  libfsdb_model_cpp2.a  libswitch_state_cpp2.a  libagent_config_cpp2.a  libswitch_reachability_cpp2.a  libqsfp_state_cpp2.a  libqsfp_config_cpp2.a  libtransceiver_validation_cpp2.a  libqsfp_stats_cpp2.a  libsensor_service_stats_cpp2.a  libsensor_service_cpp2.a  libsensor_config_cpp2.a  libthriftpath_lib.a  libfsdb_utils.a  libcow_storage.a  libthrift_cow_nodes.a  libnodebase.a  libfboss_error.a  libfboss_types.a  libthrift_cow_serializer.a  libthrift_cow_visitors.a  /usr/lib64/libre2.so  libcow_visitor_results_cpp2.a  libstorage.a  libmultiswitch_ctrl_cpp2.a  libctrl_cpp2.a  libplatform_config_cpp2.a  libbcm_config_cpp2.a  libasic_config_cpp2.a  libasic_config_v2_cpp2.a  libagent_stats_cpp2.a  libhardware_stats_cpp2.a  libmka_structs_cpp2.a  liboptic_cpp2.a  libproduct_info_cpp2.a  libphy_cpp2.a  libswitch_config_cpp2.a  libcommon_cpp2.a  libnetwork_address_cpp2.a  libfboss_common_cpp2.a  libmpls_cpp2.a  libfboss_cpp2.a  libtransceiver_cpp2.a  liblink_cpp2.a  libprbs_cpp2.a  libfb303_cpp2.a  libio_stats_cpp2.a  libfsdb_oper_cpp2.a  libfsdb_common_cpp2.a  libpatch_cpp2.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthriftcpp2.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthriftfrozen2.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthriftmetadata.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthriftanyrep.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthrifttype.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthriftprotocol.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthriftprotocol.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libasync.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libruntime.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libtransport.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/librpcmetadata.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libconcurrency.a  /lib64/libzstd.so  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/wangle/lib/libwangle.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthrift-core.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthrifttyperep.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libthriftannotation.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fbthrift/lib/libserverdbginfo.a  /usr/lib64/libxxhash.so  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_server_async_tran.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_server.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_server_state.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_dsr_frontend.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_dsr_types.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_fizz_handshake.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_transport.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_buf_accessor.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_state_datagram_handler.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_batch_writer.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_cc_algo.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_codec_pktrebuilder.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_happyeyeballs.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_async_udp_socket.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_events.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_looper.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_observer.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_state_ack_handler.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_loss.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_state_pacing_functions.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_state_simple_frame_functions.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_state_functions.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_codec_pktbuilder.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_state_stream.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_flowcontrol.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_qlogger.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_state_stream_functions.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_state_machine.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_codec.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_handshake.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_codec_packet_number_cipher.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_codec_decode.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_codec_types.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_exception.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fizz/lib/libfizz.a  /usr/lib64/libsodium.so  /usr/lib64/libz.so  /usr/lib64/librt.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/liboqs-3qvQ3i20HCLbfm8kc-LU2vU0Z_kU9bieLj_ujQsF6-w/lib64/liboqs.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_bufutil.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_transport_knobs.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_constants.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/mvfst/lib/libmvfst_transport_settings_functions.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/folly/lib/libfolly.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/fmt-r9NMexE5zOSTPootfGu7cmU9U5mIr4-9ibtXGRGuVwU/lib64/libfmt.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/boost-ekzv3-LMUT7ciCQTZ8O6VgxUmubclRMMSvqk1pfNRpU/lib/libboost_context.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/boost-ekzv3-LMUT7ciCQTZ8O6VgxUmubclRMMSvqk1pfNRpU/lib/libboost_filesystem.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/boost-ekzv3-LMUT7ciCQTZ8O6VgxUmubclRMMSvqk1pfNRpU/lib/libboost_atomic.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/boost-ekzv3-LMUT7ciCQTZ8O6VgxUmubclRMMSvqk1pfNRpU/lib/libboost_program_options.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/boost-ekzv3-LMUT7ciCQTZ8O6VgxUmubclRMMSvqk1pfNRpU/lib/libboost_regex.a  -licudata  -licui18n  -licuuc  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/boost-ekzv3-LMUT7ciCQTZ8O6VgxUmubclRMMSvqk1pfNRpU/lib/libboost_system.a  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/boost-ekzv3-LMUT7ciCQTZ8O6VgxUmubclRMMSvqk1pfNRpU/lib/libboost_thread.a  /usr/lib64/libdouble-conversion.so  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/gflags-FHGtz15ipgdtBy8VDWwU07RNW_0yBukAYrcBYzpi1g8/lib/libgflags.so.2.2.2  /data/sandcastle/temp/skycastle/fbcode_builder_getdeps/installed/glog-kCh757cr82SAdy4c1gcwKKJY2dg-eTnUsnnFYmqPNS4/lib64/libglog.so  /usr/lib64/libevent.so  /usr/lib64/libz.so  /usr/lib64/libssl.so  /usr/lib64/libcrypto.so  /usr/lib64/libbz2.so  /usr/lib64/liblzma.so  /usr/lib64/liblz4.so  /usr/lib64/libzstd.so  /usr/lib64/libsnappy.so  /usr/lib64/libdwarf.so  /usr/lib64/libiberty.a  /usr/lib64/libaio.so  /usr/lib64/libsodium.so  -ldl  /usr/lib64/libunwind.so && :
/bin/ld: libagent_hw_test_src.a(AgentSflowMirrorTest.cpp.o): in function `facebook::fboss::AgentSflowMirrorWithLineRateTrafficTest::testSflowEgressCongestion()::{lambda()#2}::operator()() const':
AgentSflowMirrorTest.cpp:(.text._ZZN8facebook5fboss39AgentSflowMirrorWithLineRateTrafficTest25testSflowEgressCongestionEvENKUlvE0_clEv[_ZZN8facebook5fboss39AgentSflowMirrorWithLineRateTrafficTest25testSflowEgressCongestionEvENKUlvE0_clEv]+0x54): undefined reference to `facebook::fboss::utility::setupEcmpDataplaneLoopOnAllPorts(facebook::fboss::AgentEnsemble*)'
/bin/ld: AgentSflowMirrorTest.cpp:(.text._ZZN8facebook5fboss39AgentSflowMirrorWithLineRateTrafficTest25testSflowEgressCongestionEvENKUlvE0_clEv[_ZZN8facebook5fboss39AgentSflowMirrorWithLineRateTrafficTest25testSflowEgressCongestionEvENKUlvE0_clEv]+0x9a): undefined reference to `facebook::fboss::utility::createTrafficOnMultiplePorts(facebook::fboss::AgentEnsemble*, int, std::function<void (facebook::fboss::AgentEnsemble*, folly::IPAddressV6 const&)>, double)'
collect2: error: ld returned 1 exit status
```

Reviewed By: harshitgulati18

Differential Revision: D64489537

fbshipit-source-id: 4b0b536da3f081a9f68e7eba54181853968c84c7
facebook-github-bot pushed a commit that referenced this pull request Dec 10, 2024
…inating at HybridNode

Summary:
Using new defined test struct, adding test case for accessing with path visitor with the case of thrift path terminating at hybrid node

Of the overall test cases listed below, this covers the combo of 2a x 3c,3d,3e

2. D66525279 Update test struct definitions for comprehensive coverage of hybrid node access patterns for all visitors:
a. Thrift path terminating at HybridNode (annotated member hybridMapOfI32ToStruct)
b. Thrift path terminating at Thrift container (list, map, set, struct field in ChildStruct) under HybridNode
c. Thrift path terminating at leaf primitive under HybridNode (primitive leaves under ChildStruct: leafEnum, optionalI32, childMap/<key>, structMap/<key>/<field>, listOfStruct<key>/<field>)
d. [Existing UTs already cover] paths that terminate in COW leaf, COW nodes of various TCs

3. Path Visitor UTs to cover following operations on access patterns in #2 above:
a. modifyPath
b. removePath
c. Set
d. Get
e. Access (folly::dynamic)

ref: https://fburl.com/gdoc/46krq4xp

Differential Revision: D66971541

fbshipit-source-id: 9b71a95d0a8c9c227baa1ae795e8e688b6081ce0
facebook-github-bot pushed a commit that referenced this pull request Dec 11, 2024
…under hybrid node

Summary:
# Overview
Using new defined test struct, adding test case for accessing with path visitor with the case of thrift path terminating at hybrid node
Of the overall test cases listed below, this covers the combo of 2b x 3c,3d,3e
D66525279 Update test struct definitions for comprehensive coverage of hybrid node access patterns for all visitors:
a. Thrift path terminating at HybridNode (annotated member hybridMapOfI32ToStruct)
b. Thrift path terminating at Thrift container (list, map, set, struct field in ChildStruct) under HybridNode
c. Thrift path terminating at leaf primitive under HybridNode (primitive leaves under ChildStruct: leafEnum, optionalI32, childMap/<key>, structMap/<key>/<field>, listOfStruct<key>/<field>)
d. [Existing UTs already cover] paths that terminate in COW leaf, COW nodes of various TCs
Path Visitor UTs to cover following operations on access patterns in #2 above:
a. modifyPath
b. removePath
c. Set
d. Get
e. Access (folly::dynamic)
ref: https://fburl.com/gdoc/46krq4xp

# Fix
Originally, the serializeWrapper assumes TC to be of type structure. This diff removes that and passes TC type down from visitTyped method.

Differential Revision: D67038112

fbshipit-source-id: f06ba71e6145b7a27c2139db09fd22bf0e961e0a
facebook-github-bot pushed a commit that referenced this pull request Dec 12, 2024
…key under hybrid node

Summary:
# Overview
Using new defined test struct, adding test case for accessing with path visitor with the case of thrift path terminating at hybrid node
Of the overall test cases listed below, this covers the combo of 2c x 3c,3d,3e
D66525279 Update test struct definitions for comprehensive coverage of hybrid node access patterns for all visitors:
a. Thrift path terminating at HybridNode (annotated member hybridMapOfI32ToStruct)
b. Thrift path terminating at Thrift container (list, map, set, struct field in ChildStruct) under HybridNode
c. Thrift path terminating at leaf primitive under HybridNode (primitive leaves under ChildStruct: leafEnum, optionalI32, childMap/<key>, structMap/<key>/<field>, listOfStruct<key>/<field>)
d. [Existing UTs already cover] paths that terminate in COW leaf, COW nodes of various TCs
Path Visitor UTs to cover following operations on access patterns in #2 above:
a. modifyPath
b. removePath
c. Set
d. Get
e. Access (folly::dynamic)
ref: https://fburl.com/gdoc/46krq4xp

Differential Revision: D67049121

fbshipit-source-id: 3fa5d99845426f689853f5f915e55bac20b2bb9c
facebook-github-bot pushed a commit that referenced this pull request Dec 12, 2024
Summary:
# Overview
Using new defined test struct, adding test case for accessing with path visitor with the case of thrift path terminating at hybrid node
Of the overall test cases listed below, this covers the combo of 2a x 3a
D66525279 Update test struct definitions for comprehensive coverage of hybrid node access patterns for all visitors:
a. Thrift path terminating at HybridNode (annotated member hybridMapOfI32ToStruct)
b. Thrift path terminating at Thrift container (list, map, set, struct field in ChildStruct) under HybridNode
c. Thrift path terminating at leaf primitive under HybridNode (primitive leaves under ChildStruct: leafEnum, optionalI32, childMap/<key>, structMap/<key>/<field>, listOfStruct<key>/<field>)
d. [Existing UTs already cover] paths that terminate in COW leaf, COW nodes of various TCs
Path Visitor UTs to cover following operations on access patterns in #2 above:
a. modifyPath
b. removePath
c. Set
d. Get
e. Access (folly::dynamic)
ref: https://fburl.com/gdoc/46krq4xp

Differential Revision: D67051252

fbshipit-source-id: db13e6f261b6ee21a0c38441399242ee61fe7f11
facebook-github-bot pushed a commit that referenced this pull request Feb 12, 2025
Summary:
Test cases from different platform failed with this stack trace:

```
==12772==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000015b0 (pc 0x00004dfe8a72 bp 0x7ffd4ede0f70 sp 0x7ffd4ede0f50 T0)
==12772==The signal is caused by a READ memory access.
SCARINESS: 20 (wild-addr-read)
    #0 0x4dfe8a72 in facebook::fboss::SwAgentInitializer::stopAgent(bool, bool) (/tmp/sai_setup_bin-11.7.0.0_dnx_odp+0x4dfe8a72) (BuildId: 0479bd9c683c0ce782f9ddd67f7bdff48e35ef9e)
    #1 0x59304e1a in facebook::fboss::MonoAgentEnsemble::~MonoAgentEnsemble() (/tmp/sai_setup_bin-11.7.0.0_dnx_odp+0x59304e1a) (BuildId: 0479bd9c683c0ce782f9ddd67f7bdff48e35ef9e)
    #2 0x59303b5d in facebook::fboss::MonoAgentEnsemble::~MonoAgentEnsemble() (/tmp/sai_setup_bin-11.7.0.0_dnx_odp+0x59303b5d) (BuildId: 0479bd9c683c0ce782f9ddd67f7bdff48e35ef9e)
    #3 0x5930574e in facebook::fboss::createAgentEnsemble(std::function<facebook::fboss::cfg::SwitchConfig (facebook::fboss::AgentEnsemble const&)>, bool, std::function<void (facebook::fboss::cfg::SwitchConfig const&, facebook::fboss::cfg::PlatformConfig&)>, unsigned int, bool) (/tmp/sai_setup_bin-11.7.0.0_dnx_odp+0x5930574e) (BuildId: 0479bd9c683c0ce782f9ddd67f7bdff48e35ef9e)
    #4 0x59293da3 in facebook::fboss::AgentHwTest::SetUp() (/tmp/sai_setup_bin-11.7.0.0_dnx_odp+0x59293da3) (BuildId: 0479bd9c683c0ce782f9ddd67f7bdff48e35ef9e)
    #5 0x171a104d in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/tmp/sai_setup_bin-11.7.0.0_dnx_odp+0x171a104d) (BuildId: 0479bd9c683c0ce782f9ddd67f7bdff48e35ef9e)

```

J3: https://www.internalfb.com/sandcastle/workflow/1301540292316074160/artifact/actionlog.1301540292424123608.stderr.1?selectedLines=922-931-1-3

TH4:

https://www.internalfb.com/phabricator/paste/view/P1730442738

This can happens once exception in [createSwitch](https://www.internalfb.com/code/fbsource/[812e06694e40e840e99ed1c57e2816a2c90cbba9]/fbcode/fboss/agent/test/AgentEnsemble.cpp?lines=70), then ASAN/stack unwinding put memory error in the log and skipped the true issue (null pointer).

Add pointer check here so we can log the error  in createSwitch

Reviewed By: vasantspatil

Differential Revision:
D69540697

Privacy Context Container: L1125642

fbshipit-source-id: 240e813b78f37a235e54a47bf4515cc54fdfeb68
facebook-github-bot pushed a commit that referenced this pull request Jul 1, 2025
Summary:
On wedge agent conveyor there was a crash in one of the test suite - https://www.internalfb.com/intern/everpaste/?color=1&handle=GLxFjgSoGqUGjwEFAI4-Hc_BAiAPbr0LAAAz
Seems to be a possible race condition where the port settings is not programmed yet. This fix is making sure pointer dereferences are properly guarded with null checks.

```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==3490145==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000002c8 (pc 0x000047311002 bp 0x7f7b06dfab70 sp 0x7f7b06dfab00 T146)
==3490145==The signal is caused by a READ memory access.
==3490145==Hint: address points to the zero page.
V0630 04:59:37.361566 3490381 BcmPort.cpp:2950] set pause setting for port 23, Tx/Rx=>False/False
V0630 04:59:37.361660 3490381 BcmPort.cpp:2898] Skip same PFC setting for port 23, Tx/Rx =False/False
V0630 04:59:37.361681 3490381 BcmPort.cpp:2026] Updated Port flowlet config for eth3/9/1
V0630 04:59:37.361698 3490381 BcmPort.cpp:773] Updating Port flowlet config for eth3/9/1
V0630 04:59:37.361744 3490381 BcmPort.cpp:677] Flowlet port quality on port: 23programmed: false
SCARINESS: 10 (null-deref)
V0630 04:59:37.362781 3490381 BcmPort.cpp:391] Reinitializing stats for eth3/9/1
V0630 04:59:37.367948 3490381 BcmPort.cpp:1198] BCM_PORT_PHY_CONTROL_PRBS_TX_ENABLE is already disable for port 23
V0630 04:59:37.368042 3490381 BcmPort.cpp:1198] BCM_PORT_PHY_CONTROL_PRBS_RX_ENABLE is already disable for port 23
V0630 04:59:37.368143 3490381 BcmPort.cpp:763] Saving port settings for eth3/9/1
    #0 0x000047311002 in facebook::fboss::BcmPort::isPortPgConfigured() const (/tmp/setup_bcm_bin-6.5.26+0x47311002) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #1 0x0000474f09f7 in facebook::fboss::BcmBstStatsMgr::updateStats() (/tmp/setup_bcm_bin-6.5.26+0x474f09f7) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #2 0x0000474c6982 in facebook::fboss::BcmSwitch::updateGlobalStats() (/tmp/setup_bcm_bin-6.5.26+0x474c6982) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #3 0x00004741b2bd in facebook::fboss::BcmSwitch::updateStatsImpl() (/tmp/setup_bcm_bin-6.5.26+0x4741b2bd) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #4 0x000016b168d3 in facebook::fboss::HwSwitch::updateStats() (/tmp/setup_bcm_bin-6.5.26+0x16b168d3) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #5 0x00001aa8a76a in facebook::fboss::SwSwitch::updateStats() (/tmp/setup_bcm_bin-6.5.26+0x1aa8a76a) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #6 0x0000190b8337 in folly::FunctionScheduler::runOneFunction(std::unique_lock<std::mutex>&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l>>>) (/tmp/setup_bcm_bin-6.5.26+0x190b8337) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #7 0x0000190b7c13 in folly::FunctionScheduler::run() (/tmp/setup_bcm_bin-6.5.26+0x190b7c13) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #8 0x7f7b8c8df3b4 in execute_native_thread_routine (/usr/local/fbcode/platform010-compat/lib/libstdc++.so.6+0xdf3b4) (BuildId: bfd470bfcd746bb985706407f7f2f21d0d0f0394)
    #9 0x0000167d2826 in asan_thread_start(void*) (/tmp/setup_bcm_bin-6.5.26+0x167d2826) (BuildId: 34b07063ef04d2be8754ee4cc6c9fc619138995b)
    #10 0x7f7b8cc97988 in start_thread (/usr/local/fbcode/platform010-compat/lib/libc.so.6+0x97988) (BuildId: 8412691973fd914199b3e0331455960169d22837)
    #11 0x7f7b8cd2851b in __GI___clone3 (/usr/local/fbcode/platform010-compat/lib/libc.so.6+0x12851b) (BuildId: 8412691973fd914199b3e0331455960169d22837)
```

Reviewed By: maxwindiff, zechengh09

Differential Revision: D77550860

fbshipit-source-id: 56a69893626d5b5b4fd7635899936600b2589933
meta-codesync Bot pushed a commit that referenced this pull request Jan 15, 2026
Summary:
- Fix #1:
Current CmdSubcommands.cpp doesn't throw the runtime_error properly but only create it without throwing.
This diff adds the missing `throw`

- Fix #2:
I've also asked AI to generate a thorough list of unit tests for CmdSubCommands.cpp, which includes this check on handling the throwing correctly

- Fix #3:
And when I added such new unit tests, I noticed we never built the `framework_test` unit tests for fboss2 in OSS.
Introducing the new `fboss2_framework_test` unit test target to mirror the current buck `framework_test` for OSS

- Fix #4:
Also update the current `fboss2_targets` in OSS to include both `fboss2_framework_test` adn `fboss2-dev`

- Fix #5:
When building OSS `fboss2_targets`, I hit several linking issues:
  - Moved `fboss/cli/fboss2/oss/CmdList.cpp` from `fboss2` binary to `fboss2_lib`; otherwise it complains `kAdditionalCommandTree()` is missing. Which also matches what we do in buck:
https://www.internalfb.com/code/fbsource/[497b1f0d4df3]/fbcode/fboss/cli/fboss2/BUCK?lines=311
  - Add explicitly instantiation of a template function `getValidAggs()` so the test can link against it.
```
template const ValidAggMapType
CmdHandler<CmdShowPort, CmdShowPortTraits>::getValidAggs();
```
BUCK doesn't have such issue because it declares the template class `CmdHandler.cpp` as a header file not a src file, which makes CmdHandler.cpp available in the include path.
Since we can't do that for CMAKE, we can just explicitly instantiate such template function in CmdHandlerImple.cpp
https://www.internalfb.com/code/fbsource/[497b1f0d4df3]/fbcode/fboss/cli/fboss2/BUCK?lines=89-94

Reviewed By: srikrishnagopu

Differential Revision: D90525857

fbshipit-source-id: 96381d1aa1b86123cc17b3c3401b1985aa6ef492
ghost pushed a commit that referenced this pull request Feb 11, 2026
meta-codesync Bot pushed a commit that referenced this pull request Mar 3, 2026
Summary:
**Pre-submission checklist**
- [X] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running `pip install -r requirements-dev.txt && pre-commit install`
- [X] `pre-commit run`

The NVMe controllers have the capability to define “block size” to different values (512, 4096,
etc). This works just fine as long as we read and write directly from/to the device.

However, when we pre-build a bootable image using kiwi-ng, we also create the Master
Boot Record (MBR) and GPT partition table etc. These are expected to be placed in
“known” locations on the NMVe device, MBR at block 0 and primary GPT at block 1.
What kiwi-ng generates is a raw dump of the disk image that is slapped on block 0
and contains everything necessary for the device.

The problem happens when the NVMe controller block size is “NOT” 512 bytes (say its
4096 byte) and we are trying to boot an kiwi-ng generated image that we placed on
the device. grub tries to locate the GPT partition at block 1, aka offset 4096 on the
device but kiwi-ng placed it at offset 512 and hence is unable to find a bootable device.

The fix is to match the block size that kiwi-ng and NVMe controller use are the same.

Pull Request resolved: #781

Test Plan:
Case #1: NVMe block size != 512 bytes - We correct and update it to 512 bytes

         Starting dracut pre-mount hook...
    [    7.537363] dracut-pre-mount[798]: NVMe-Fix: 4096 NVMe block size detected. Attempting format to 512...
    [    7.544015] dracut-pre-mount[798]: NVMe-Fix: Formatting /dev/nvme0n1 with LBA Format 0...
    [   11.630218] dracut-pre-mount[798]: NVMe-Fix: Format complete.
     Installation...

     Case #2: NVMe block size == 512 bytes

         Starting dracut pre-mount hook...
     Installation...

Reviewed By: shiva-menta

Differential Revision: D91704213

Pulled By: kevin645

fbshipit-source-id: aa1aa3feec37347a9ad767175bb3194398be74c3
meta-codesync Bot pushed a commit that referenced this pull request May 15, 2026
…vendor README

Summary:
Three vendor-handoff prerequisites that complete the FSDB CGO wrapper stack. Wraps up the work started in D102380508 (typed PortMaps + generic stats-path API) and D103273787 (generic state-path API) into something ready to actually ship to AMD (and any future vendor).

**1. Symbol-visibility hardening**

Added `compiler_flags = ["-fvisibility=hidden", "-fvisibility-inlines-hidden"]` to the `fsdb_cgo_pub_sub_wrapper` Buck target and `target_compile_options(... -fvisibility=hidden ...)` to `FsdbCgoWrapper.cmake`. The `FSDB_CGO_API` macro on each entry point in `fsdb_cgo_api.h` resolves to `__attribute__((visibility("default")))`, so the wrapper's entry points stay exported while every Folly / Thrift / fb303 / glog / gflags / fmt / boost internal symbol gets demoted to local.

Verified: `nm -D --defined-only libfboss_fsdb_client_cgo_fsdb_cgo_pub_sub_wrapper.so | awk '$2 == "T" {print $3}'` returns exactly the wrapper's `FSDB_CGO_API`-tagged entry points and nothing else (vs. hundreds of leaked symbols before this change). Without this, AMD's binary would carry a giant unused public symbol table and risk `multiple definition` ODR collisions if they ever statically link anything else that uses Folly/Thrift.

**2. Fat-archive packaging script (`oss/build_fat_archive.sh`)**

A new bash script that takes the FBOSS OSS CMake build directory + getdeps installed/ tree and produces `libfsdb_cgo_bundle.a` — the single fat static archive AMD links against.

The script merges archives via `ar -M` MRI script mode (`addlib`) rather than the more obvious extract-and-rebundle approach. Hands-on validation against a real OSS deps tree turned up four defects in the extract-based approach; all four caused the link to fail in ways that no symbol-presence check would catch:

1. **Self-ingest**: `find -name '*.a'` would sweep up any pre-existing `libfsdb_cgo_bundle.a` sitting under the build dir from a prior run. The stale bundle's already-localized symbols would overwrite the good ones from the source archives. Fixed by (a) refusing to run if `output_dir` is under `build_dir` and (b) excluding `libfsdb_cgo_bundle.a` from the find.
2. **`ar -x` clobbers duplicate-named members within a single .a**. `libthrift_service_client.a` contains two `ThriftServiceClient.cpp.o` members; only one defines `FLAGS_wedge_agent_port`. The second extraction would overwrite the first on disk, dropping the flag definition and breaking the link.
3. **`xargs | ar qcs` splits and drops members on duplicate names across batches**. Same shape: members like libfmt's `format.cc.o` would be silently dropped when xargs split into multiple `ar` invocations, leaving `fmt::v12::vformat` undefined.
4. **`objcopy --localize-hidden` over-localizes transitive deps**. libfmt and other deps are built with `-fvisibility=hidden` by getdeps, so a belt-and-braces `objcopy` step over the whole bundle would convert `vformat` (and other symbols vendors need at link time) from external to local. The wrapper TU's own `-fvisibility=hidden` already keeps internal symbols hidden in its `.o` files; that visibility carries through `ar -M addlib` unchanged.

`ar -M addlib` fixes #2 and #3 by merging archives directly without extract+rebundle (preserves all members including duplicates by name). Skipping the bundle-wide `objcopy` step fixes #4. Excluding `libgflags*.a` from the bundle avoids a fifth issue: gflags double-registration at runtime ("flag 'flagfile' was defined more than once") because `libglog.so` already links gflags dynamically.

The script:
1. Walks the OSS build dir, finds every transitive `*.a` (typically 50–200 files: Folly, Thrift, fb303, glog, fmt, double-conversion, boost, libevent, zlib/zstd/lz4, libsodium, …).
2. Excludes self (`libfsdb_cgo_bundle.a`) and gflags (`libgflags.a`, `libgflags_nothreads.a`).
3. Merges all archives via `ar -M addlib`.
4. Verifies all expected entry-point symbols are present via `nm | awk`; exits non-zero if any are missing.
5. Copies `fsdb_cgo_api.h` next to the archive.
6. Writes `MANIFEST.txt` (size, sha256, members merged, build provenance).

**3. Vendor README (`README.md`)**

End-to-end documentation for AMD (and any future vendor):

- What's in the handoff (the `.a` + the `.h`) and what dynamic deps the host needs.
- Build steps: `cmake --build` → `oss/build_fat_archive.sh`.
- Sample Go cgo preamble for linking, with the full LDFLAGS (the bundle is closed for FBOSS code but still needs zlib, double-conversion, bz2/snappy/lz4/lzma, xxhash, libunwind, gflags, glog as system shared libs at link time).
- Toolchain requirement: clang or recent gcc with libstdc++ new ABI (cxx11).
- libunwind soname workaround for distros where glog's link-time `libunwind.so.1` doesn't match the runtime `libunwind.so.8`.
- API surface: typed PortMaps + generic path-based (state path, stats path) returning raw OperState bytes plus the OperProtocol enum value; the consumer decodes with their own Thrift bindings.
- Lifecycle contract: `FsdbInit` once, one wrapper per FSDB connection, single consumer thread per subscription, borrowed-pointer rules, and the mandatory `Shutdown` → wait → `Destroy` teardown sequence (skipping the wait is a use-after-free).
- Known v1 limitations and what's on the roadmap (synchronous polling, subscription error reporting, sub-100 ms shutdown via `folly::Baton`).

**Files**

- `fboss/fsdb/client/cgo/BUCK` — visibility flags on the `fsdb_cgo_pub_sub_wrapper` target.
- `fboss/github/cmake/fsdb/FsdbCgoWrapper.cmake` — same flags via `target_compile_options`.
- `fboss/fsdb/client/cgo/oss/build_fat_archive.sh` (new) — packaging script.
- `fboss/fsdb/client/cgo/README.md` (new) — vendor handoff doc.

Reviewed By: priyankw-meta

Differential Revision: D103276346

fbshipit-source-id: 1bb1eba611ac8dbd016e2c6d36dee4845f97e67a
meta-codesync Bot pushed a commit that referenced this pull request May 21, 2026
…switch mode

Summary:
gracefullyRestartServiceWithDelay aims to test the graceful restart period: if an agent is down, its system ports and interface state will go to STALE within the graceful period before it restarts.

Modify gracefullyRestartServiceWithDelay test by
- Supporting multi-switch mode.
- **Query RDSWs without restart**: the restarted RDSW's agent might not be able to respond to the Thrift call. After it restarts, its ports/interfaces might not be in STALE state since it just started fresh.
- **Read `FLAGS_dsf_gr_hold_time` instead of hardcoding 120**: addresses reviewer #2 from D102069665 (magic-number coupling). The C++ test now reads the same gflag the agent populates from `defaultCommandLineArgs["dsf_gr_hold_time"]` at startup, with a fail-loud guard if it's 0 (default). Single source of truth: configerator's `DSF_GR_HOLD_TIME` → materialized config → agent gflag → test.

Note: `ThriftClientUtils.cpp` uses literal service-name strings (`"fboss_sw_agent_test"` / `"wedge_agent-test"`) that match `kSwAgentTestService` / `kWedgeAgentTestService` in `TestThriftHandler.cpp`. Consolidating into a shared header is in the stacked follow-up D104082906.

Reviewed By: elangovan911-meta

Differential Revision: D102229431

fbshipit-source-id: d2e001af543c78eb7289636fb2cbfa601282898e
meta-codesync Bot pushed a commit that referenced this pull request Jul 20, 2026
Summary:
**Pre-submission checklist**
- [X] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running `pip install -r requirements-dev.txt && pre-commit install`
- [X] `pre-commit run`

Previously Platform Manager would attempt to load the BSPs from an explicitly named 'kernel' RPM repo, then fallback to using all repos. This was changed in 4aa0968 to only ever query the 'kernel' repo.

Distro images don't have a 'kernel' repo so loading the BSP RPM(s) would fail like so:
```
[root@dut ~]# systemctl status platform_manager.service
× platform_manager.service - FBOSS Platform Manager
     Loaded: loaded (/usr/lib/systemd/system/platform_manager.service; enabled; preset: disabled)
     Active: failed (Result: core-dump) since Fri 2026-06-12 16:54:06 UTC; 8min ago
    Process: 1523 ExecStart=/bin/bash -c source /opt/fboss/bin/setup_fboss_env && exec /opt/fboss/bin/platform_manager --run_once=false --thrift_ssl_policy=disabled (code=dumped, signal=ABRT)
   Main PID: 1523 (code=dumped, signal=ABRT)

Jun 12 17:02:09 dut systemd[1]: Failed to start FBOSS Platform Manager.
Jun 12 17:02:12 dut systemd[1]: platform_manager.service: Start request repeated too quickly.
Jun 12 17:02:12 dut systemd[1]: platform_manager.service: Failed with result 'core-dump'.
Jun 12 17:02:12 dut systemd[1]: Failed to start FBOSS Platform Manager.
Jun 12 17:02:14 dut systemd[1]: platform_manager.service: Start request repeated too quickly.
Jun 12 17:02:14 dut systemd[1]: platform_manager.service: Failed with result 'core-dump'.
Jun 12 17:02:14 dut systemd[1]: Failed to start FBOSS Platform Manager.
Jun 12 17:02:16 dut systemd[1]: platform_manager.service: Start request repeated too quickly.
Jun 12 17:02:16 dut systemd[1]: platform_manager.service: Failed with result 'core-dump'.
Jun 12 17:02:16 dut systemd[1]: Failed to start FBOSS Platform Manager.
[root@dut ~]# cd /opt/fboss/
[root@dut fboss]# source /opt/fboss/bin/setup_fboss_env && /opt/fboss/bin/platform_manager --run_once=false --thrift_ssl_policy=disabled
I0612 17:02:58.610355  4414 PlatformNameLib.cpp:80] Getting platform name from bios using dmidecode ...
I0612 17:02:58.612698  4414 PlatformNameLib.cpp:90] Platform name inferred from bios: NH-4010-F
I0612 17:02:58.612715  4414 PlatformNameLib.cpp:92] Platform name mapped: NH4010F
I0612 17:02:58.616100  4414 ConfigValidator.cpp:920] Validating platform_manager config
I0612 17:02:58.639423  4414 ConfigValidator.cpp:971] Validating SlotTypeConfig for Slot SCM_SLOT...
I0612 17:02:58.639431  4414 ConfigValidator.cpp:971] Validating SlotTypeConfig for Slot SMB_SLOT...
I0612 17:02:58.639435  4414 ConfigValidator.cpp:1018] Validating PmUnitConfig for PmUnit SCM in Slot SCM_SLOT...
I0612 17:02:58.640077  4414 ConfigValidator.cpp:1018] Validating PmUnitConfig for PmUnit SMB in Slot SMB_SLOT...
I0612 17:02:58.662190  4414 ConfigValidator.cpp:1069] Validating Symbolic links...
I0612 17:02:58.662586  4414 ConfigValidator.cpp:1079] Validating Transceiver symbolic links...
I0612 17:02:58.662644  4414 ConfigValidator.cpp:1094] Validating xcvr LED coverage...
I0612 17:02:58.662653  4414 ConfigValidator.cpp:1099] Validating xcvr ctrl coverage...
E0612 17:02:58.662760  4414 PlatformFsUtils.cpp:144] Received error code 2 from reading from path /run/devmap/metadata/config_hash: No such file or directory
I0612 17:02:58.662765  4414 ConfigUtils.cpp:98] No stored config hash found, can't determine if config has changed
Error: No matching Packages to list
I0612 17:02:58.842154  4414 PkgManager.cpp:217] BSP Kmods nexthop_bsp_kmods-6.11.1-1.fboss.el9.x86_64-1.0.0-1 is not installed
E0612 17:02:58.842197  4414 PlatformFsUtils.cpp:144] Received error code 2 from reading from path /usr/local/nexthop_bsp/6.11.1-1.fboss.el9.x86_64/kmods.json: No such file or directory
W0612 17:02:58.927485  4414 PkgManager.cpp:396] Skipping BSP kmods unloading. Reason: /usr/local/nexthop_bsp/6.11.1-1.fboss.el9.x86_64/kmods.json doesn't exist; most likely because this is the first RPM installation.
I0612 17:02:59.012305  4414 PkgManager.cpp:470] Skipping removing old rpms. Reason: No rpms installed.
I0612 17:02:59.012329  4414 PkgManager.cpp:269] Installing BSP nexthop_bsp_kmods-6.11.1-1.fboss.el9.x86_64-1.0.0-1, Attempt #0
Error: Unknown repo: 'kernel'
I0612 17:02:59.150860  4414 PkgManager.cpp:269] Installing BSP nexthop_bsp_kmods-6.11.1-1.fboss.el9.x86_64-1.0.0-1, Attempt #1
Error: Unknown repo: 'kernel'
I0612 17:02:59.289882  4414 PkgManager.cpp:269] Installing BSP nexthop_bsp_kmods-6.11.1-1.fboss.el9.x86_64-1.0.0-1, Attempt #2
Error: Unknown repo: 'kernel'
I0612 17:02:59.431552  4414 PlatformNameLib.cpp:104] Platform name read from cache: NH4010F
E0612 17:02:59.431591  4414 StructuredLogger.cpp:73] FBOSS_ALERT Failed to install rpm (nexthop_bsp_kmods-6.11.1-1.fboss.el9.x86_64-1.0.0-1) with exit code 1 <event:unexpected_crash> <service:platform_manager> <platform:NH4010F>
F0612 17:02:59.431610  4414 Main.cpp:145] Platform Manager crashed with unexpected exception: Failed to install rpm (nexthop_bsp_kmods-6.11.1-1.fboss.el9.x86_64-1.0.0-1) with exit code 1
```

Rather than rename the local_rpm_repo to the incorrect name 'kernel' or pollute the production Platform Manager code with OSS-specific code, alias the local_rpm_repo in Distro Image to 'kernel' to satisfy this need.

Pull Request resolved: #1290

Test Plan:
Modified a Distro image and loaded on a dut, confirmed that platform manager successfully:
```
[root@dut ~]# systemctl status platform_manager.service
● platform_manager.service - FBOSS Platform Manager
     Loaded: loaded (/usr/lib/systemd/system/platform_manager.service; enabled; preset: disabled)
     Active: active (running) since Fri 2026-06-12 17:41:07 UTC; 22s ago
   Main PID: 876 (platform_manage)

Reviewed By: kevin645

Differential Revision: D109366758

Pulled By: Scott8440

fbshipit-source-id: bbaed2030913ad250f78f1b3f73925a62b79a908
meta-codesync Bot pushed a commit that referenced this pull request Aug 7, 2026
Summary: This is a workaround for Issue #2 mentioned here - https://fb.workplace.com/groups/1312209053197833/permalink/1678890823196319/

Reviewed By: xanabani

Differential Revision: D110278188

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

2 participants