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

Gridfs doesn't allow to catch exception with length that exceeds file size

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.5.7
    • Fix Version/s: 3.6.0
    • Component/s: MongoDB 3.4
    • Labels:

      Description

      The issue as follow: you open a download stream using buckets. You inform an end that's greater than the available chunks (which can be caused by data corruption and missing chunks) and the driver throws an uncaught exception. But this exception doesn't seem to be handed to the .on('error') callback nor is thrown in a place where a try-catch seems to be usable.

       

      This is the stack trace:

       

      /home/node/LynxChan/src/be/node_modules/mongodb/lib/utils.js:133
      lynxchan[23793]: throw err;
      lynxchan[23793]: ^
      lynxchan[23793]: Error: Stream end (47869) must not be more than the length of the file (47752)
      lynxchan[23793]: at handleEndOption (/home/node/LynxChan/src/be/node_modules/mongodb/lib/gridfs-stream/download.js:392:13)
      lynxchan[23793]: at /home/node/LynxChan/src/be/node_modules/mongodb/lib/gridfs-stream/download.js:324:26
      lynxchan[23793]: at /home/node/LynxChan/src/be/node_modules/mongodb/lib/operations/execute_operation.js:75:17
      lynxchan[23793]: at /home/node/LynxChan/src/be/node_modules/mongodb/lib/operations/execute_operation.js:64:11
      lynxchan[23793]: at ClientSession.endSession (/home/node/LynxChan/src/be/node_modules/mongodb/lib/core/sessions.js:135:41)
      lynxchan[23793]: at executeCallback (/home/node/LynxChan/src/be/node_modules/mongodb/lib/operations/execute_operation.js:59:17)
      lynxchan[23793]: at handleCallback (/home/node/LynxChan/src/be/node_modules/mongodb/lib/utils.js:129:55)
      lynxchan[23793]: at /home/node/LynxChan/src/be/node_modules/mongodb/lib/operations/find_one.js:28:7
      lynxchan[23793]: at /home/node/LynxChan/src/be/node_modules/mongodb/lib/operations/execute_operation.js:75:17
      lynxchan[23793]: at executeCallback (/home/node/LynxChan/src/be/node_modules/mongodb/lib/operations/execute_operation.js:68:9)

       

      Mongo 4.2, driver version 3.5

        Attachments

          Activity

            People

            Assignee:
            eric.adum Eric Adum
            Reporter:
            sethsauron@gmail.com Stephen Lynx
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: