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

SBE plans may trigger stack overflow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 5.1.0-rc0
    • None
    • Fully Compatible
    • ALL
    • v5.0
    • Query Execution 2021-05-31, Query Execution 2021-06-14
    • 137

    Description

      filterObj = {}; for (let i = 0; i < 225; ++i) { filterObj["foo" + i] = 123; }
      db.coll.runCommand({explain: {find: "coll", filter: filterObj}}) 

      This was enough to trigger it on an optimized build on my machine. An unoptimized build will likely fair worse.

      The implicit ANDs in the filter are translated in a way which makes each clause of the AND a child of the previous one (instead of a sibling). This is known as the "top level AND optimization." With such a deep tree, when each stack frame is large, it is quite easy to overflow.

      Attachments

        Issue Links

          Activity

            People

              ian.boros@mongodb.com Ian Boros
              ian.boros@mongodb.com Ian Boros
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: