Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-24582

MongoDB secondary node crashes randomly when primary node is killed/dies

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.2.6
    • Fix Version/s: 3.2.8, 3.3.9
    • Component/s: Networking, Replication
    • Labels:
    • Environment:
      FreeBSD 11 CURRENT
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Completed:
    • Sprint:
      Platforms 16 (06/24/16)

      Description

      The crash comes from unhandled exception thrown in ~AsyncStream() destructor, which calls destroyStream() function, which, in turn, calls incorrect version of close() on ASIO socket.

      Relevant code piece from async_stream_common.h

      ....
       
      std::error_code ec;
          stream->shutdown(asio::ip::tcp::socket::shutdown_both, ec);
          stream->close(); // <----- probably meant to call another overload close(ec)
          if (ec) {
              logCloseFailed(ec);
      }
       
      ....
      

      Most likely another close() overload was meant to be used that accepts ec as an argument. The overload used here just throws an exceptions if socket is closed.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: