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

Removing objects from under a geo $near query causes invalid memory access

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.0-rc6
    • Affects Version/s: 2.8.0-rc5
    • Component/s: Geo, Querying
    • Fully Compatible
    • ALL
    • Hide
      t = db.geo_near
      t.drop();
      
      for (var x = -1; x < 1; x += 1) {
          for (var y = -1; y < 1; y += 1) {
              t.insert({geo: [x, y]})
          }
      }
      
      t.ensureIndex({ geo : "2d" })
      
      var cur = t.find({geo: {$near: [0,0], $maxDistance: 3}}).batchSize(2);
      cur.next();
      cur.next();
      t.remove({})
      cur.next();
      
      Show
      t = db.geo_near t.drop(); for ( var x = -1; x < 1; x += 1) { for ( var y = -1; y < 1; y += 1) { t.insert({geo: [x, y]}) } } t.ensureIndex({ geo : "2d" }) var cur = t.find({geo: {$near: [0,0], $maxDistance: 3}}).batchSize(2); cur.next(); cur.next(); t.remove({}) cur.next();

      It seems like the GEO_NEAR_2D stage fails to realize when an object is removed from under it, see repro below. This only causes a failure on an MMAPV1 Node, no issues on a wiredTiger node, or a 2.6.6 node. Log attached.

        1. mongod.log
          10 kB
          Charlie Swanson

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: