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

$bucketAuto does not account the memory used while running accumulator

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.8.0
    • None
    • None
    • Fully Compatible
    • ALL
    • Hide

      coll.drop();
      for (let i = 0; i < 500; ++i) {
          for (let j = 0; j < 10; ++j) {
              assert.commandWorked(coll.insert({groupBy: i}));
          }
      }
       
      const res = coll.aggregate([
                    {
                        $bucketAuto: {
                            groupBy: "$groupBy",
                            buckets: 500,
                           // This should create an array of 10MB size for each group, resulting in 5GB of memory usage overall.
                            output: {arr: {$push: "a".repeat(1000000)}} 
                        }
                    },
                    {$count: "c"}
                ])
                .toArray();
      

      Show
      coll.drop(); for (let i = 0 ; i < 500 ; ++i) { for (let j = 0 ; j < 10 ; ++j) { assert .commandWorked(coll.insert({groupBy: i})); } }   const res = coll.aggregate([ { $bucketAuto: { groupBy: "$groupBy" , buckets: 500 , // This should create an array of 10MB size for each group, resulting in 5GB of memory usage overall. output: {arr: {$push: "a" .repeat( 1000000 )}} } }, {$count: "c" } ]) .toArray();
    • Query 2020-08-24, Query 2020-09-07, Query 2020-09-21

    Description

      We account the memory used while running the sorter but not when running the accumulator. This could result in server consuming unlimited amount of memory while executing an aggregate command.

      Attachments

        Activity

          People

            arun.banala@mongodb.com Arun Banala
            arun.banala@mongodb.com Arun Banala
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: