stack overflow when comparing deeply nested bson objects

XMLWordPrintableJSON

    • Query
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Observed behavior: When mongod compares two deeply nested objects, a stack overflow is triggered. The following example triggers a stack overflow on osx 10.7.4 with both debug and release builds:

      t = db.t;
      t.drop();
      
      function makeNestObj(depth){
          toret = { a : 1};
      
          for(i = 1; i < depth; i++){
              toret = {a : toret};
          }
      
          return toret;
      }
      
      nestedObj = makeNestObj(1500);
      
      // Save two deeply recursive 'a' values, so we can sort them.                               
      t.insert( { a:nestedObj }, true );
      t.insert( { a:nestedObj }, true );
      
      t.find().sort( { a:1 } ).itcount(); // In memory sort triggers a stack overflow.
      
      t.ensureIndex( { a:1 } ); // External sorter triggers a stack overflow.                     
      

              Assignee:
              Backlog - Query Team (Inactive)
              Reporter:
              Aaron Staple (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: