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

Memory leak uploading files with openUploadStream (GridFSBucked)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker - P1
    • Resolution: Fixed
    • 2.1.4
    • 2.1.5
    • MongoDB 3.2
    • 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

            valeri.karpov@mongodb.com Valeri Karpov
            victorherraiz VĂ­ctor Herraiz Posada
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: