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

Generating KeyStrings from MultiIndexBlock can result in memory limits not being respected

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 5.2.0, 5.0.4, 5.1.0-rc3
    • Affects Version/s: 5.0.0
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Execution Team 2021-11-15
    • 135

      When generating KeyString keys we use the KeyString::PooledBuilder that places multiple temporary KeyString on the same larger memory block to avoid multiple small allocations. Each KeyString holds a reference to the underlying memory that will not be free'd until all KeyString that is using it has been free'd.

      Normally this is fine as these KeyString are passed to the sorter that spills do disk when the memory consumption reach a certain threshold. As this process clears all temporary KeyString instances all memory blocks should be free'd.

      However, when there are multiple indexes being built at the same time these pooled memory blocks can be shared between KeyString instances belonging to different indexes. If some indexes generate large keys and need to be flushed to disk often the actual memory will not be free'd if there is still an index building that hasn't needed to spill to disk.

            Assignee:
            henrik.edin@mongodb.com Henrik Edin
            Reporter:
            henrik.edin@mongodb.com Henrik Edin
            Votes:
            0 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: