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

Using multiple changeStream cursors causes a segfault

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.5.11
    • Fix Version/s: 3.5.12
    • Component/s: Replication
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Open the shell and call next() on two changeStream cursors. Code example in the description.

      Show
      Open the shell and call next() on two changeStream cursors. Code example in the description.
    • Epic Link:
    • Sprint:
      Repl 2017-08-21

      Description

      When running on 3.5.11 or nightly the following code run in the shell causes the primary node to segfault.

      use testChangeStreams;
      db.dropDatabase();
       
      // Example 1
      print("1. First cursor value: ");
      db.changes.insertOne({test: "a"});
      var cursor1 = db.changes.aggregate([ { $changeStream: { fullDocument: "none"} } ]);
       
      var next = null;
      if (cursor1.hasNext()) {
          next = cursor1.next();
      }
      printjson(next);
       
      // Example 2
      print("2. Lookup enabled: ");
      var cursor2 = db.changes.aggregate([{$changeStream: {fullDocument: "lookup"} }]);
       
      while (cursor2.hasNext()) {
          next = cursor2.next();
      }
      db.changes.updateOne({test: "a"}, {$set: {test: "b"}});
      next = cursor2.next();  // Segfaults
      printjson(next);
      

      (If testing on 3.5.11 change the aggregation to be $changeNotification).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: