You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
We've been tracking down a memory leak that's been occurring in some of our node apps for a few days, and we've been able to produce a test case that rapidly leaks memory whenever there is a certificate error. This eventually leads to the node process crashing when deployed. The test case presented here uses a server with a self signed certificate.
Client that memory leaks:
var https = require("https");
function tick() {
var req = https.request({
hostname: "localhost",
port: 8000,
path: "/",
method: "GET"
}, function(response){
throw new Error("This test case should hit something with an invalid certificate, execution should not reach here.");
});
req.end();
//make sure something is pulling data out, just to be use.
req.on("data", function(){})
req.on('error', function(err) {
console.log("request made, err was " + err);
});
global.gc(); //force the gc to run to increase signal to noise ratio.
}
setInterval(tick, 10);
Server:
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('./key.pem'),
cert: fs.readFileSync('./cert.pem')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
gcharnock
changed the title
Memory leak when hitting a site over http with invalid certificates.
Memory leak when hitting a site over https with invalid certificates.
Jul 7, 2015
I'm sorry about the lack of a response on this. Thanks for the easily reproduceable test case - I can confirm this occurs on 0.12.7, where the heap grows uncontrollably, but it does not occur on master (v4). I'll be looking into this but if this is an issue for any of you, you can probably upgrade to v4 and not have this issue occur.
We've been tracking down a memory leak that's been occurring in some of our node apps for a few days, and we've been able to produce a test case that rapidly leaks memory whenever there is a certificate error. This eventually leads to the node process crashing when deployed. The test case presented here uses a server with a self signed certificate.
Client that memory leaks:
Server:
Script to run both:
The node version is v0.12.5
The text was updated successfully, but these errors were encountered: