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

Change Stream cursor throws error if processing an event while the cursor is closing

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.13
    • Affects Version/s: 3.1.10
    • Component/s: None

      I received the below stack trace from a change stream cursor. I believe it occurred because an error event was triggered on the cursor after close was requested (so the changeStream.cursor no longer exists).

      I'm using driver 3.1.10 but tried the latest 3.1.12 and it is still present. As its a timing issue I'm struggling to recreate it consistently, however it might be to do with the close action taking some time and a change coming in while the cursor is closing.

      Have marked as major for now because the stack is fully within mongodb node module making it tricky to catch and ignore in my own code.

       

      Stack TypeError: Cannot read property 'options' of undefined
       at processNewChange (node_modules\mongodb\lib\change_stream.js:372:39)
       at Cursor.<anonymous> (node_modules\mongodb\lib\change_stream.js:272:5)
       at Cursor.emit (events.js:182:13)
       at next (node_modules\mongodb\lib\cursor.js:1013:14)
       at err (node_modules\mongodb\lib\utils.js:415:14)
       at executeCallback (node_modules\mongodb\lib\utils.js:404:25)
       at handleCallback (node_modules\mongodb\lib\utils.js:128:55)
       at cursor._next (node_modules\mongodb\lib\operations\cursor_ops.js:186:21)
       at handleCallback (node_modules\mongodb-core\lib\cursor.js:203:5)
       at node_modules\mongodb-core\lib\cursor.js:659:16
       at queryCallback (node_modules\mongodb-core\lib\wireprotocol\3_2_support.js:280:21)
       at node_modules\mongodb-core\lib\connection\pool.js:532:18
       at process._tickCallback (internal/process/next_tick.js:61:11)
      

       

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            solgarius Nick Beckenham
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: