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

memory leak in MutableDocument::setNestedField

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.7, 2.5.2
    • Affects Version/s: 2.4.5
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Environment:
      Win2008R2
      3-node replica set
    • Fully Compatible
    • ALL

      Issue Status as of October 23rd, 2013

      ISSUE SUMMARY
      Memory leak in aggregation in MutableDocument::setNestedField

      USER IMPACT
      This leak can manifest in two different scenarios:

      1. Accessing nested fields in the original document fetched from the collection. This leads to a leak of a few hundred bytes per aggregation command. The amount of memory leaked in this case does not depend on the amount of data processed in the aggregation. If the nested fields are only used by a $match expression but not any other pipeline stages, this leak does not apply.
      2. Using a $geoNear pipeline stage and using distanceField or includeLocs to inject information into a nested field. This results in a leak of a few hundred bytes per document returned from geoNear.

      It is present in versions of MongoDB prior to and including v2.4.6.

      SOLUTION
      Fix ref counting of NULL pointers in MutableDocument.

      WORKAROUNDS
      None.

      PATCHES
      Production release v2.4.7 contains the fix for this issue, and production release v2.6.0 will contain the fix as well.

      Original Description

      Aggregation queries are causing memory leak on primary. Detected by comparing umdh memory dumps before and after running aggregation.

      There are two cases in the current codebase that can cause this leak:

      1) Accessing nested fields in the original document fetched from the collection. This leads to a leak of a few hundred bytes per aggregation command. The amount of memory leaked in this case does not depend on the amount of data processed in the aggregation. If the nested fields are only used by a $match expression but not any other pipeline stages, this leak does not apply.

      2) Using a $geoNear pipeline stage and using distanceField or includeLocs to inject information into a nested field. This results in a leak of a few hundred bytes per documented returned from geoNear.

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            alex.komyagin@mongodb.com Alexander Komyagin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: