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

Race condition in awaitdata_getmore_cmd.js

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.4, 3.7.3
    • Affects Version/s: 3.6.0-rc4
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v3.6
    • Query 2018-03-12, Query 2018-03-26
    • 0

      awaitdata_getmore_cmd.js can encounter an assert.soon() failure in the following code if the time it takes to start the parallelShell exceeds the 4 second maxTimeMS set on the awaitData getMore:

      // getMore should time out if we insert a non-matching document.
      let insertshell = startParallelShell(function() {
          assert.soon(function() {
              return db.currentOp({op: "getmore", "command.collection": "await_data"})
                         .inprog.length == 1;
          });
          assert.writeOK(db.await_data.insert({x: 0}));
      }, mongo.port);
      
      now = new Date();
      cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 4000});
      assert.commandWorked(cmdRes);
      assert.gt(cmdRes.cursor.id, NumberLong(0));
      assert.eq(cmdRes.cursor.ns, coll.getFullName());
      assert.eq(cmdRes.cursor.nextBatch.length, 0);
      assert.gte((new Date()) - now,
                 // SERVER-31502 Add some leniency here since our server-side wait may be woken up
                 // spuriously.
                 3900,
                 "Insert not matching filter caused awaitData getMore to return prematurely.");
      insertshell();
      

            Assignee:
            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            Reporter:
            james.wahlin@mongodb.com James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: