{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/24857","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/24857/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/24857/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/24857/events","html_url":"https://github.com/nodejs/node/issues/24857","id":387974042,"node_id":"MDU6SXNzdWUzODc5NzQwNDI=","number":24857,"title":"Memory leak in http","user":{"login":"mike-marcacci","id":690517,"node_id":"MDQ6VXNlcjY5MDUxNw==","avatar_url":"https://avatars1.githubusercontent.com/u/690517?v=4","gravatar_id":"","url":"https://api.github.com/users/mike-marcacci","html_url":"https://github.com/mike-marcacci","followers_url":"https://api.github.com/users/mike-marcacci/followers","following_url":"https://api.github.com/users/mike-marcacci/following{/other_user}","gists_url":"https://api.github.com/users/mike-marcacci/gists{/gist_id}","starred_url":"https://api.github.com/users/mike-marcacci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mike-marcacci/subscriptions","organizations_url":"https://api.github.com/users/mike-marcacci/orgs","repos_url":"https://api.github.com/users/mike-marcacci/repos","events_url":"https://api.github.com/users/mike-marcacci/events{/privacy}","received_events_url":"https://api.github.com/users/mike-marcacci/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-05T22:28:44Z","updated_at":"2018-12-05T22:58:58Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nThank you for reporting a possible bug in Node.js.\r\n\r\nPlease fill in as much of the template below as you can.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)\r\nSubsystem: if known, please specify the affected core module name\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you can.\r\n-->\r\n\r\n* **Version**: v11.3.0\r\n* **Platform**: Darwin Mikes-MacBook-Pro.local 18.2.0 Darwin Kernel Version 18.2.0: Fri Oct  5 19:41:49 PDT 2018; root:xnu-4903.221.2~2/RELEASE_X86_64 x86_64\r\n* **Subsystem**: http\r\n\r\n<!-- Please provide more details below this comment. -->\r\nI've been trying to diagnose a memory leak, and have reduced it to the most basic use of `http.createServer()`:\r\n\r\n```js\r\nrequire(\"http\")\r\n  .createServer((req, res) => {\r\n    res.writeHead(200, { \"Content-Type\": \"text/plain\" });\r\n    res.end(\"TEST\");\r\n  })\r\n  .listen(3000);\r\n```\r\n\r\n```sh\r\ncurl -H 'Connection: close' 'http://localhost:3000' > /dev/null;\r\n```\r\n\r\nThe memory profiler shows additional (system) and (array) types added with with each request, even after manually triggering GC.\r\n\r\nMost of the added (array) objects were retained by `emitInitNative` in `async_hooks.js`; most of the (system) objects were retained by either `ReadableState` or `WritableState`.\r\n\r\nTo make sure this wasn't actually *caused* by using the `--inspect`, I ran  requests in a loop, and could watch the process's memory increase rapidly, never decreasing after I stopped. I didn't have much memory pressure, though, so I'm not certain GC was ever triggered.\r\n\r\nI'm not an expert here, but the reproduction is so simple I figure somebody here can quickly confirm if this is a red herring or a real problem."},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/444684096","html_url":"https://github.com/nodejs/node/issues/24857#issuecomment-444684096","issue_url":"https://api.github.com/repos/nodejs/node/issues/24857","id":444684096,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDY4NDA5Ng==","user":{"login":"bnoordhuis","id":275871,"node_id":"MDQ6VXNlcjI3NTg3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/275871?v=4","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T22:58:58Z","updated_at":"2018-12-05T22:58:58Z","author_association":"MEMBER","body":"`--inspect` causes a number of things to be retained for a long time, sometimes forever.\r\n\r\nYou can track GC with `--trace_gc` and (optionally) `--trace_gc_verbose`. There's no memory leak unless the process actually dies with an OOM error after some time, but that would be surprising.\r\n\r\nRSS or VMEM growing is not a reliable indicator, that's just the GC resizing the heap so it doesn't have to sweep as often."}}
{"actor":{"display_login":"bnoordhuis"}}