{"action":"created","comment":{"url":"https://api.github.com/repos/Alluxio/alluxio/pulls/comments/65755216","id":65755216,"diff_hunk":"@@ -69,7 +72,8 @@ protected void schedule() {\n     try (LockResource r = new LockResource(mLock)) {\n       Preconditions.checkState(!mScheduled, \"Called schedule twice without waiting for any ticks\");\n       mScheduled = true;\n-      mCondition.signal();\n+      mTickCondition.signal();\n+      HeartbeatScheduler.removeTimer(this);","path":"core/common/src/main/java/alluxio/heartbeat/ScheduledTimer.java","position":28,"original_position":28,"commit_id":"45bacd082589623e7ea09ea99692d809163aee2a","original_commit_id":"3b072495690af19b0126496722597059a571985e","user":{"login":"aaudiber","id":3455177,"avatar_url":"https://avatars.githubusercontent.com/u/3455177?v=3","gravatar_id":"","url":"https://api.github.com/users/aaudiber","html_url":"https://github.com/aaudiber","followers_url":"https://api.github.com/users/aaudiber/followers","following_url":"https://api.github.com/users/aaudiber/following{/other_user}","gists_url":"https://api.github.com/users/aaudiber/gists{/gist_id}","starred_url":"https://api.github.com/users/aaudiber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaudiber/subscriptions","organizations_url":"https://api.github.com/users/aaudiber/orgs","repos_url":"https://api.github.com/users/aaudiber/repos","events_url":"https://api.github.com/users/aaudiber/events{/privacy}","received_events_url":"https://api.github.com/users/aaudiber/received_events","type":"User","site_admin":false},"body":"There aren't any expected exceptions that `signal` could throw, but if it throws an unexpected exception it will propagate and fail the test.","created_at":"2016-06-03T18:32:47Z","updated_at":"2016-06-03T18:32:47Z","html_url":"https://github.com/Alluxio/alluxio/pull/3445#discussion_r65755216","pull_request_url":"https://api.github.com/repos/Alluxio/alluxio/pulls/3445","_links":{"self":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/comments/65755216"},"html":{"href":"https://github.com/Alluxio/alluxio/pull/3445#discussion_r65755216"},"pull_request":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/3445"}}},"pull_request":{"url":"https://api.github.com/repos/Alluxio/alluxio/pulls/3445","id":72445984,"html_url":"https://github.com/Alluxio/alluxio/pull/3445","diff_url":"https://github.com/Alluxio/alluxio/pull/3445.diff","patch_url":"https://github.com/Alluxio/alluxio/pull/3445.patch","issue_url":"https://api.github.com/repos/Alluxio/alluxio/issues/3445","number":3445,"state":"open","locked":false,"title":"[ALLUXIO-1975] Fix issue with manual heartbeat scheduling","user":{"login":"aaudiber","id":3455177,"avatar_url":"https://avatars.githubusercontent.com/u/3455177?v=3","gravatar_id":"","url":"https://api.github.com/users/aaudiber","html_url":"https://github.com/aaudiber","followers_url":"https://api.github.com/users/aaudiber/followers","following_url":"https://api.github.com/users/aaudiber/following{/other_user}","gists_url":"https://api.github.com/users/aaudiber/gists{/gist_id}","starred_url":"https://api.github.com/users/aaudiber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaudiber/subscriptions","organizations_url":"https://api.github.com/users/aaudiber/orgs","repos_url":"https://api.github.com/users/aaudiber/repos","events_url":"https://api.github.com/users/aaudiber/events{/privacy}","received_events_url":"https://api.github.com/users/aaudiber/received_events","type":"User","site_admin":false},"body":"https://alluxio.atlassian.net/browse/ALLUXIO-1975\r\n\r\nPreviously we had flakiness due to the following flow:\r\n\r\n1. Unit test 1 creates a Master, e.g. FileSystemMaster, which uses a heartbeat thread. The heartbeat thread X is initialized to use the scheduled timer.\r\n2. The scheduled timer becomes ready to schedule and adds itself to the `sTimers` map in `HeartbeatScheduler`. This creates a mapping from the string \"X\" to the timer object.\r\n3. The test calls schedule, removing the timer from `sTimers` and executing a heartbeat. After the heartbeat has executed, the timer adds itself back to `sTimers`.\r\n4. Unit test 1 ends and the Master is stopped. `sTimers` is static and doesn't care (it still holds the mapping from \"X\" to the timer).\r\n5. Unit test 2 begins and creates a new Master and new timer named \"X\"\r\n6. Unit test 2 calls `HeartbeatScheduler.await()` to wait for the timer to become ready to schedule. This call immediately returns because the key \"X\" exists in the `sTimers` map. This indicates to the test that it's safe to call `schedule` even though the timer is not actually ready to schedule.\r\n7. The test fails because it relied on the heartbeat happening, but it never actually happened.\r\n\r\nThis issue is resolved by having timers clear their name from `sTimers` when they are constructed so that their past incarnations can't make it look like they are ready to schedule.\r\n\r\nThis pattern probably applies to more unit tests than just the one in ALLUXIO-1975.","created_at":"2016-06-03T02:32:33Z","updated_at":"2016-06-03T18:32:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"697ec2475e05856460809a05ea23fb4e45ef90b7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Alluxio/alluxio/pulls/3445/commits","review_comments_url":"https://api.github.com/repos/Alluxio/alluxio/pulls/3445/comments","review_comment_url":"https://api.github.com/repos/Alluxio/alluxio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Alluxio/alluxio/issues/3445/comments","statuses_url":"https://api.github.com/repos/Alluxio/alluxio/statuses/45bacd082589623e7ea09ea99692d809163aee2a","head":{"label":"aaudiber:deflake","ref":"deflake","sha":"45bacd082589623e7ea09ea99692d809163aee2a","user":{"login":"aaudiber","id":3455177,"avatar_url":"https://avatars.githubusercontent.com/u/3455177?v=3","gravatar_id":"","url":"https://api.github.com/users/aaudiber","html_url":"https://github.com/aaudiber","followers_url":"https://api.github.com/users/aaudiber/followers","following_url":"https://api.github.com/users/aaudiber/following{/other_user}","gists_url":"https://api.github.com/users/aaudiber/gists{/gist_id}","starred_url":"https://api.github.com/users/aaudiber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaudiber/subscriptions","organizations_url":"https://api.github.com/users/aaudiber/orgs","repos_url":"https://api.github.com/users/aaudiber/repos","events_url":"https://api.github.com/users/aaudiber/events{/privacy}","received_events_url":"https://api.github.com/users/aaudiber/received_events","type":"User","site_admin":false},"repo":{"id":52421920,"name":"alluxio","full_name":"aaudiber/alluxio","owner":{"login":"aaudiber","id":3455177,"avatar_url":"https://avatars.githubusercontent.com/u/3455177?v=3","gravatar_id":"","url":"https://api.github.com/users/aaudiber","html_url":"https://github.com/aaudiber","followers_url":"https://api.github.com/users/aaudiber/followers","following_url":"https://api.github.com/users/aaudiber/following{/other_user}","gists_url":"https://api.github.com/users/aaudiber/gists{/gist_id}","starred_url":"https://api.github.com/users/aaudiber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaudiber/subscriptions","organizations_url":"https://api.github.com/users/aaudiber/orgs","repos_url":"https://api.github.com/users/aaudiber/repos","events_url":"https://api.github.com/users/aaudiber/events{/privacy}","received_events_url":"https://api.github.com/users/aaudiber/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aaudiber/alluxio","description":"Memory-Centric Virtual Distributed Storage System","fork":true,"url":"https://api.github.com/repos/aaudiber/alluxio","forks_url":"https://api.github.com/repos/aaudiber/alluxio/forks","keys_url":"https://api.github.com/repos/aaudiber/alluxio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aaudiber/alluxio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aaudiber/alluxio/teams","hooks_url":"https://api.github.com/repos/aaudiber/alluxio/hooks","issue_events_url":"https://api.github.com/repos/aaudiber/alluxio/issues/events{/number}","events_url":"https://api.github.com/repos/aaudiber/alluxio/events","assignees_url":"https://api.github.com/repos/aaudiber/alluxio/assignees{/user}","branches_url":"https://api.github.com/repos/aaudiber/alluxio/branches{/branch}","tags_url":"https://api.github.com/repos/aaudiber/alluxio/tags","blobs_url":"https://api.github.com/repos/aaudiber/alluxio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aaudiber/alluxio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aaudiber/alluxio/git/refs{/sha}","trees_url":"https://api.github.com/repos/aaudiber/alluxio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aaudiber/alluxio/statuses/{sha}","languages_url":"https://api.github.com/repos/aaudiber/alluxio/languages","stargazers_url":"https://api.github.com/repos/aaudiber/alluxio/stargazers","contributors_url":"https://api.github.com/repos/aaudiber/alluxio/contributors","subscribers_url":"https://api.github.com/repos/aaudiber/alluxio/subscribers","subscription_url":"https://api.github.com/repos/aaudiber/alluxio/subscription","commits_url":"https://api.github.com/repos/aaudiber/alluxio/commits{/sha}","git_commits_url":"https://api.github.com/repos/aaudiber/alluxio/git/commits{/sha}","comments_url":"https://api.github.com/repos/aaudiber/alluxio/comments{/number}","issue_comment_url":"https://api.github.com/repos/aaudiber/alluxio/issues/comments{/number}","contents_url":"https://api.github.com/repos/aaudiber/alluxio/contents/{+path}","compare_url":"https://api.github.com/repos/aaudiber/alluxio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aaudiber/alluxio/merges","archive_url":"https://api.github.com/repos/aaudiber/alluxio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aaudiber/alluxio/downloads","issues_url":"https://api.github.com/repos/aaudiber/alluxio/issues{/number}","pulls_url":"https://api.github.com/repos/aaudiber/alluxio/pulls{/number}","milestones_url":"https://api.github.com/repos/aaudiber/alluxio/milestones{/number}","notifications_url":"https://api.github.com/repos/aaudiber/alluxio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aaudiber/alluxio/labels{/name}","releases_url":"https://api.github.com/repos/aaudiber/alluxio/releases{/id}","deployments_url":"https://api.github.com/repos/aaudiber/alluxio/deployments","created_at":"2016-02-24T07:07:15Z","updated_at":"2016-02-24T07:07:19Z","pushed_at":"2016-06-03T18:32:31Z","git_url":"git://github.com/aaudiber/alluxio.git","ssh_url":"git@github.com:aaudiber/alluxio.git","clone_url":"https://github.com/aaudiber/alluxio.git","svn_url":"https://github.com/aaudiber/alluxio","homepage":"http://www.alluxio.org/","size":54811,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"Alluxio:master","ref":"master","sha":"653338c43deb6d0d082970bbf638825491782685","user":{"login":"Alluxio","id":16203694,"avatar_url":"https://avatars.githubusercontent.com/u/16203694?v=3","gravatar_id":"","url":"https://api.github.com/users/Alluxio","html_url":"https://github.com/Alluxio","followers_url":"https://api.github.com/users/Alluxio/followers","following_url":"https://api.github.com/users/Alluxio/following{/other_user}","gists_url":"https://api.github.com/users/Alluxio/gists{/gist_id}","starred_url":"https://api.github.com/users/Alluxio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alluxio/subscriptions","organizations_url":"https://api.github.com/users/Alluxio/orgs","repos_url":"https://api.github.com/users/Alluxio/repos","events_url":"https://api.github.com/users/Alluxio/events{/privacy}","received_events_url":"https://api.github.com/users/Alluxio/received_events","type":"Organization","site_admin":false},"repo":{"id":7276954,"name":"alluxio","full_name":"Alluxio/alluxio","owner":{"login":"Alluxio","id":16203694,"avatar_url":"https://avatars.githubusercontent.com/u/16203694?v=3","gravatar_id":"","url":"https://api.github.com/users/Alluxio","html_url":"https://github.com/Alluxio","followers_url":"https://api.github.com/users/Alluxio/followers","following_url":"https://api.github.com/users/Alluxio/following{/other_user}","gists_url":"https://api.github.com/users/Alluxio/gists{/gist_id}","starred_url":"https://api.github.com/users/Alluxio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alluxio/subscriptions","organizations_url":"https://api.github.com/users/Alluxio/orgs","repos_url":"https://api.github.com/users/Alluxio/repos","events_url":"https://api.github.com/users/Alluxio/events{/privacy}","received_events_url":"https://api.github.com/users/Alluxio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Alluxio/alluxio","description":"Alluxio, formerly Tachyon, Memory Speed Virtual Distributed Storage System","fork":false,"url":"https://api.github.com/repos/Alluxio/alluxio","forks_url":"https://api.github.com/repos/Alluxio/alluxio/forks","keys_url":"https://api.github.com/repos/Alluxio/alluxio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alluxio/alluxio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alluxio/alluxio/teams","hooks_url":"https://api.github.com/repos/Alluxio/alluxio/hooks","issue_events_url":"https://api.github.com/repos/Alluxio/alluxio/issues/events{/number}","events_url":"https://api.github.com/repos/Alluxio/alluxio/events","assignees_url":"https://api.github.com/repos/Alluxio/alluxio/assignees{/user}","branches_url":"https://api.github.com/repos/Alluxio/alluxio/branches{/branch}","tags_url":"https://api.github.com/repos/Alluxio/alluxio/tags","blobs_url":"https://api.github.com/repos/Alluxio/alluxio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alluxio/alluxio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alluxio/alluxio/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alluxio/alluxio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alluxio/alluxio/statuses/{sha}","languages_url":"https://api.github.com/repos/Alluxio/alluxio/languages","stargazers_url":"https://api.github.com/repos/Alluxio/alluxio/stargazers","contributors_url":"https://api.github.com/repos/Alluxio/alluxio/contributors","subscribers_url":"https://api.github.com/repos/Alluxio/alluxio/subscribers","subscription_url":"https://api.github.com/repos/Alluxio/alluxio/subscription","commits_url":"https://api.github.com/repos/Alluxio/alluxio/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alluxio/alluxio/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alluxio/alluxio/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alluxio/alluxio/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alluxio/alluxio/contents/{+path}","compare_url":"https://api.github.com/repos/Alluxio/alluxio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alluxio/alluxio/merges","archive_url":"https://api.github.com/repos/Alluxio/alluxio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alluxio/alluxio/downloads","issues_url":"https://api.github.com/repos/Alluxio/alluxio/issues{/number}","pulls_url":"https://api.github.com/repos/Alluxio/alluxio/pulls{/number}","milestones_url":"https://api.github.com/repos/Alluxio/alluxio/milestones{/number}","notifications_url":"https://api.github.com/repos/Alluxio/alluxio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alluxio/alluxio/labels{/name}","releases_url":"https://api.github.com/repos/Alluxio/alluxio/releases{/id}","deployments_url":"https://api.github.com/repos/Alluxio/alluxio/deployments","created_at":"2012-12-21T17:43:46Z","updated_at":"2016-06-03T17:47:02Z","pushed_at":"2016-06-03T18:32:32Z","git_url":"git://github.com/Alluxio/alluxio.git","ssh_url":"git@github.com:Alluxio/alluxio.git","clone_url":"https://github.com/Alluxio/alluxio.git","svn_url":"https://github.com/Alluxio/alluxio","homepage":"http://www.alluxio.org/","size":85685,"stargazers_count":2385,"watchers_count":2385,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":947,"mirror_url":null,"open_issues_count":18,"forks":947,"open_issues":18,"watchers":2385,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/3445"},"html":{"href":"https://github.com/Alluxio/alluxio/pull/3445"},"issue":{"href":"https://api.github.com/repos/Alluxio/alluxio/issues/3445"},"comments":{"href":"https://api.github.com/repos/Alluxio/alluxio/issues/3445/comments"},"review_comments":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/3445/comments"},"review_comment":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/3445/commits"},"statuses":{"href":"https://api.github.com/repos/Alluxio/alluxio/statuses/45bacd082589623e7ea09ea99692d809163aee2a"}}}}
{"actor":{"display_login":"aaudiber"}}