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

Don't try to close connected sockets at shutdown

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.4
    • Affects Version/s: None
    • Component/s: Networking
    • Labels:
      None
    • Fully Compatible
    • Platforms 12 (04/01/16)
    • 0

      Our current behavior is non-deterministic. We create a detached thread to close connected sockets, but don't ensure that the thread ever even starts before we go on to terminate the process. As a result, we may close no sockets, some sockets, or all of the sockets.

      Due to a bug in ASAN (see linked tickets), we currently also end up reporting a false positive memory leak in the event that we terminate the process before the detached thread begins working.

      We could join the thread, waiting for it to finish shutting down all sockets, but this could take a very long time in some cases (the reason the background thread was originally introduced). We could also give the thread a grace period of time, and then detach it if it hasn't finished, but that doesn't really solve anything - we still wouldn't be assured that the thread had started, and we still wouldn't be sure that we had closed all of the sockets, so the situation would still be non-deterministic.

      Given that, our current thinking is that it is better to just terminate the process and let the OS clean up the sockets for us.

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: