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

CollectionBulkLoader::insertDocuments() should be called with the collection cloner mutex held to guarantee memory and thread safety properties.

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.3
    • Affects Version/s: None
    • Component/s: Replication
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Repl 2019-12-16, Repl 2019-12-30, Repl 2020-01-13
    • 58

      After this commit, CollectionBulkLoader::insertDocuments() (storage document/ external sorter insertion) is not called with collection cloner mutex held. As a result, we can hit data inconsistency and buffer overflow issues.

      Data inconsistency can occur because this CollectionBulkLoader::insertDocuments() is not thread-safe function.
      Buffer overflow can occur when the reads (returned from sync source) are much faster than the writes (document insertion). As a result, CollectionCloner::_documentsToInsert buffer can overflow and lead to OOM issue.

      Note: I was able to see this buffer overflow, lead to server crash, when I tried to disable readOnce cursor on initial sync logkeeper workload.

            Assignee:
            matthew.russotto@mongodb.com Matthew Russotto
            Reporter:
            suganthi.mani@mongodb.com Suganthi Mani
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: