Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when writeStream close/error #280

Open
devalshah40 opened this issue Jul 17, 2019 · 1 comment
Open

Memory leak when writeStream close/error #280

devalshah40 opened this issue Jul 17, 2019 · 1 comment

Comments

@devalshah40
Copy link

Hi @tomas ,

We have tried with below code and file descriptor remains opens.

var os = require('os');
var fs = require('fs');
var path = require('path');
var needle = require('needle');

var url = 'https://sample-videos.com/video123/mp4/360/big_buck_bunny_360p_30mb.mp4';
var output_path = path.join(__dirname, path.basename(url) + Math.random().toString());

var writeStream = fs.createWriteStream(output_path);

var readStream = needle.get(url);
readStream.pipe(writeStream);

setTimeout(function () {
    writeStream.close();
}, 2000);

//to keep the server alive for few mins
setTimeout(function () {
}, 99999999);

We are using needle version 2.4.0, node version v10.15.3 and OS version Ubuntu 16.04.6 LTS

I have checked with lsof -i -n -l -P -s -T qs | grep node command and its remain open.

Selection_168

I think it is very serious memory leak issue if we are using needle in large scale.

@sitanshu-zymr
Copy link

Yes, @devalshah40 I am seeing the similar issue especially in case of error and connection lost. Its consumes heavy memory on node.js.

cc: @tomas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants