]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async: bug fix 23600 by setting _fd = 1.
authorshangfufei <shangfufei@inspur.com>
Mon, 9 Apr 2018 06:56:24 +0000 (14:56 +0800)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 17 Apr 2019 15:28:00 +0000 (08:28 -0700)
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 <shangfufei@inspur.com>
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/msg/async/AsyncMessenger.cc
src/msg/async/PosixStack.cc

index cf443eedd65c97fb0b9f83e4f0e2d0b54fe896d0..6b2fb1c77f2ed9646c5a9097eb0d17981b71b033 100644 (file)
@@ -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); }
       }
index 2757ce8b545e3c9b9527091b9c90be3eec0145c0..5a364b8fbe09269317226b45c5b49b0f833ab4c7 100644 (file)
@@ -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;