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

Memory leak uploading files with openUploadStream (GridFSBucked)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Fixed
    • Affects Version/s: 2.1.4
    • Fix Version/s: 2.1.5
    • Component/s: MongoDB 3.2
    • Labels:
    • Environment:
      OSX 10.11.2 and Windows 7, node 4.2.x, mongodb 3.2/3.0.x

      Description

      Mongo driver do not seem to free used buffers while/after upload a file.
      I tried with >2GB files y seems to keep double the file size memory.

      I use the following code for my tests:

      "use strict";
      const
          mongodb = require("mongodb"),
          GridFSBucket = mongodb.GridFSBucket,
          MongoClient = mongodb.MongoClient,
          fs = require("fs");
       
      MongoClient.connect("mongodb://localhost:27017/test").then(function (db) {
          const bucket = new GridFSBucket(db),
              readStream = fs.createReadStream("./bigfile.dat"),
              uploadStream = bucket.openUploadStream("bigfile.dat"),
          uploadStream.once("finish", function () {
              console.log(uploadStream.id);
          });
       
          readStream.pipe(uploadStream);
      });
      

      I do not close db to keep the process open.

      is it something wrong with the test?

      Regards,

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: