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

Disable SBE for very large queries in v6.0

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.17
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL

      Issue Status as of <October 3, 2024>

      ISSUE DESCRIPTION AND IMPACT
      In MongoDB version 6.0.17, some large aggregation pipelines may return incorrect results, cause a mongod or mongos to crash, or raise an error when it did not previously. Affected aggregation pipelines are those that:

      • Exceed 30,000 bytes in size, and
      • Contain at least one $group and/or $lookup stage near the beginning of the pipeline, potentially preceded by a $match, $project, $addFields or $sort stage

      Affected operations may omit one or more $group or $lookup stages in the aggregation pipeline, resulting in operations that return incorrect results or generate errors.

      DIAGNOSIS AND AFFECTED VERSIONS
      MongoDB Server version 6.0.17 is subject to the bug. No other versions are affected.

      REMEDIATION AND WORKAROUNDS
      Customers are advised to:

      • Upgrade to 6.0.18, or
      • Customers staying on 6.0.17 should set the internalQueryForceClassicEngine parameter to true with the following command:
        db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})
      Original description

      Prior to SPM-2697 (which shipped as part of v7.0), for queries containing hundreds of expressions, the SBE stage builder was prone to generate very deep SBE plan trees in some scenarios. For $group specifically, it's pretty easy to get the SBE stage builder to generate very deep SBE plan trees which will stack overflow during execution (as shown in [^stack-overflow-example-group-query.txt]).

      The goal of this task is to implement a solution to this problem so that these kinds of queries won't crash on v6.0. If v5.0 is affected by this issue, we may also need to backport the fix to v5.0 as well.

            Assignee:
            andrew.paroski@mongodb.com Drew Paroski
            Reporter:
            andrew.paroski@mongodb.com Drew Paroski
            Votes:
            0 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: