Using multiple changeStream cursors causes a segfault

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.5.12
    • Affects Version/s: 3.5.11
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • 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.
    • Repl 2017-08-21
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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).

            Assignee:
            Matthew Russotto
            Reporter:
            Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: