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

XMLWordPrintableJSON

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

      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
              Reporter:
              Suganthi Mani
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: