{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/39108424","id":39108424,"diff_hunk":"@@ -477,20 +478,25 @@ function connectionListener(socket) {\n       // if the user never called req.read(), and didn't pipe() or\n       // .resume() or .on('data'), then we call req._dump() so that the\n       // bytes will be pulled off the wire.\n-      if (!req._consuming && !req._readableState.resumeScheduled)\n+      if (!req._consuming && !req._readableState.resumeScheduled) {\n         req._dump();\n+      }\n \n       res.detachSocket(socket);\n+      res._last = outgoing.length === 0;","path":"lib/_http_server.js","position":27,"original_position":27,"commit_id":"4fad2f056b70f102ad53ac717962fcc4409cab93","original_commit_id":"4fad2f056b70f102ad53ac717962fcc4409cab93","user":{"login":"tshemsedinov","id":4405297,"avatar_url":"https://avatars.githubusercontent.com/u/4405297?v=3","gravatar_id":"","url":"https://api.github.com/users/tshemsedinov","html_url":"https://github.com/tshemsedinov","followers_url":"https://api.github.com/users/tshemsedinov/followers","following_url":"https://api.github.com/users/tshemsedinov/following{/other_user}","gists_url":"https://api.github.com/users/tshemsedinov/gists{/gist_id}","starred_url":"https://api.github.com/users/tshemsedinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tshemsedinov/subscriptions","organizations_url":"https://api.github.com/users/tshemsedinov/orgs","repos_url":"https://api.github.com/users/tshemsedinov/repos","events_url":"https://api.github.com/users/tshemsedinov/events{/privacy}","received_events_url":"https://api.github.com/users/tshemsedinov/received_events","type":"User","site_admin":false},"body":"Because in this place _last is not calculated, so when length is 0, _last is not true and res will not processed as last.","created_at":"2015-09-09T23:09:59Z","updated_at":"2015-09-09T23:09:59Z","html_url":"https://github.com/nodejs/node/pull/2534#discussion_r39108424","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/2534","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/39108424"},"html":{"href":"https://github.com/nodejs/node/pull/2534#discussion_r39108424"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/2534"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/2534","id":43242274,"html_url":"https://github.com/nodejs/node/pull/2534","diff_url":"https://github.com/nodejs/node/pull/2534.diff","patch_url":"https://github.com/nodejs/node/pull/2534.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/2534","number":2534,"state":"open","locked":false,"title":"http: fixed socket destruction, timeout and leaking","user":{"login":"tshemsedinov","id":4405297,"avatar_url":"https://avatars.githubusercontent.com/u/4405297?v=3","gravatar_id":"","url":"https://api.github.com/users/tshemsedinov","html_url":"https://github.com/tshemsedinov","followers_url":"https://api.github.com/users/tshemsedinov/followers","following_url":"https://api.github.com/users/tshemsedinov/following{/other_user}","gists_url":"https://api.github.com/users/tshemsedinov/gists{/gist_id}","starred_url":"https://api.github.com/users/tshemsedinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tshemsedinov/subscriptions","organizations_url":"https://api.github.com/users/tshemsedinov/orgs","repos_url":"https://api.github.com/users/tshemsedinov/repos","events_url":"https://api.github.com/users/tshemsedinov/events{/privacy}","received_events_url":"https://api.github.com/users/tshemsedinov/received_events","type":"User","site_admin":false},"body":"* Prevent 2 minutes sockets and memory hanging/leaking after server finished writing last response and connection hang inactive waiting for nothing (it is actual only in keep-alive mode, single HTTP requests does not hanging for 2 minutes, browsers do not reuse them and somehow do not close them too)\r\n* Fixed ```res._last```, because it was not calculated correctly in this place before this PR and as a result ```socket.destroySoon()``` was never executed\r\n* Implemented ```server.keepAliveTimeout``` (default to 5 seconds) in addition to ```server.timeout```\r\n* Prevent firing ```timeout``` event on server for finished and closed sockets\r\n* Removed ```socket.destroySoon()``` because it worked well on ```prefinish``` and have no sense on ```finish```\r\n\r\nMemory usage comparison before and after:\r\n![memory](https://cloud.githubusercontent.com/assets/4405297/9456840/2d74ada8-4ae5-11e5-87e6-4eeca97864cb.png)\r\n\r\nSocket handlers usage comparison before and after:\r\n![sockets](https://cloud.githubusercontent.com/assets/4405297/9456843/320af318-4ae5-11e5-91cd-fd698d0054b5.png)\r\n\r\nTests changed and provided new.\r\nRelated PR: https://github.com/nodejs/node/pull/1411 by @indutny \r\nRelated Issue: https://github.com/joyent/node/issues/3460\r\nArticle about this problem (RU): http://habrahabr.ru/post/264851/","created_at":"2015-08-25T01:59:16Z","updated_at":"2015-09-09T23:09:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"600b4642540346dbc26a6eee22a0b95d00821797","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/2534/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/2534/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/2534/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/4fad2f056b70f102ad53ac717962fcc4409cab93","head":{"label":"tshemsedinov:master","ref":"master","sha":"4fad2f056b70f102ad53ac717962fcc4409cab93","user":{"login":"tshemsedinov","id":4405297,"avatar_url":"https://avatars.githubusercontent.com/u/4405297?v=3","gravatar_id":"","url":"https://api.github.com/users/tshemsedinov","html_url":"https://github.com/tshemsedinov","followers_url":"https://api.github.com/users/tshemsedinov/followers","following_url":"https://api.github.com/users/tshemsedinov/following{/other_user}","gists_url":"https://api.github.com/users/tshemsedinov/gists{/gist_id}","starred_url":"https://api.github.com/users/tshemsedinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tshemsedinov/subscriptions","organizations_url":"https://api.github.com/users/tshemsedinov/orgs","repos_url":"https://api.github.com/users/tshemsedinov/repos","events_url":"https://api.github.com/users/tshemsedinov/events{/privacy}","received_events_url":"https://api.github.com/users/tshemsedinov/received_events","type":"User","site_admin":false},"repo":{"id":40220748,"name":"io.js","full_name":"tshemsedinov/io.js","owner":{"login":"tshemsedinov","id":4405297,"avatar_url":"https://avatars.githubusercontent.com/u/4405297?v=3","gravatar_id":"","url":"https://api.github.com/users/tshemsedinov","html_url":"https://github.com/tshemsedinov","followers_url":"https://api.github.com/users/tshemsedinov/followers","following_url":"https://api.github.com/users/tshemsedinov/following{/other_user}","gists_url":"https://api.github.com/users/tshemsedinov/gists{/gist_id}","starred_url":"https://api.github.com/users/tshemsedinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tshemsedinov/subscriptions","organizations_url":"https://api.github.com/users/tshemsedinov/orgs","repos_url":"https://api.github.com/users/tshemsedinov/repos","events_url":"https://api.github.com/users/tshemsedinov/events{/privacy}","received_events_url":"https://api.github.com/users/tshemsedinov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tshemsedinov/io.js","description":"Future Node.js releases will be based on io.js","fork":true,"url":"https://api.github.com/repos/tshemsedinov/io.js","forks_url":"https://api.github.com/repos/tshemsedinov/io.js/forks","keys_url":"https://api.github.com/repos/tshemsedinov/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tshemsedinov/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tshemsedinov/io.js/teams","hooks_url":"https://api.github.com/repos/tshemsedinov/io.js/hooks","issue_events_url":"https://api.github.com/repos/tshemsedinov/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/tshemsedinov/io.js/events","assignees_url":"https://api.github.com/repos/tshemsedinov/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/tshemsedinov/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/tshemsedinov/io.js/tags","blobs_url":"https://api.github.com/repos/tshemsedinov/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tshemsedinov/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tshemsedinov/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/tshemsedinov/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tshemsedinov/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/tshemsedinov/io.js/languages","stargazers_url":"https://api.github.com/repos/tshemsedinov/io.js/stargazers","contributors_url":"https://api.github.com/repos/tshemsedinov/io.js/contributors","subscribers_url":"https://api.github.com/repos/tshemsedinov/io.js/subscribers","subscription_url":"https://api.github.com/repos/tshemsedinov/io.js/subscription","commits_url":"https://api.github.com/repos/tshemsedinov/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/tshemsedinov/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/tshemsedinov/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/tshemsedinov/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/tshemsedinov/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/tshemsedinov/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tshemsedinov/io.js/merges","archive_url":"https://api.github.com/repos/tshemsedinov/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tshemsedinov/io.js/downloads","issues_url":"https://api.github.com/repos/tshemsedinov/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/tshemsedinov/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/tshemsedinov/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/tshemsedinov/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tshemsedinov/io.js/labels{/name}","releases_url":"https://api.github.com/repos/tshemsedinov/io.js/releases{/id}","created_at":"2015-08-05T02:42:51Z","updated_at":"2015-08-05T02:42:55Z","pushed_at":"2015-09-08T20:52:45Z","git_url":"git://github.com/tshemsedinov/io.js.git","ssh_url":"git@github.com:tshemsedinov/io.js.git","clone_url":"https://github.com/tshemsedinov/io.js.git","svn_url":"https://github.com/tshemsedinov/io.js","homepage":"https://iojs.org","size":144276,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"297b9ae147b590f03597e00d8bb4eee8ea7c347d","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"✨Node.js  ✨","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","created_at":"2014-11-26T19:57:11Z","updated_at":"2015-09-09T23:01:09Z","pushed_at":"2015-09-09T21:55:27Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":208430,"stargazers_count":14380,"watchers_count":14380,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1221,"mirror_url":null,"open_issues_count":389,"forks":1221,"open_issues":389,"watchers":14380,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/2534"},"html":{"href":"https://github.com/nodejs/node/pull/2534"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/2534"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/2534/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/2534/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/2534/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/4fad2f056b70f102ad53ac717962fcc4409cab93"}}}}