Skip to content

http: Memory Leak #26957

Closed
Closed
@ronag

Description

@ronag

Running this will cause the memory usage of the node process to infinitly grow...

  • Version: 10.13.0
  • Platform: OSX
  • Subsystem:
const http = require('http')
const { spawn } = require('child_process')
const crypto = require('crypto')
const fs = require('fs')

const dst = fs.createWriteStream('./tmp')

http.createServer((req, res) => {
  req
    .on('data', buf => {
      if (!dst.write(buf)) {
        req.pause()
      }
    })
  dst.on('drain', () => {
    if (req.readable) {
      req.resume()
    }
  })
}).listen(9988, () => {
  spawn('cat', ['/dev/zero'])
    .stdout
    .pipe(http
      .request({
        hostname: 'localhost',
        port: 9988,
        path: `/file`,
        method: 'POST'
      })
    )
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues or PRs related to the http 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