Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1589

MongoError: cursor id 213094726591 not found

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.1.1
    • Component/s: None
    • Environment:
      Windows, Unix as well as far as I can tell.

      Trying to do something like that:

      function drainCursor(cursor, targetCollection, perf) {
        function iterate() {
          return cursor.next()
            .then(function (item) {
              if (!event) {
                cursor.close();
                return;
              }
      
              return targetCollection.insertOne(item)
                .then(() => iterate())
                .catch(err => {
                  Logger.error(err);
                  throw err;
                });
            });
        }
      
        return iterate();
      }
      

      Getting the exception after about 1000 records processed (actual number looks random).

      2018-07-26T14:57:34.334Z : ERROR : root : MongoError: cursor id 213094726591 not found
      Debugger attached.
      Waiting for the debugger to disconnect...
          at x:\censored\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:580:63
          at authenticateStragglers (x:\censored\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:503:16)
          at Connection.messageHandler (x:\censored\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:539:5)
          at emitMessageHandler (x:\censored\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.js:309:10)
          at Socket.<anonymous> (x:\censored\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.js:452:17)
          at emitOne (events.js:116:13)
          at Socket.emit (events.js:211:7)
          at addChunk (_stream_readable.js:263:12)
          at readableAddChunk (_stream_readable.js:250:11)
          at Socket.Readable.push (_stream_readable.js:208:10)
      

      Used to work fine, but not with the latest drivers (tried 3.0.6 and 3.1.1, 3.1.1 appears to crash even sooner)

      After some googling this is how i make a cursor, but it doesn't help either.

      sourceCollection.find(Query).addCursorFlag('noCursorTimeout', true).maxTimeMS(0),
      

      Originally I would run multiple threads of this (on different collections) but it crashes much sooner in this case.

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            sunrize531@gmail.com Ivan Filimonov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: