{"action":"closed","issue":{"url":"https://api.github.com/repos/findhit/proxywrap/issues/15","labels_url":"https://api.github.com/repos/findhit/proxywrap/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/findhit/proxywrap/issues/15/comments","events_url":"https://api.github.com/repos/findhit/proxywrap/issues/15/events","html_url":"https://github.com/findhit/proxywrap/issues/15","id":125603023,"number":15,"title":"Under stress, some connections keep open","user":{"login":"revington","id":91995,"avatar_url":"https://avatars.githubusercontent.com/u/91995?v=3","gravatar_id":"","url":"https://api.github.com/users/revington","html_url":"https://github.com/revington","followers_url":"https://api.github.com/users/revington/followers","following_url":"https://api.github.com/users/revington/following{/other_user}","gists_url":"https://api.github.com/users/revington/gists{/gist_id}","starred_url":"https://api.github.com/users/revington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/revington/subscriptions","organizations_url":"https://api.github.com/users/revington/orgs","repos_url":"https://api.github.com/users/revington/repos","events_url":"https://api.github.com/users/revington/events{/privacy}","received_events_url":"https://api.github.com/users/revington/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-08T12:31:43Z","updated_at":"2016-01-18T14:41:45Z","closed_at":"2016-01-18T14:41:45Z","body":"Under stress some connections will stay on CLOSE_WAIT state.\r\n\r\nTo reproduce the issue:\r\n\r\n\r\n`$ node close-wait.js` close-wait.js below\r\n`$ wrk --latency -t4 -c400 -d30s \"http://localhost:8000\"`\r\n\r\n```\r\n$ ss -e | grep 8000 | grep CLOSE\r\ntcp    CLOSE-WAIT 0      0            127.0.0.1:8000          127.0.0.1:40084    uid:1000 ino:2562644 sk:ffff8803a9e2db00 -->\r\n```\r\n\r\nEverytime I run the stress test a new connection (the first one) remains in CLOSE_WAIT state\r\n\r\nclose-wait.js\r\n```\r\n'use strict';\r\nvar cluster = require('cluster');\r\nvar http = require('http');\r\nvar numCPUs = require('os').cpus().length;\r\nvar proxiedHttp = require('findhit-proxywrap').proxy(http, {\r\n    strict: false\r\n});\r\nvar i;\r\n\r\nif (cluster.isMaster) {\r\n    // Fork workers.\r\n    for (i = 0; i < numCPUs; i++) {\r\n        cluster.fork();\r\n    }\r\n\r\n} else {\r\n\r\n    // Workers can share any TCP connection\r\n    // In this case it is an HTTP server\r\n    proxiedHttp.createServer(function handler(req, res) {\r\n        return res.end('ok');\r\n    }).listen(8000);\r\n}\r\n```"}}