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

SBE plans may trigger stack overflow

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • v5.0
    • Query Execution 2021-05-31, Query Execution 2021-06-14
    • 137

      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.

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

              Created:
              Updated:
              Resolved: