-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Description
Describe the bug
I observe a potential memory leak while posting data from a stream using Axios.
To Reproduce
Having a fake server (nc -kl localhost 5000), let's profile this simple script:
mprof run -C -T1 timeout 60 node test_axios.js < /dev/urandom// test_axios.js
const axios = require("axios");
const followRedirects = require("follow-redirects");
followRedirects.maxBodyLength = Number.MAX_SAFE_INTEGER;
axios.post("http://localhost:5000", process.stdin);This produces the following chart:

Expected behavior
Then consider the following equivalent axios-agnostic script:
const http = require("http");
const options = {
host: "localhost",
port: "5000",
path: "/",
method: "POST"
};
const req = http.request(options, res => {});
process.stdin.pipe(req);Here the memory is properly garbaged.
Environment:
- Axios Version [e.g. 0.19.2]
- OS: Ubuntu 18.04.4
- Profiling tool: memory-profiler
Metadata
Metadata
Assignees
Labels
No labels
