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

ReadableCursorStream throwing uncatchable error when connection is already closed

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.7.0
    • Component/s: Change Streams
    • 0
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Use Case

      As a software developer
      I want the mongodb driver to not throw an uncatchable error 
      So that my code will function in production

      User Impact

      • uncatchable error will crash production servers and impact all users of that service

      Dependencies

      • none

       

      FIX:
      In abstract_cursor.ts the `_destroy()` needs to change from:

      override _destroy(error: Error | null, callback: (error?: Error | null) => void): void { 
      // eslint-disable-next-line github/no-then
          this._cursor.close().then(() => callback(error),closeError => callback(closeError) ); 
      } 

      TO:

      override _destroy(error: Error | null, callback: (error?: Error | null) => void): void {    
          // eslint-disable-next-line github/no-then
          if (!this._cursor.closed) { 
              this._cursor.close().then(() => callback(error),closeError => callback(closeError)    );  
          }
      }

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            jacob@highdeserttechnologies.com Jacob Locken
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: