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

stack overflow when comparing deeply nested bson objects

    XMLWordPrintableJSON

Details

    • Query
    • ALL

    Description

      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.                     

      Attachments

        Activity

          People

            backlog-server-query Backlog - Query Team (Inactive)
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: