{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/328280513","pull_request_review_id":293282340,"id":328280513,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyODI4MDUxMw==","diff_hunk":"@@ -1023,24 +1023,38 @@ class GroupCoordinator(val brokerId: Int,\n \n   def tryCompleteHeartbeat(group: GroupMetadata, memberId: String, isPending: Boolean, heartbeatDeadline: Long, forceComplete: () => Boolean) = {\n     group.inLock {\n-      if (isPending) {\n+      // The group has been unloaded and invalid, we should complete the heartbeat.\n+      if (group.is(Dead)) {\n+        forceComplete()\n+      } else if (isPending) {\n         // complete the heartbeat if the member has joined the group\n         if (group.has(memberId)) {\n           forceComplete()\n         } else false\n-      }\n-      else {\n-        val member = group.get(memberId)\n-        if (member.shouldKeepAlive(heartbeatDeadline) || member.isLeaving) {\n+      } else {\n+        if (shouldCompleteNonPendingHeartbeat(group, memberId, heartbeatDeadline)) {\n           forceComplete()\n         } else false\n       }\n     }\n   }\n \n+  def shouldCompleteNonPendingHeartbeat(group: GroupMetadata, memberId: String, heartbeatDeadline: Long): Boolean = {\n+    if (group.has(memberId)) {\n+      val member = group.get(memberId)\n+      member.shouldKeepAlive(heartbeatDeadline) || member.isLeaving\n+    } else {\n+      error(s\"Member id $memberId was not found in ${group.groupId} during heartbeat expiration, \" +\n+        s\"this could be potentially related to KAFKA-8896\")","path":"core/src/main/scala/kafka/coordinator/group/GroupCoordinator.scala","position":31,"original_position":31,"commit_id":"39e8692d1c96446d120225a768ac89271d19c4f4","original_commit_id":"39e8692d1c96446d120225a768ac89271d19c4f4","user":{"login":"hachikuji","id":12502538,"node_id":"MDQ6VXNlcjEyNTAyNTM4","avatar_url":"https://avatars3.githubusercontent.com/u/12502538?v=4","gravatar_id":"","url":"https://api.github.com/users/hachikuji","html_url":"https://github.com/hachikuji","followers_url":"https://api.github.com/users/hachikuji/followers","following_url":"https://api.github.com/users/hachikuji/following{/other_user}","gists_url":"https://api.github.com/users/hachikuji/gists{/gist_id}","starred_url":"https://api.github.com/users/hachikuji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachikuji/subscriptions","organizations_url":"https://api.github.com/users/hachikuji/orgs","repos_url":"https://api.github.com/users/hachikuji/repos","events_url":"https://api.github.com/users/hachikuji/events{/privacy}","received_events_url":"https://api.github.com/users/hachikuji/received_events","type":"User","site_admin":false},"body":"Yeah, I agree we should drop the JIRA from the message. Also, I'm not sure I see why this should have a different log level than the message in `onExpireHeartbeat`. Either way, the delayed heartbeat is completing after the member was already removed. Maybe we can make this INFO level also?","created_at":"2019-09-25T18:40:08Z","updated_at":"2019-09-25T18:44:12Z","html_url":"https://github.com/apache/kafka/pull/7377#discussion_r328280513","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/7377","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/328280513"},"html":{"href":"https://github.com/apache/kafka/pull/7377#discussion_r328280513"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/7377"}},"in_reply_to_id":327908837},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/7377","id":320370841,"node_id":"MDExOlB1bGxSZXF1ZXN0MzIwMzcwODQx","html_url":"https://github.com/apache/kafka/pull/7377","diff_url":"https://github.com/apache/kafka/pull/7377.diff","patch_url":"https://github.com/apache/kafka/pull/7377.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/7377","number":7377,"state":"open","locked":false,"title":"KAFKA-8896: Check group state before completing delayed heartbeat","user":{"login":"abbccdda","id":5845561,"node_id":"MDQ6VXNlcjU4NDU1NjE=","avatar_url":"https://avatars3.githubusercontent.com/u/5845561?v=4","gravatar_id":"","url":"https://api.github.com/users/abbccdda","html_url":"https://github.com/abbccdda","followers_url":"https://api.github.com/users/abbccdda/followers","following_url":"https://api.github.com/users/abbccdda/following{/other_user}","gists_url":"https://api.github.com/users/abbccdda/gists{/gist_id}","starred_url":"https://api.github.com/users/abbccdda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abbccdda/subscriptions","organizations_url":"https://api.github.com/users/abbccdda/orgs","repos_url":"https://api.github.com/users/abbccdda/repos","events_url":"https://api.github.com/users/abbccdda/events{/privacy}","received_events_url":"https://api.github.com/users/abbccdda/received_events","type":"User","site_admin":false},"body":"This PR is a defensive fix for reported bug 8896, which would cause group coordinator crash when the heartbeat member was not found.\r\n\r\n### Committer Checklist (excluded from commit message)\r\n- [ ] Verify design and implementation \r\n- [ ] Verify test coverage and CI build status\r\n- [ ] Verify documentation (including upgrade notes)\r\n","created_at":"2019-09-23T16:07:29Z","updated_at":"2019-09-25T18:44:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0de244104a4c5db383fb134dc9443f5c5c5d91e6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/7377/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/7377/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/7377/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/39e8692d1c96446d120225a768ac89271d19c4f4","head":{"label":"abbccdda:KAFKA-8896","ref":"KAFKA-8896","sha":"39e8692d1c96446d120225a768ac89271d19c4f4","user":{"login":"abbccdda","id":5845561,"node_id":"MDQ6VXNlcjU4NDU1NjE=","avatar_url":"https://avatars3.githubusercontent.com/u/5845561?v=4","gravatar_id":"","url":"https://api.github.com/users/abbccdda","html_url":"https://github.com/abbccdda","followers_url":"https://api.github.com/users/abbccdda/followers","following_url":"https://api.github.com/users/abbccdda/following{/other_user}","gists_url":"https://api.github.com/users/abbccdda/gists{/gist_id}","starred_url":"https://api.github.com/users/abbccdda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abbccdda/subscriptions","organizations_url":"https://api.github.com/users/abbccdda/orgs","repos_url":"https://api.github.com/users/abbccdda/repos","events_url":"https://api.github.com/users/abbccdda/events{/privacy}","received_events_url":"https://api.github.com/users/abbccdda/received_events","type":"User","site_admin":false},"repo":{"id":101105392,"node_id":"MDEwOlJlcG9zaXRvcnkxMDExMDUzOTI=","name":"kafka","full_name":"abbccdda/kafka","private":false,"owner":{"login":"abbccdda","id":5845561,"node_id":"MDQ6VXNlcjU4NDU1NjE=","avatar_url":"https://avatars3.githubusercontent.com/u/5845561?v=4","gravatar_id":"","url":"https://api.github.com/users/abbccdda","html_url":"https://github.com/abbccdda","followers_url":"https://api.github.com/users/abbccdda/followers","following_url":"https://api.github.com/users/abbccdda/following{/other_user}","gists_url":"https://api.github.com/users/abbccdda/gists{/gist_id}","starred_url":"https://api.github.com/users/abbccdda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abbccdda/subscriptions","organizations_url":"https://api.github.com/users/abbccdda/orgs","repos_url":"https://api.github.com/users/abbccdda/repos","events_url":"https://api.github.com/users/abbccdda/events{/privacy}","received_events_url":"https://api.github.com/users/abbccdda/received_events","type":"User","site_admin":false},"html_url":"https://github.com/abbccdda/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/abbccdda/kafka","forks_url":"https://api.github.com/repos/abbccdda/kafka/forks","keys_url":"https://api.github.com/repos/abbccdda/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abbccdda/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abbccdda/kafka/teams","hooks_url":"https://api.github.com/repos/abbccdda/kafka/hooks","issue_events_url":"https://api.github.com/repos/abbccdda/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/abbccdda/kafka/events","assignees_url":"https://api.github.com/repos/abbccdda/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/abbccdda/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/abbccdda/kafka/tags","blobs_url":"https://api.github.com/repos/abbccdda/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abbccdda/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abbccdda/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/abbccdda/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abbccdda/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/abbccdda/kafka/languages","stargazers_url":"https://api.github.com/repos/abbccdda/kafka/stargazers","contributors_url":"https://api.github.com/repos/abbccdda/kafka/contributors","subscribers_url":"https://api.github.com/repos/abbccdda/kafka/subscribers","subscription_url":"https://api.github.com/repos/abbccdda/kafka/subscription","commits_url":"https://api.github.com/repos/abbccdda/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/abbccdda/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/abbccdda/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/abbccdda/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/abbccdda/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/abbccdda/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abbccdda/kafka/merges","archive_url":"https://api.github.com/repos/abbccdda/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abbccdda/kafka/downloads","issues_url":"https://api.github.com/repos/abbccdda/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/abbccdda/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/abbccdda/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/abbccdda/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abbccdda/kafka/labels{/name}","releases_url":"https://api.github.com/repos/abbccdda/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/abbccdda/kafka/deployments","created_at":"2017-08-22T20:39:24Z","updated_at":"2019-09-20T16:28:00Z","pushed_at":"2019-09-23T17:23:05Z","git_url":"git://github.com/abbccdda/kafka.git","ssh_url":"git@github.com:abbccdda/kafka.git","clone_url":"https://github.com/abbccdda/kafka.git","svn_url":"https://github.com/abbccdda/kafka","homepage":null,"size":84282,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":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":2,"default_branch":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"beac4c7534ef0cd7be92514a8d92639bf417221c","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2211243,"node_id":"MDEwOlJlcG9zaXRvcnkyMjExMjQz","name":"kafka","full_name":"apache/kafka","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/apache/kafka/deployments","created_at":"2011-08-15T18:06:16Z","updated_at":"2019-09-25T16:23:07Z","pushed_at":"2019-09-25T18:05:23Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":87728,"stargazers_count":13663,"watchers_count":13663,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7252,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":673,"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":7252,"open_issues":673,"watchers":13663,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/7377"},"html":{"href":"https://github.com/apache/kafka/pull/7377"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/7377"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/7377/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/7377/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/7377/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/39e8692d1c96446d120225a768ac89271d19c4f4"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hachikuji"}}