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

Don't try to close connected sockets at shutdown

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.4
    • Component/s: Networking
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Platforms 12 (04/01/16)
    • Linked BF Score:
      0

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            acm Andrew Morrow
            Reporter:
            acm Andrew Morrow
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: