{"action":"closed","number":7160,"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/7160","id":72627317,"html_url":"https://github.com/nodejs/node/pull/7160","diff_url":"https://github.com/nodejs/node/pull/7160.diff","patch_url":"https://github.com/nodejs/node/pull/7160.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/7160","number":7160,"state":"closed","locked":false,"title":"stream: reset awaitDrain after manual .resume()","user":{"login":"addaleax","id":899444,"avatar_url":"https://avatars.githubusercontent.com/u/899444?v=3","gravatar_id":"","url":"https://api.github.com/users/addaleax","html_url":"https://github.com/addaleax","followers_url":"https://api.github.com/users/addaleax/followers","following_url":"https://api.github.com/users/addaleax/following{/other_user}","gists_url":"https://api.github.com/users/addaleax/gists{/gist_id}","starred_url":"https://api.github.com/users/addaleax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addaleax/subscriptions","organizations_url":"https://api.github.com/users/addaleax/orgs","repos_url":"https://api.github.com/users/addaleax/repos","events_url":"https://api.github.com/users/addaleax/events{/privacy}","received_events_url":"https://api.github.com/users/addaleax/received_events","type":"User","site_admin":false},"body":"##### Checklist\r\n\r\n- [x] tests and code linting passes\r\n- [x] a test and/or benchmark is included\r\n- [x] the commit message follows commit guidelines\r\n\r\n##### Affected core subsystem(s)\r\n\r\nstream\r\n\r\n##### Description of change\r\n\r\nReset the `readableState.awaitDrain` counter after manual calls to `.resume()`.\r\n\r\nWhat might happen otherwise is that a slow consumer at the end of the pipe could end up stalling the piping in the following scenario:\r\n\r\n1. The writable stream indicates that its buffer is full.\r\n2. This leads the readable stream to `pause()` and increase its `awaitDrain` counter, which will be decreased by the writable’s next `drain` event.\r\n3. Something calls `.resume()` manually.\r\n4. The readable continues to pipe to the writable, but once again the writable stream indicates that the buffer is full.\r\n5. The `awaitDrain` counter is thus increased again, but since it has now been increased twice for a single piping destination, the next `drain` event will not be able to reset `awaitDrain` to zero.\r\n6. The pipe is stalled and no data is passed along anymore.\r\n\r\nThe solution in this commit is to reset the `awaitDrain` counter to zero when `resume()` is called.\r\n\r\nFixes: https://github.com/nodejs/node/issues/7159\r\n\r\nThis bug is has been around at least since 0.12, and I don’t currently know why it never popped up before #2325 when the `awaitDrain` mechanism worked like it does today.\r\n\r\n/cc @nodejs/streams ","created_at":"2016-06-05T11:48:29Z","updated_at":"2016-06-13T21:43:39Z","closed_at":"2016-06-13T21:43:38Z","merged_at":null,"merge_commit_sha":"ce3926d337478ed069e78a500ddb257cd2f9bc60","assignee":{"login":"TheAlphaNerd","id":498775,"avatar_url":"https://avatars.githubusercontent.com/u/498775?v=3","gravatar_id":"","url":"https://api.github.com/users/TheAlphaNerd","html_url":"https://github.com/TheAlphaNerd","followers_url":"https://api.github.com/users/TheAlphaNerd/followers","following_url":"https://api.github.com/users/TheAlphaNerd/following{/other_user}","gists_url":"https://api.github.com/users/TheAlphaNerd/gists{/gist_id}","starred_url":"https://api.github.com/users/TheAlphaNerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheAlphaNerd/subscriptions","organizations_url":"https://api.github.com/users/TheAlphaNerd/orgs","repos_url":"https://api.github.com/users/TheAlphaNerd/repos","events_url":"https://api.github.com/users/TheAlphaNerd/events{/privacy}","received_events_url":"https://api.github.com/users/TheAlphaNerd/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/7160/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/7160/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/7160/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/71a0253d361c97d00498b5fb63c9306e12cce0ff","head":{"label":"addaleax:fix-7159","ref":"fix-7159","sha":"71a0253d361c97d00498b5fb63c9306e12cce0ff","user":{"login":"addaleax","id":899444,"avatar_url":"https://avatars.githubusercontent.com/u/899444?v=3","gravatar_id":"","url":"https://api.github.com/users/addaleax","html_url":"https://github.com/addaleax","followers_url":"https://api.github.com/users/addaleax/followers","following_url":"https://api.github.com/users/addaleax/following{/other_user}","gists_url":"https://api.github.com/users/addaleax/gists{/gist_id}","starred_url":"https://api.github.com/users/addaleax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addaleax/subscriptions","organizations_url":"https://api.github.com/users/addaleax/orgs","repos_url":"https://api.github.com/users/addaleax/repos","events_url":"https://api.github.com/users/addaleax/events{/privacy}","received_events_url":"https://api.github.com/users/addaleax/received_events","type":"User","site_admin":false},"repo":{"id":47707342,"name":"node","full_name":"addaleax/node","owner":{"login":"addaleax","id":899444,"avatar_url":"https://avatars.githubusercontent.com/u/899444?v=3","gravatar_id":"","url":"https://api.github.com/users/addaleax","html_url":"https://github.com/addaleax","followers_url":"https://api.github.com/users/addaleax/followers","following_url":"https://api.github.com/users/addaleax/following{/other_user}","gists_url":"https://api.github.com/users/addaleax/gists{/gist_id}","starred_url":"https://api.github.com/users/addaleax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addaleax/subscriptions","organizations_url":"https://api.github.com/users/addaleax/orgs","repos_url":"https://api.github.com/users/addaleax/repos","events_url":"https://api.github.com/users/addaleax/events{/privacy}","received_events_url":"https://api.github.com/users/addaleax/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/addaleax/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/addaleax/node","forks_url":"https://api.github.com/repos/addaleax/node/forks","keys_url":"https://api.github.com/repos/addaleax/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/addaleax/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/addaleax/node/teams","hooks_url":"https://api.github.com/repos/addaleax/node/hooks","issue_events_url":"https://api.github.com/repos/addaleax/node/issues/events{/number}","events_url":"https://api.github.com/repos/addaleax/node/events","assignees_url":"https://api.github.com/repos/addaleax/node/assignees{/user}","branches_url":"https://api.github.com/repos/addaleax/node/branches{/branch}","tags_url":"https://api.github.com/repos/addaleax/node/tags","blobs_url":"https://api.github.com/repos/addaleax/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/addaleax/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/addaleax/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/addaleax/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/addaleax/node/statuses/{sha}","languages_url":"https://api.github.com/repos/addaleax/node/languages","stargazers_url":"https://api.github.com/repos/addaleax/node/stargazers","contributors_url":"https://api.github.com/repos/addaleax/node/contributors","subscribers_url":"https://api.github.com/repos/addaleax/node/subscribers","subscription_url":"https://api.github.com/repos/addaleax/node/subscription","commits_url":"https://api.github.com/repos/addaleax/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/addaleax/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/addaleax/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/addaleax/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/addaleax/node/contents/{+path}","compare_url":"https://api.github.com/repos/addaleax/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/addaleax/node/merges","archive_url":"https://api.github.com/repos/addaleax/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/addaleax/node/downloads","issues_url":"https://api.github.com/repos/addaleax/node/issues{/number}","pulls_url":"https://api.github.com/repos/addaleax/node/pulls{/number}","milestones_url":"https://api.github.com/repos/addaleax/node/milestones{/number}","notifications_url":"https://api.github.com/repos/addaleax/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/addaleax/node/labels{/name}","releases_url":"https://api.github.com/repos/addaleax/node/releases{/id}","deployments_url":"https://api.github.com/repos/addaleax/node/deployments","created_at":"2015-12-09T17:26:30Z","updated_at":"2016-03-24T02:52:12Z","pushed_at":"2016-06-13T15:04:23Z","git_url":"git://github.com/addaleax/node.git","ssh_url":"git@github.com:addaleax/node.git","clone_url":"https://github.com/addaleax/node.git","svn_url":"https://github.com/addaleax/node","homepage":"https://nodejs.org","size":212650,"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":"05de4d78a62228732fcfe2e3d5c4e75863d3d0dc","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 JavaScript runtime :sparkles::turtle::rocket::sparkles:","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}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2016-06-13T10:51:01Z","pushed_at":"2016-06-13T21:42:56Z","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":281407,"stargazers_count":23991,"watchers_count":23991,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3507,"mirror_url":null,"open_issues_count":693,"forks":3507,"open_issues":693,"watchers":23991,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/7160"},"html":{"href":"https://github.com/nodejs/node/pull/7160"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/7160"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/7160/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/7160/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/7160/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/71a0253d361c97d00498b5fb63c9306e12cce0ff"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":10,"review_comments":0,"commits":1,"additions":55,"deletions":0,"changed_files":2}}
{"actor":{"display_login":"addaleax"}}