Skip to content

https.request, https.get memory leak #37068

Open
@noa-ru

Description

@noa-ru

Hello all, it's a leak , right?
Simple code:

const https = require('https');

setInterval(function () {
    console.log(process.memoryUsage().rss);
    req();
    req();
    req();
}, 1000);

function req() {
    return https.get('https://www.google.com/', (res) => {
        console.log('statusCode:', res.statusCode);
    }).on('error', (e) => {
        console.error(e);
    });
}

rss, virt grow very quickly. i tried running GC manually too, but rss,virt does not decrease.
On production i use a 1 minute interval for 3 http-calls and in end of week i see, how oom-killer kill the node process.

node: v13.14.0
platform:
(prod): Linux 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
(dev): Linux 4.15.0-130-generic #134-Ubuntu SMP Tue Jan 5 20:46:26 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

looks like this, only outgoing connections(and other node version) #31285
in profiler i too see like this: #31285 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpsIssues or PRs related to the https subsystem.memoryIssues and PRs related to the memory management or memory footprint.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions