From: shangfufei Date: Mon, 9 Apr 2018 06:56:24 +0000 (+0800) Subject: msg/async: bug fix 23600 by setting _fd = 1. X-Git-Tag: v15.1.0~2893^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9887245b4092ac5c9eaed4b3b42dc42e6891a3f2;p=ceph-ci.git msg/async: bug fix 23600 by setting _fd = 1. After listen_socket was closed, it entered the start() processf magically. so I think we should make '_fd = -1' when listen_socket was closed. And in the start process, determine the value of listen_socket, if it equal to -1, return the process. Fixes: https://tracker.ceph.com/issues/23600 Signed-off-by: shangfufei Signed-off-by: Greg Farnum --- diff --git a/src/msg/async/AsyncMessenger.cc b/src/msg/async/AsyncMessenger.cc index cf443eedd65..6b2fb1c77f2 100644 --- a/src/msg/async/AsyncMessenger.cc +++ b/src/msg/async/AsyncMessenger.cc @@ -156,7 +156,11 @@ void Processor::start() // start thread worker->center.submit_to(worker->center.get_id(), [this]() { for (auto& l : listen_sockets) { - if (l) { + if (l) { + if (l.fd() == -1) { + ldout(msgr->cct, 1) << __func__ << " Erro: processor restart after listen_socket.fd closed. " << this << dendl; + return; + } worker->center.create_file_event(l.fd(), EVENT_READABLE, listen_handler); } } diff --git a/src/msg/async/PosixStack.cc b/src/msg/async/PosixStack.cc index 2757ce8b545..5a364b8fbe0 100644 --- a/src/msg/async/PosixStack.cc +++ b/src/msg/async/PosixStack.cc @@ -180,6 +180,7 @@ class PosixServerSocketImpl : public ServerSocketImpl { int accept(ConnectedSocket *sock, const SocketOptions &opts, entity_addr_t *out, Worker *w) override; void abort_accept() override { ::close(_fd); + _fd = -1; } int fd() const override { return _fd;