{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/40466087","id":40466087,"diff_hunk":"@@ -526,7 +527,14 @@ OutgoingMessage.prototype.end = function(data, encoding, callback) {\n \n   var self = this;\n   function finish() {\n-    self.emit('finish');\n+    // NOTE: It is very important to wait for `prefinish` event.\n+    // It is emitted only when the response becomes active in the pipeline.\n+    // The ordering of requests/responses in `_http_server.js` is dependent\n+    // on this, doing it in different order will result in crash.\n+    if (self._prefinish)\n+      self.emit('finish');\n+    else\n+      self.on('prefinish', finish);","path":"lib/_http_outgoing.js","position":20,"original_position":20,"commit_id":"23b911d9555a6fc3edef570923473482d4e5a348","original_commit_id":"23b911d9555a6fc3edef570923473482d4e5a348","user":{"login":"indutny","id":238531,"avatar_url":"https://avatars.githubusercontent.com/u/238531?v=3","gravatar_id":"","url":"https://api.github.com/users/indutny","html_url":"https://github.com/indutny","followers_url":"https://api.github.com/users/indutny/followers","following_url":"https://api.github.com/users/indutny/following{/other_user}","gists_url":"https://api.github.com/users/indutny/gists{/gist_id}","starred_url":"https://api.github.com/users/indutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indutny/subscriptions","organizations_url":"https://api.github.com/users/indutny/orgs","repos_url":"https://api.github.com/users/indutny/repos","events_url":"https://api.github.com/users/indutny/events{/privacy}","received_events_url":"https://api.github.com/users/indutny/received_events","type":"User","site_admin":false},"body":"It is not about calling twice. It is about the order of events. The check handles the case where `finish` is emitted before the `prefinish` was emitted.","created_at":"2015-09-25T19:17:54Z","updated_at":"2015-09-25T19:17:54Z","html_url":"https://github.com/nodejs/node/pull/3059#discussion_r40466087","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/3059","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/40466087"},"html":{"href":"https://github.com/nodejs/node/pull/3059#discussion_r40466087"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/3059"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/3059","id":45980735,"html_url":"https://github.com/nodejs/node/pull/3059","diff_url":"https://github.com/nodejs/node/pull/3059.diff","patch_url":"https://github.com/nodejs/node/pull/3059.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/3059","number":3059,"state":"open","locked":false,"title":"http_server: correct order `prefinish`=>`finish`","user":{"login":"indutny","id":238531,"avatar_url":"https://avatars.githubusercontent.com/u/238531?v=3","gravatar_id":"","url":"https://api.github.com/users/indutny","html_url":"https://github.com/indutny","followers_url":"https://api.github.com/users/indutny/followers","following_url":"https://api.github.com/users/indutny/following{/other_user}","gists_url":"https://api.github.com/users/indutny/gists{/gist_id}","starred_url":"https://api.github.com/users/indutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indutny/subscriptions","organizations_url":"https://api.github.com/users/indutny/orgs","repos_url":"https://api.github.com/users/indutny/repos","events_url":"https://api.github.com/users/indutny/events{/privacy}","received_events_url":"https://api.github.com/users/indutny/received_events","type":"User","site_admin":false},"body":"It is very important to wait for `prefinish` event.\r\nIt is emitted only when the response becomes active in the pipeline.\r\nThe ordering of requests/responses in `_http_server.js` is dependent\r\non this, doing it in different order will result in crash.\r\n\r\nFix: https://github.com/nodejs/node/issues/2639\r\n\r\ncc @nodejs/collaborators @trevnorris @rvagg \r\n\r\nThis is very important bug fix. We should consider reviewing it **very carefully**, and merging ASAP (after users will confirm that it fixes stuff for them).","created_at":"2015-09-25T06:26:41Z","updated_at":"2015-09-25T19:17:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d4facc74d106f82c2f5ac3bdd479c7906baa65f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/3059/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/3059/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/3059/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/23b911d9555a6fc3edef570923473482d4e5a348","head":{"label":"indutny:fix/gh-2639","ref":"fix/gh-2639","sha":"23b911d9555a6fc3edef570923473482d4e5a348","user":{"login":"indutny","id":238531,"avatar_url":"https://avatars.githubusercontent.com/u/238531?v=3","gravatar_id":"","url":"https://api.github.com/users/indutny","html_url":"https://github.com/indutny","followers_url":"https://api.github.com/users/indutny/followers","following_url":"https://api.github.com/users/indutny/following{/other_user}","gists_url":"https://api.github.com/users/indutny/gists{/gist_id}","starred_url":"https://api.github.com/users/indutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indutny/subscriptions","organizations_url":"https://api.github.com/users/indutny/orgs","repos_url":"https://api.github.com/users/indutny/repos","events_url":"https://api.github.com/users/indutny/events{/privacy}","received_events_url":"https://api.github.com/users/indutny/received_events","type":"User","site_admin":false},"repo":{"id":27231488,"name":"io.js","full_name":"indutny/io.js","owner":{"login":"indutny","id":238531,"avatar_url":"https://avatars.githubusercontent.com/u/238531?v=3","gravatar_id":"","url":"https://api.github.com/users/indutny","html_url":"https://github.com/indutny","followers_url":"https://api.github.com/users/indutny/followers","following_url":"https://api.github.com/users/indutny/following{/other_user}","gists_url":"https://api.github.com/users/indutny/gists{/gist_id}","starred_url":"https://api.github.com/users/indutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indutny/subscriptions","organizations_url":"https://api.github.com/users/indutny/orgs","repos_url":"https://api.github.com/users/indutny/repos","events_url":"https://api.github.com/users/indutny/events{/privacy}","received_events_url":"https://api.github.com/users/indutny/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/indutny/io.js","description":"Evented IO for V8 JavaScript","fork":true,"url":"https://api.github.com/repos/indutny/io.js","forks_url":"https://api.github.com/repos/indutny/io.js/forks","keys_url":"https://api.github.com/repos/indutny/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/indutny/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/indutny/io.js/teams","hooks_url":"https://api.github.com/repos/indutny/io.js/hooks","issue_events_url":"https://api.github.com/repos/indutny/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/indutny/io.js/events","assignees_url":"https://api.github.com/repos/indutny/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/indutny/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/indutny/io.js/tags","blobs_url":"https://api.github.com/repos/indutny/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/indutny/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/indutny/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/indutny/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/indutny/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/indutny/io.js/languages","stargazers_url":"https://api.github.com/repos/indutny/io.js/stargazers","contributors_url":"https://api.github.com/repos/indutny/io.js/contributors","subscribers_url":"https://api.github.com/repos/indutny/io.js/subscribers","subscription_url":"https://api.github.com/repos/indutny/io.js/subscription","commits_url":"https://api.github.com/repos/indutny/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/indutny/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/indutny/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/indutny/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/indutny/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/indutny/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/indutny/io.js/merges","archive_url":"https://api.github.com/repos/indutny/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/indutny/io.js/downloads","issues_url":"https://api.github.com/repos/indutny/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/indutny/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/indutny/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/indutny/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/indutny/io.js/labels{/name}","releases_url":"https://api.github.com/repos/indutny/io.js/releases{/id}","created_at":"2014-11-27T15:38:33Z","updated_at":"2015-02-18T15:41:43Z","pushed_at":"2015-09-25T06:44:05Z","git_url":"git://github.com/indutny/io.js.git","ssh_url":"git@github.com:indutny/io.js.git","clone_url":"https://github.com/indutny/io.js.git","svn_url":"https://github.com/indutny/io.js","homepage":null,"size":145833,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"v0.12"}},"base":{"label":"nodejs:master","ref":"master","sha":"36b969ff44b8ffca22480c70343cf85651eb235e","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-25T18:48:57Z","pushed_at":"2015-09-25T18:59:13Z","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":340460,"stargazers_count":15485,"watchers_count":15485,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1386,"mirror_url":null,"open_issues_count":465,"forks":1386,"open_issues":465,"watchers":15485,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/3059"},"html":{"href":"https://github.com/nodejs/node/pull/3059"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/3059"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/3059/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/3059/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/3059/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/23b911d9555a6fc3edef570923473482d4e5a348"}}}}