Skip to content

Memory leak for https.request() on ECONNRESET #8827

@patrickd-

Description

@patrickd-

I experience a memory leak when doing https requests to a host that resets the connection.

Reproduce by

  1. starting node econnreset.js
    econnreset.js.txt
  2. start node leak.js
    leak.js.txt
  3. Observe process memory
    For me it goes up to 600MB with 10000 requests - and stays that way.

Heapdump is small

  1. install node-heapdump (npm install heapdump)
  2. comment in the require('heapdump')
  3. run node econnreset.js and node leak.js
  4. when it's done with the requests (no more CPU usage) execute kill -USR2 $pid.
    The resulting heapdump from a process with 600MB is only 100MB large.

Manual GC call has no effect

  1. comment in global.gc();
  2. start node econnreset.js and node leak.js --expose-gc
  3. when it's done with the requests (no more CPU usage) it will execute the GC every second but the memory usage doesn't change.

Am I using https.request() wrong or is this an internal problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.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