ExceededMemoryLimit on Query

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Declined
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hi all,
      We have recently updated from MongoDb 8.0.4 to 8.0.5 and noticed, that some of our queries keep failing with following error message:
      ```

      {"code": 146, "codeName": "ExceededMemoryLimit", "errmsg": "PlanExecutor error during aggregation :: caused by :: $map would use too much memory and cannot spil..."}

      ```

      Our queries execute aggregations (please see example below).
      What has changed, that we're exceeding the memory limit?

      We haven't changed the configuration at all.
      What would be a proper way to solve this situation?

      Example:
      ```

      db.myCollection.aggregate([
      { $sample: \{ size: 1 } },
      { $unset: "_id" },
      {
      $project: {
      matches: {
      $map: {
      input: \{ $range: [0, 50000] },
      in: "$$ROOT"
      }
      }
      }
      },
      { $unwind: "$matches" },
      { $replaceRoot: \{ newRoot: "$matches" } },
      { $merge: \{ into: "myCollection" } }
      ])
      

      Explain:

      serverInfo: {
      host: 'caas-mongo-0',
      port: 27017,
      version: '8.0.4',
      gitVersion: 'bc35ab4305d9920d9d0491c1c9ef9b72383d31f9'
      },
      serverParameters: {
      internalQueryFacetBufferSizeBytes: 104857600,
      internalQueryFacetMaxOutputDocSizeBytes: 104857600,
      internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
      internalDocumentSourceGroupMaxMemoryBytes: 104857600,
      internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
      internalQueryProhibitBlockingMergeOnMongoS: 0,
      internalQueryMaxAddToSetBytes: 104857600,
      internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
      internalQueryFrameworkControl: 'trySbeRestricted',
      internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
      }
      

      Please let me know if you need additional information.

      Misc:
      Could this be related to SERVER-90068 (included in v8.0.5) ?

              Assignee:
              Unassigned
              Reporter:
              Nicolai McAlley
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: