{"action":"created","comment":{"url":"https://api.github.com/repos/carllerche/h2/pulls/comments/177579684","pull_request_review_id":107476454,"id":177579684,"diff_hunk":"@@ -317,6 +324,14 @@ impl State {\n         }\n     }\n \n+    // /// Returns true if the stream was closed by sending an EOS.\n+    // pub fn is_eos(&self) -> bool {","path":"src/proto/streams/state.rs","position":22,"original_position":22,"commit_id":"861b10934fb7ac305dbbef020fce9ea3e8c2dda1","original_commit_id":"861b10934fb7ac305dbbef020fce9ea3e8c2dda1","user":{"login":"hawkw","id":2796466,"avatar_url":"https://avatars1.githubusercontent.com/u/2796466?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkw","html_url":"https://github.com/hawkw","followers_url":"https://api.github.com/users/hawkw/followers","following_url":"https://api.github.com/users/hawkw/following{/other_user}","gists_url":"https://api.github.com/users/hawkw/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkw/subscriptions","organizations_url":"https://api.github.com/users/hawkw/orgs","repos_url":"https://api.github.com/users/hawkw/repos","events_url":"https://api.github.com/users/hawkw/events{/privacy}","received_events_url":"https://api.github.com/users/hawkw/received_events","type":"User","site_admin":false},"body":"Oh, yeah, missed that when committing. Sorry.","created_at":"2018-03-27T21:34:02Z","updated_at":"2018-03-27T21:34:02Z","html_url":"https://github.com/carllerche/h2/pull/247#discussion_r177579684","pull_request_url":"https://api.github.com/repos/carllerche/h2/pulls/247","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/carllerche/h2/pulls/comments/177579684"},"html":{"href":"https://github.com/carllerche/h2/pull/247#discussion_r177579684"},"pull_request":{"href":"https://api.github.com/repos/carllerche/h2/pulls/247"}},"in_reply_to_id":177578918},"pull_request":{"url":"https://api.github.com/repos/carllerche/h2/pulls/247","id":177863846,"html_url":"https://github.com/carllerche/h2/pull/247","diff_url":"https://github.com/carllerche/h2/pull/247.diff","patch_url":"https://github.com/carllerche/h2/pull/247.patch","issue_url":"https://api.github.com/repos/carllerche/h2/issues/247","number":247,"state":"open","locked":false,"title":"recv_reset resets closed streams with queued EOS frames","user":{"login":"hawkw","id":2796466,"avatar_url":"https://avatars1.githubusercontent.com/u/2796466?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkw","html_url":"https://github.com/hawkw","followers_url":"https://api.github.com/users/hawkw/followers","following_url":"https://api.github.com/users/hawkw/following{/other_user}","gists_url":"https://api.github.com/users/hawkw/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkw/subscriptions","organizations_url":"https://api.github.com/users/hawkw/orgs","repos_url":"https://api.github.com/users/hawkw/repos","events_url":"https://api.github.com/users/hawkw/events{/privacy}","received_events_url":"https://api.github.com/users/hawkw/received_events","type":"User","site_admin":false},"body":"Fixes #246. Fixes runconduit/conduit#607.\r\n\r\nAn issue currently exists where `h2` will panic when a stream transitions from `HalfClosed(remote)` to `Closed(Cause::EndStream)` by enqueuing an EOS frame, and then receives a `RST_STREAM` frame _before_ the queued EOS frame is sent.\r\n\r\nIn this case, the `expect` in `prioritize::pop_frame` https://github.com/carllerche/h2/blob/f8baeb7211985834acaf7ecc70548aafd5d9ef6d/src/proto/streams/prioritize.rs#L693-L694 is called on a frame which does _not_ have a scheduled reset, because it is in the `Closed(Cause::EndStream)` state. However, the guard which skips this code when the stream is peer reset https://github.com/carllerche/h2/blob/f8baeb7211985834acaf7ecc70548aafd5d9ef6d/src/proto/streams/prioritize.rs#L584-L586 doesn't cause us to skip in this case, because the stream is in the `Closed(Cause::EndStream)` state.\r\n\r\n---\r\n\r\nI've modified [`streams::State::recv_reset`](\r\nhttps://github.com/hawkw/h2/blob/14200321d77aaf31e57fe7c40d4223030e113922/src/proto/streams/state.rs#L217-L232) to take a boolean parameter indicating whether the stream receiving a reset currently has a frame queued to send. If the stream is in the `Closed(Cause::EndStream)` state, rather than doing nothing, we check whether there is a queued frame. If so, the stream transitions to `Closed(Cause::Proto)` with the reason for the received reset set as the reason. \r\n\r\nThis way, when `prioritize::pop_frame` sees this stream, it will be treated by any other reset stream, draining the queue and transitioning to reset. We no longer hit the `expect` call that was causing panics in this case.\r\n\r\nI've also added a unit test that reproduces the crash against master.","created_at":"2018-03-27T20:59:48Z","updated_at":"2018-03-27T21:34:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7417e5a93be71dff6e8eee5c32dbf52c08356b1","assignee":{"login":"hawkw","id":2796466,"avatar_url":"https://avatars1.githubusercontent.com/u/2796466?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkw","html_url":"https://github.com/hawkw","followers_url":"https://api.github.com/users/hawkw/followers","following_url":"https://api.github.com/users/hawkw/following{/other_user}","gists_url":"https://api.github.com/users/hawkw/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkw/subscriptions","organizations_url":"https://api.github.com/users/hawkw/orgs","repos_url":"https://api.github.com/users/hawkw/repos","events_url":"https://api.github.com/users/hawkw/events{/privacy}","received_events_url":"https://api.github.com/users/hawkw/received_events","type":"User","site_admin":false},"assignees":[{"login":"hawkw","id":2796466,"avatar_url":"https://avatars1.githubusercontent.com/u/2796466?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkw","html_url":"https://github.com/hawkw","followers_url":"https://api.github.com/users/hawkw/followers","following_url":"https://api.github.com/users/hawkw/following{/other_user}","gists_url":"https://api.github.com/users/hawkw/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkw/subscriptions","organizations_url":"https://api.github.com/users/hawkw/orgs","repos_url":"https://api.github.com/users/hawkw/repos","events_url":"https://api.github.com/users/hawkw/events{/privacy}","received_events_url":"https://api.github.com/users/hawkw/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"seanmonstar","id":51479,"avatar_url":"https://avatars1.githubusercontent.com/u/51479?v=4","gravatar_id":"","url":"https://api.github.com/users/seanmonstar","html_url":"https://github.com/seanmonstar","followers_url":"https://api.github.com/users/seanmonstar/followers","following_url":"https://api.github.com/users/seanmonstar/following{/other_user}","gists_url":"https://api.github.com/users/seanmonstar/gists{/gist_id}","starred_url":"https://api.github.com/users/seanmonstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanmonstar/subscriptions","organizations_url":"https://api.github.com/users/seanmonstar/orgs","repos_url":"https://api.github.com/users/seanmonstar/repos","events_url":"https://api.github.com/users/seanmonstar/events{/privacy}","received_events_url":"https://api.github.com/users/seanmonstar/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":557429837,"url":"https://api.github.com/repos/carllerche/h2/labels/bug","name":"bug","color":"ee0701","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/carllerche/h2/pulls/247/commits","review_comments_url":"https://api.github.com/repos/carllerche/h2/pulls/247/comments","review_comment_url":"https://api.github.com/repos/carllerche/h2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/carllerche/h2/issues/247/comments","statuses_url":"https://api.github.com/repos/carllerche/h2/statuses/861b10934fb7ac305dbbef020fce9ea3e8c2dda1","head":{"label":"hawkw:eliza/reset-crash","ref":"eliza/reset-crash","sha":"861b10934fb7ac305dbbef020fce9ea3e8c2dda1","user":{"login":"hawkw","id":2796466,"avatar_url":"https://avatars1.githubusercontent.com/u/2796466?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkw","html_url":"https://github.com/hawkw","followers_url":"https://api.github.com/users/hawkw/followers","following_url":"https://api.github.com/users/hawkw/following{/other_user}","gists_url":"https://api.github.com/users/hawkw/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkw/subscriptions","organizations_url":"https://api.github.com/users/hawkw/orgs","repos_url":"https://api.github.com/users/hawkw/repos","events_url":"https://api.github.com/users/hawkw/events{/privacy}","received_events_url":"https://api.github.com/users/hawkw/received_events","type":"User","site_admin":false},"repo":{"id":101901555,"name":"h2","full_name":"hawkw/h2","owner":{"login":"hawkw","id":2796466,"avatar_url":"https://avatars1.githubusercontent.com/u/2796466?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkw","html_url":"https://github.com/hawkw","followers_url":"https://api.github.com/users/hawkw/followers","following_url":"https://api.github.com/users/hawkw/following{/other_user}","gists_url":"https://api.github.com/users/hawkw/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkw/subscriptions","organizations_url":"https://api.github.com/users/hawkw/orgs","repos_url":"https://api.github.com/users/hawkw/repos","events_url":"https://api.github.com/users/hawkw/events{/privacy}","received_events_url":"https://api.github.com/users/hawkw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hawkw/h2","description":"HTTP 2.0 client & server implementation for Rust.","fork":true,"url":"https://api.github.com/repos/hawkw/h2","forks_url":"https://api.github.com/repos/hawkw/h2/forks","keys_url":"https://api.github.com/repos/hawkw/h2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hawkw/h2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hawkw/h2/teams","hooks_url":"https://api.github.com/repos/hawkw/h2/hooks","issue_events_url":"https://api.github.com/repos/hawkw/h2/issues/events{/number}","events_url":"https://api.github.com/repos/hawkw/h2/events","assignees_url":"https://api.github.com/repos/hawkw/h2/assignees{/user}","branches_url":"https://api.github.com/repos/hawkw/h2/branches{/branch}","tags_url":"https://api.github.com/repos/hawkw/h2/tags","blobs_url":"https://api.github.com/repos/hawkw/h2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hawkw/h2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hawkw/h2/git/refs{/sha}","trees_url":"https://api.github.com/repos/hawkw/h2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hawkw/h2/statuses/{sha}","languages_url":"https://api.github.com/repos/hawkw/h2/languages","stargazers_url":"https://api.github.com/repos/hawkw/h2/stargazers","contributors_url":"https://api.github.com/repos/hawkw/h2/contributors","subscribers_url":"https://api.github.com/repos/hawkw/h2/subscribers","subscription_url":"https://api.github.com/repos/hawkw/h2/subscription","commits_url":"https://api.github.com/repos/hawkw/h2/commits{/sha}","git_commits_url":"https://api.github.com/repos/hawkw/h2/git/commits{/sha}","comments_url":"https://api.github.com/repos/hawkw/h2/comments{/number}","issue_comment_url":"https://api.github.com/repos/hawkw/h2/issues/comments{/number}","contents_url":"https://api.github.com/repos/hawkw/h2/contents/{+path}","compare_url":"https://api.github.com/repos/hawkw/h2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hawkw/h2/merges","archive_url":"https://api.github.com/repos/hawkw/h2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hawkw/h2/downloads","issues_url":"https://api.github.com/repos/hawkw/h2/issues{/number}","pulls_url":"https://api.github.com/repos/hawkw/h2/pulls{/number}","milestones_url":"https://api.github.com/repos/hawkw/h2/milestones{/number}","notifications_url":"https://api.github.com/repos/hawkw/h2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hawkw/h2/labels{/name}","releases_url":"https://api.github.com/repos/hawkw/h2/releases{/id}","deployments_url":"https://api.github.com/repos/hawkw/h2/deployments","created_at":"2017-08-30T15:59:26Z","updated_at":"2017-08-30T15:59:30Z","pushed_at":"2018-03-27T21:25:20Z","git_url":"git://github.com/hawkw/h2.git","ssh_url":"git@github.com:hawkw/h2.git","clone_url":"https://github.com/hawkw/h2.git","svn_url":"https://github.com/hawkw/h2","homepage":"","size":7012,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"carllerche:master","ref":"master","sha":"e61788a57f8442d85aeef8873ff3a965a5d1815c","user":{"login":"carllerche","id":6180,"avatar_url":"https://avatars3.githubusercontent.com/u/6180?v=4","gravatar_id":"","url":"https://api.github.com/users/carllerche","html_url":"https://github.com/carllerche","followers_url":"https://api.github.com/users/carllerche/followers","following_url":"https://api.github.com/users/carllerche/following{/other_user}","gists_url":"https://api.github.com/users/carllerche/gists{/gist_id}","starred_url":"https://api.github.com/users/carllerche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carllerche/subscriptions","organizations_url":"https://api.github.com/users/carllerche/orgs","repos_url":"https://api.github.com/users/carllerche/repos","events_url":"https://api.github.com/users/carllerche/events{/privacy}","received_events_url":"https://api.github.com/users/carllerche/received_events","type":"User","site_admin":false},"repo":{"id":84517704,"name":"h2","full_name":"carllerche/h2","owner":{"login":"carllerche","id":6180,"avatar_url":"https://avatars3.githubusercontent.com/u/6180?v=4","gravatar_id":"","url":"https://api.github.com/users/carllerche","html_url":"https://github.com/carllerche","followers_url":"https://api.github.com/users/carllerche/followers","following_url":"https://api.github.com/users/carllerche/following{/other_user}","gists_url":"https://api.github.com/users/carllerche/gists{/gist_id}","starred_url":"https://api.github.com/users/carllerche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carllerche/subscriptions","organizations_url":"https://api.github.com/users/carllerche/orgs","repos_url":"https://api.github.com/users/carllerche/repos","events_url":"https://api.github.com/users/carllerche/events{/privacy}","received_events_url":"https://api.github.com/users/carllerche/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carllerche/h2","description":"HTTP 2.0 client & server implementation for Rust.","fork":false,"url":"https://api.github.com/repos/carllerche/h2","forks_url":"https://api.github.com/repos/carllerche/h2/forks","keys_url":"https://api.github.com/repos/carllerche/h2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carllerche/h2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carllerche/h2/teams","hooks_url":"https://api.github.com/repos/carllerche/h2/hooks","issue_events_url":"https://api.github.com/repos/carllerche/h2/issues/events{/number}","events_url":"https://api.github.com/repos/carllerche/h2/events","assignees_url":"https://api.github.com/repos/carllerche/h2/assignees{/user}","branches_url":"https://api.github.com/repos/carllerche/h2/branches{/branch}","tags_url":"https://api.github.com/repos/carllerche/h2/tags","blobs_url":"https://api.github.com/repos/carllerche/h2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carllerche/h2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carllerche/h2/git/refs{/sha}","trees_url":"https://api.github.com/repos/carllerche/h2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carllerche/h2/statuses/{sha}","languages_url":"https://api.github.com/repos/carllerche/h2/languages","stargazers_url":"https://api.github.com/repos/carllerche/h2/stargazers","contributors_url":"https://api.github.com/repos/carllerche/h2/contributors","subscribers_url":"https://api.github.com/repos/carllerche/h2/subscribers","subscription_url":"https://api.github.com/repos/carllerche/h2/subscription","commits_url":"https://api.github.com/repos/carllerche/h2/commits{/sha}","git_commits_url":"https://api.github.com/repos/carllerche/h2/git/commits{/sha}","comments_url":"https://api.github.com/repos/carllerche/h2/comments{/number}","issue_comment_url":"https://api.github.com/repos/carllerche/h2/issues/comments{/number}","contents_url":"https://api.github.com/repos/carllerche/h2/contents/{+path}","compare_url":"https://api.github.com/repos/carllerche/h2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carllerche/h2/merges","archive_url":"https://api.github.com/repos/carllerche/h2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carllerche/h2/downloads","issues_url":"https://api.github.com/repos/carllerche/h2/issues{/number}","pulls_url":"https://api.github.com/repos/carllerche/h2/pulls{/number}","milestones_url":"https://api.github.com/repos/carllerche/h2/milestones{/number}","notifications_url":"https://api.github.com/repos/carllerche/h2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carllerche/h2/labels{/name}","releases_url":"https://api.github.com/repos/carllerche/h2/releases{/id}","deployments_url":"https://api.github.com/repos/carllerche/h2/deployments","created_at":"2017-03-10T04:03:11Z","updated_at":"2018-03-23T10:17:51Z","pushed_at":"2018-03-27T21:25:22Z","git_url":"git://github.com/carllerche/h2.git","ssh_url":"git@github.com:carllerche/h2.git","clone_url":"https://github.com/carllerche/h2.git","svn_url":"https://github.com/carllerche/h2","homepage":"","size":4208,"stargazers_count":487,"watchers_count":487,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":28,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":23,"open_issues":28,"watchers":487,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/carllerche/h2/pulls/247"},"html":{"href":"https://github.com/carllerche/h2/pull/247"},"issue":{"href":"https://api.github.com/repos/carllerche/h2/issues/247"},"comments":{"href":"https://api.github.com/repos/carllerche/h2/issues/247/comments"},"review_comments":{"href":"https://api.github.com/repos/carllerche/h2/pulls/247/comments"},"review_comment":{"href":"https://api.github.com/repos/carllerche/h2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/carllerche/h2/pulls/247/commits"},"statuses":{"href":"https://api.github.com/repos/carllerche/h2/statuses/861b10934fb7ac305dbbef020fce9ea3e8c2dda1"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"hawkw"}}