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

Failed collection creation leaves an orphaned entry inside Top data structure

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Query 2020-02-24, Query 2020-03-09
    • Linked BF Score:
      26

      Description

      Instances of various types of operations, along with information about their durations, are tracked for diagnostic purposes in-memory inside the Top data structure. Users can then access this information via the top command or the $collStats agg stage with the "latencyStats" option.

      The code path for creating a new collection records information into Top using the AutoStatsTracker. The AutoStatsTracker's destructor will write an entry into Top by calling Top::record(). The problem is that this destructor will run and add info to Top whether or not the collection creation succeeds. If the collection creation fails, then there will be an entry for a non-existent collection in Top. Worse, attempting to drop this non-existent collection will not clear the extra entry. This could essentially manifest as a memory leak, causing Top's memory footprint to grow over time. This situation can be corrected by restarting the server.

      Another possible symptom is that an attempt to run the "top" command could fail with a BSONObjectTooLarge error (or similarly fail when trying to grow a BufBuilder). Until SERVER-6627 is implemented in order to report top data via a cursor, the command will fail when the top diagnostic data exceeds 16MB. Also, data about non-existent collections will erroneously appear in the top command output.

      Finally, note that we similar diagnosed and fixed a similar issue in related ticket SERVER-45137.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              david.storch David Storch
              Reporter:
              david.storch David Storch
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: