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

Memory leak uploading files with openUploadStream (GridFSBucked)

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

      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,

            Assignee:
            valeri.karpov@mongodb.com Valeri Karpov
            Reporter:
            victor.herraiz@gmail.com VĂ­ctor Herraiz Posada
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: