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

Using multiple changeStream cursors causes a segfault

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 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

      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@mongodb.com Matthew Russotto
            Reporter:
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: