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

backup query solution for cached plans is leaked in get_executor.cpp

    • Fully Compatible
    • ALL
    • Hide

      Run the following and check for increasing memory usage using a tool such as "top":

      t.drop();
      t.ensureIndex({a: 1});
      t.ensureIndex({b: 1});
      for (var i = 0; i < 20; i++) { t.insert({b: i}); }
      for (var i = 0; i < 20; i++) { t.find({b: 1}).sort({a: 1}).next(); }
      
      Show
      Run the following and check for increasing memory usage using a tool such as "top": t.drop(); t.ensureIndex({a: 1}); t.ensureIndex({b: 1}); for ( var i = 0; i < 20; i++) { t.insert({b: i}); } for ( var i = 0; i < 20; i++) { t.find({b: 1}).sort({a: 1}).next(); }

      A memory leak was introduced in 2.7 versions as part of the refactor from the CachedPlanRunner to the CachedPlanStage. The code linked below calls QueryPlanner::planFromCache(), but fails to cleanup the backup query solution:

      https://github.com/mongodb/mongo/blob/2ea074937c82239d7ae187af879f0352131b119b/src/mongo/db/query/get_executor.cpp#L267-L295

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: