{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift-nio/pulls/comments/212383148","pull_request_review_id":149004205,"id":212383148,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjM4MzE0OA==","diff_hunk":"@@ -443,17 +443,18 @@ class BaseSocketChannel<T: BaseSocket>: SelectableChannel, ChannelCore {\n         } catch let err {\n             // If there is a write error we should try drain the inbound before closing the socket as there may be some data pending.\n             // We ignore any error that is thrown as we will use the original err to close the channel and notify the user.\n-            if readIfNeeded0() {\n+            if self.readIfNeeded0() {\n                 assert(self.lifecycleManager.isActive)\n \n                 // We need to continue reading until there is nothing more to be read from the socket as we will not have another chance to drain it.\n                 while let read = try? readFromSocket(), read == .some {\n-                    assert(self.lifecycleManager.isActive)\n-                    pipeline.fireChannelReadComplete()\n+                    if self.lifecycleManager.isActive {\n+                        pipeline.fireChannelReadComplete()","path":"Sources/NIO/BaseSocketChannel.swift","position":13,"original_position":13,"commit_id":"271b6fd2ba828053eaf404019ee31e6192b32e5a","original_commit_id":"271b6fd2ba828053eaf404019ee31e6192b32e5a","user":{"login":"weissi","id":624238,"node_id":"MDQ6VXNlcjYyNDIzOA==","avatar_url":"https://avatars2.githubusercontent.com/u/624238?v=4","gravatar_id":"","url":"https://api.github.com/users/weissi","html_url":"https://github.com/weissi","followers_url":"https://api.github.com/users/weissi/followers","following_url":"https://api.github.com/users/weissi/following{/other_user}","gists_url":"https://api.github.com/users/weissi/gists{/gist_id}","starred_url":"https://api.github.com/users/weissi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weissi/subscriptions","organizations_url":"https://api.github.com/users/weissi/orgs","repos_url":"https://api.github.com/users/weissi/repos","events_url":"https://api.github.com/users/weissi/events{/privacy}","received_events_url":"https://api.github.com/users/weissi/received_events","type":"User","site_admin":false},"body":"@Lukasa I have no idea either why we're doing that but left it because it was that way. But let me just change it","created_at":"2018-08-23T16:56:30Z","updated_at":"2018-08-23T16:56:30Z","html_url":"https://github.com/apple/swift-nio/pull/594#discussion_r212383148","pull_request_url":"https://api.github.com/repos/apple/swift-nio/pulls/594","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/comments/212383148"},"html":{"href":"https://github.com/apple/swift-nio/pull/594#discussion_r212383148"},"pull_request":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/594"}},"in_reply_to_id":212377845},"pull_request":{"url":"https://api.github.com/repos/apple/swift-nio/pulls/594","id":210488532,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNDg4NTMy","html_url":"https://github.com/apple/swift-nio/pull/594","diff_url":"https://github.com/apple/swift-nio/pull/594.diff","patch_url":"https://github.com/apple/swift-nio/pull/594.patch","issue_url":"https://api.github.com/repos/apple/swift-nio/issues/594","number":594,"state":"open","locked":false,"title":"don't crash when Channel goes inactive in read triggered by write error","user":{"login":"weissi","id":624238,"node_id":"MDQ6VXNlcjYyNDIzOA==","avatar_url":"https://avatars2.githubusercontent.com/u/624238?v=4","gravatar_id":"","url":"https://api.github.com/users/weissi","html_url":"https://github.com/weissi","followers_url":"https://api.github.com/users/weissi/followers","following_url":"https://api.github.com/users/weissi/following{/other_user}","gists_url":"https://api.github.com/users/weissi/gists{/gist_id}","starred_url":"https://api.github.com/users/weissi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weissi/subscriptions","organizations_url":"https://api.github.com/users/weissi/orgs","repos_url":"https://api.github.com/users/weissi/repos","events_url":"https://api.github.com/users/weissi/events{/privacy}","received_events_url":"https://api.github.com/users/weissi/received_events","type":"User","site_admin":false},"body":"Motivation:\r\n\r\nPreviously we asserted that a Channel cannot go inactive after calling\r\nout for a read that was triggered by (draining the receive buffer after)\r\na write error.\r\n\r\nThis assertion was put in place to guard against `readComplete` events\r\nsent on inactive channels. It did that job just fine but crashes aren't\r\ngreat so we now conditionally fire the `readComplete` event if the\r\nChannel stays active.\r\n\r\nModifications:\r\n\r\nmake the readComplete event firing conditional\r\n\r\nResult:\r\n\r\nfewer crashes, more happy faces\r\n","created_at":"2018-08-23T15:29:24Z","updated_at":"2018-08-23T16:56:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f9ff080137345e3b1f629b4f0c1115b77e29e1c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"normanmaurer","id":439362,"node_id":"MDQ6VXNlcjQzOTM2Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/439362?v=4","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift-nio/pulls/594/commits","review_comments_url":"https://api.github.com/repos/apple/swift-nio/pulls/594/comments","review_comment_url":"https://api.github.com/repos/apple/swift-nio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift-nio/issues/594/comments","statuses_url":"https://api.github.com/repos/apple/swift-nio/statuses/271b6fd2ba828053eaf404019ee31e6192b32e5a","head":{"label":"weissi:jw-chan-inactive-write-error","ref":"jw-chan-inactive-write-error","sha":"271b6fd2ba828053eaf404019ee31e6192b32e5a","user":{"login":"weissi","id":624238,"node_id":"MDQ6VXNlcjYyNDIzOA==","avatar_url":"https://avatars2.githubusercontent.com/u/624238?v=4","gravatar_id":"","url":"https://api.github.com/users/weissi","html_url":"https://github.com/weissi","followers_url":"https://api.github.com/users/weissi/followers","following_url":"https://api.github.com/users/weissi/following{/other_user}","gists_url":"https://api.github.com/users/weissi/gists{/gist_id}","starred_url":"https://api.github.com/users/weissi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weissi/subscriptions","organizations_url":"https://api.github.com/users/weissi/orgs","repos_url":"https://api.github.com/users/weissi/repos","events_url":"https://api.github.com/users/weissi/events{/privacy}","received_events_url":"https://api.github.com/users/weissi/received_events","type":"User","site_admin":false},"repo":{"id":123523477,"node_id":"MDEwOlJlcG9zaXRvcnkxMjM1MjM0Nzc=","name":"swift-nio","full_name":"weissi/swift-nio","owner":{"login":"weissi","id":624238,"node_id":"MDQ6VXNlcjYyNDIzOA==","avatar_url":"https://avatars2.githubusercontent.com/u/624238?v=4","gravatar_id":"","url":"https://api.github.com/users/weissi","html_url":"https://github.com/weissi","followers_url":"https://api.github.com/users/weissi/followers","following_url":"https://api.github.com/users/weissi/following{/other_user}","gists_url":"https://api.github.com/users/weissi/gists{/gist_id}","starred_url":"https://api.github.com/users/weissi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weissi/subscriptions","organizations_url":"https://api.github.com/users/weissi/orgs","repos_url":"https://api.github.com/users/weissi/repos","events_url":"https://api.github.com/users/weissi/events{/privacy}","received_events_url":"https://api.github.com/users/weissi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/weissi/swift-nio","description":"Event-driven network application framework for high performance protocol servers & clients, non-blocking.","fork":true,"url":"https://api.github.com/repos/weissi/swift-nio","forks_url":"https://api.github.com/repos/weissi/swift-nio/forks","keys_url":"https://api.github.com/repos/weissi/swift-nio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weissi/swift-nio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weissi/swift-nio/teams","hooks_url":"https://api.github.com/repos/weissi/swift-nio/hooks","issue_events_url":"https://api.github.com/repos/weissi/swift-nio/issues/events{/number}","events_url":"https://api.github.com/repos/weissi/swift-nio/events","assignees_url":"https://api.github.com/repos/weissi/swift-nio/assignees{/user}","branches_url":"https://api.github.com/repos/weissi/swift-nio/branches{/branch}","tags_url":"https://api.github.com/repos/weissi/swift-nio/tags","blobs_url":"https://api.github.com/repos/weissi/swift-nio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weissi/swift-nio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weissi/swift-nio/git/refs{/sha}","trees_url":"https://api.github.com/repos/weissi/swift-nio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weissi/swift-nio/statuses/{sha}","languages_url":"https://api.github.com/repos/weissi/swift-nio/languages","stargazers_url":"https://api.github.com/repos/weissi/swift-nio/stargazers","contributors_url":"https://api.github.com/repos/weissi/swift-nio/contributors","subscribers_url":"https://api.github.com/repos/weissi/swift-nio/subscribers","subscription_url":"https://api.github.com/repos/weissi/swift-nio/subscription","commits_url":"https://api.github.com/repos/weissi/swift-nio/commits{/sha}","git_commits_url":"https://api.github.com/repos/weissi/swift-nio/git/commits{/sha}","comments_url":"https://api.github.com/repos/weissi/swift-nio/comments{/number}","issue_comment_url":"https://api.github.com/repos/weissi/swift-nio/issues/comments{/number}","contents_url":"https://api.github.com/repos/weissi/swift-nio/contents/{+path}","compare_url":"https://api.github.com/repos/weissi/swift-nio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weissi/swift-nio/merges","archive_url":"https://api.github.com/repos/weissi/swift-nio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weissi/swift-nio/downloads","issues_url":"https://api.github.com/repos/weissi/swift-nio/issues{/number}","pulls_url":"https://api.github.com/repos/weissi/swift-nio/pulls{/number}","milestones_url":"https://api.github.com/repos/weissi/swift-nio/milestones{/number}","notifications_url":"https://api.github.com/repos/weissi/swift-nio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weissi/swift-nio/labels{/name}","releases_url":"https://api.github.com/repos/weissi/swift-nio/releases{/id}","deployments_url":"https://api.github.com/repos/weissi/swift-nio/deployments","created_at":"2018-03-02T03:09:39Z","updated_at":"2018-03-02T03:09:41Z","pushed_at":"2018-08-23T16:32:27Z","git_url":"git://github.com/weissi/swift-nio.git","ssh_url":"git@github.com:weissi/swift-nio.git","clone_url":"https://github.com/weissi/swift-nio.git","svn_url":"https://github.com/weissi/swift-nio","homepage":"","size":3907,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:master","ref":"master","sha":"927034f7de1702e1d698ac2395331e5adb91fae9","user":{"login":"apple","id":10639145,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNjM5MTQ1","avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":120498971,"node_id":"MDEwOlJlcG9zaXRvcnkxMjA0OTg5NzE=","name":"swift-nio","full_name":"apple/swift-nio","owner":{"login":"apple","id":10639145,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNjM5MTQ1","avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift-nio","description":"Event-driven network application framework for high performance protocol servers & clients, non-blocking.","fork":false,"url":"https://api.github.com/repos/apple/swift-nio","forks_url":"https://api.github.com/repos/apple/swift-nio/forks","keys_url":"https://api.github.com/repos/apple/swift-nio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift-nio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift-nio/teams","hooks_url":"https://api.github.com/repos/apple/swift-nio/hooks","issue_events_url":"https://api.github.com/repos/apple/swift-nio/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift-nio/events","assignees_url":"https://api.github.com/repos/apple/swift-nio/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift-nio/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift-nio/tags","blobs_url":"https://api.github.com/repos/apple/swift-nio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift-nio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift-nio/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift-nio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift-nio/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift-nio/languages","stargazers_url":"https://api.github.com/repos/apple/swift-nio/stargazers","contributors_url":"https://api.github.com/repos/apple/swift-nio/contributors","subscribers_url":"https://api.github.com/repos/apple/swift-nio/subscribers","subscription_url":"https://api.github.com/repos/apple/swift-nio/subscription","commits_url":"https://api.github.com/repos/apple/swift-nio/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift-nio/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift-nio/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift-nio/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift-nio/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift-nio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift-nio/merges","archive_url":"https://api.github.com/repos/apple/swift-nio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift-nio/downloads","issues_url":"https://api.github.com/repos/apple/swift-nio/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift-nio/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift-nio/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift-nio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift-nio/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift-nio/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift-nio/deployments","created_at":"2018-02-06T17:47:31Z","updated_at":"2018-08-23T16:18:56Z","pushed_at":"2018-08-23T16:32:27Z","git_url":"git://github.com/apple/swift-nio.git","ssh_url":"git@github.com:apple/swift-nio.git","clone_url":"https://github.com/apple/swift-nio.git","svn_url":"https://github.com/apple/swift-nio","homepage":"","size":17602,"stargazers_count":4018,"watchers_count":4018,"language":"Swift","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":200,"mirror_url":null,"archived":false,"open_issues_count":88,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":200,"open_issues":88,"watchers":4018,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/594"},"html":{"href":"https://github.com/apple/swift-nio/pull/594"},"issue":{"href":"https://api.github.com/repos/apple/swift-nio/issues/594"},"comments":{"href":"https://api.github.com/repos/apple/swift-nio/issues/594/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/594/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/594/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift-nio/statuses/271b6fd2ba828053eaf404019ee31e6192b32e5a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"weissi"}}