Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Commit

Permalink
Check if server socket instance is non-null
Browse files Browse the repository at this point in the history
Summary:
It was a null socket pointer which I don't understand I thought the map should never have that. I checked the server_sockets_ map and did not find a null socket so I am not sure what is happening here. I am adding a critical to get more info

```
(gdb) bt
#0  std::chrono::operator==<long, std::ratio<1l, 1000000000l>, long, std::ratio<1l, 1000000000l> > (__lhs=..., __rhs=...)
    at third-party-buck/platform007/build/libgcc/include/c++/trunk/chrono:547
#1  std::chrono::operator==<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__lhs=..., __rhs=...)
    at third-party-buck/platform007/build/libgcc/include/c++/trunk/chrono:754
#2  std::chrono::operator!=<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__lhs=..., __rhs=...)
    at third-party-buck/platform007/build/libgcc/include/c++/trunk/chrono:760
#3  facebook::logdevice::operator!=<std::chrono::_V2::steady_clock, facebook::logdevice::detail::Holder, std::chrono::duration<long, std::ratio<1l, 1000000000l> >, facebook::logdevice::detail::Holder, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (lhs=..., rhs=...) at logdevice/common/Timestamp.h:578
#4  facebook::logdevice::Socket::checkSocketHealth (this=0x0) <========================= *******nullptr******
    at logdevice/common/Socket.cpp:2463
#5  0x000000000547779a in facebook::logdevice::Sender::closeSlowSockets (
    this=0x7fe209854250) at logdevice/common/Sender.cpp:1612
#6  0x00000000054a3329 in folly::detail::function::FunctionTraits<void ()>::callSmall<facebook::logdevice::(anonymous namespace)::WheelTimerDispatchImpl::makeWheelTimerInternalExecutor(facebook::logdevice::Worker*)::$_0::operator()()::{lambda()#1}>(folly::detail::function::Data&) (p=...)
    at third-party-buck/platform007/build/libgcc/include/c++/trunk/bits/std_function.h:706
#7  0x00000000054c3c95 in folly::detail::function::FunctionTraits<void ()>::callBig<facebook::logdevice::Worker::addWithPriority(folly::Function<void ()>, signed char)::$_9>(folly::detail::function::Data&) (p=...)
    at folly/Function.h:416
#8  0x0000000005aba867 in folly::detail::function::FunctionTraits<void ()>::operator()() (this=0x7fe173385c80) at folly/Function.h:416
#9  facebook::logdevice::EventLoopTaskQueue::executeTasks (
    this=<optimized out>, tokens=<optimized out>)
    at logdevice/common/EventLoopTaskQueue.cpp:154
#10 facebook::logdevice::EventLoopTaskQueue::haveTasksEventHandler()::$_1::operator()(unsigned int) const (n=<optimized out>, this=<optimized out>)
    at logdevice/common/EventLoopTaskQueue.cpp:101
#11 facebook::logdevice::LifoEventSemImpl<std::atomic>::AsyncWaiter::processBatch<facebook::logdevice::EventLoopTaskQueue::haveTasksEventHandler()::$_1&>(facebook::logdevice::EventLoopTaskQueue::haveTasksEventHandler()::$_1&, unsigned int) (this=<optimized out>, func=..., maxBatchSize=<optimized out>)
    at logdevice/common/LifoEventSem.h:368
#12 facebook::logdevice::EventLoopTaskQueue::haveTasksEventHandler (
    this=<optimized out>) at logdevice/common/EventLoopTaskQueue.cpp:106
#13 facebook::logdevice::EventLoopTaskQueue::EventLoopTaskQueue(facebook::logdevice::EvBase&, unsigned long, std::array<unsigned int, 3ul> const&)::$_0::operator()() const (this=<optimized out>)
    at logdevice/common/EventLoopTaskQueue.cpp:36
#14 folly::detail::function::FunctionTraits<void ()>::callSmall<facebook::logdevice::EventLoopTaskQueue::EventLoopTaskQueue(facebook::logdevice::EvBase&, unsigned long, std::array<unsigned int, 3ul> const&)::$_0>(folly::detail::function::Data&) (p=...) at folly/Function.h:387
#15 0x0000000007f8bfb0 in event_process_active_single_queue (
    base=0x7fe1e7a1c000, activeq=0x7fe1e7a21010, max_to_process=2147483647,
    endtime=0x0) at rocketspeed/external/libevent-2.1.3-alpha/event.c:1411
#16 0x0000000007f8b5b8 in ld_event_base_loop (base=0x7fe1e7a1c000, flags=0)
    at rocketspeed/external/libevent-2.1.3-alpha/event.c:1596
#17 0x000000000784800e in facebook::logdevice::EvBaseLegacy::loop (
    this=0x7fe1e7a01018) at logdevice/common/libevent/EvBaseLegacy.cpp:59
#18 0x0000000005ab8795 in std::_Function_handler<void (), facebook::logdevice::EventLoop::EventLoop(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, facebook::logdevice::ThreadID::Type, unsigned long, bool, std::array<unsigned int, 3ul> const&, facebook::logdevice::EvBase::EvBaseType, bool)::$_0>::_M_invoke(std::_Any_data const&) (__functor=...)
    at logdevice/common/EventLoop.cpp:156
#19 0x000000000770bd23 in facebook::logdevice::thread_func (
    arg=0x7fe21c8b38a0)
    at third-party-buck/platform007/build/libgcc/include/c++/trunk/bits/std_function.h:706
#20 0x00007fe225bbe6b6 in start_thread ()
   from /usr/local/fbcode/platform007/lib/libpthread.so.0
#21 0x00007fe22529febf in clone ()
   from /usr/local/fbcode/platform007/lib/libc.so.6
```

Reviewed By: al13n321

Differential Revision: D19294475

fbshipit-source-id: e705d61277d2ad08245a8cacbcfcd68c127f5c08
  • Loading branch information
gdrane authored and facebook-github-bot committed Jan 27, 2020
1 parent 5e4aa12 commit e342d16
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion logdevice/common/Sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1648,10 +1648,29 @@ void Sender::closeSlowSockets() {
};

for (auto& entry : impl_->server_conns_) {
Connection* conn = entry.second.get();
if (conn) {
close_if_slow(*conn);
} else {
RATELIMIT_CRITICAL(
std::chrono::seconds(10),
1,
"Unexpected null server socket found for nid %u. T59653729",
entry.first);
}
close_if_slow(*entry.second);
}
for (auto& entry : impl_->client_conns_) {
close_if_slow(*entry.second);
Connection* conn = entry.second.get();
if (conn) {
close_if_slow(*conn);
} else {
RATELIMIT_CRITICAL(
std::chrono::seconds(10),
1,
"Unexpected null client socket found for cid %s. T59653729",
entry.first.toString().c_str());
}
}
if (sockets_closed) {
RATELIMIT_WARNING(
Expand Down

0 comments on commit e342d16

Please sign in to comment.