{"action":"created","comment":{"url":"https://api.github.com/repos/vmware/vic/pulls/comments/83115136","pull_request_review_id":3977582,"id":83115136,"diff_hunk":"@@ -150,46 +170,65 @@ func (t *attachServerSSH) start() error {\n func (t *attachServerSSH) stop() {\n \tdefer trace.End(trace.Begin(\"stop attach server\"))\n \n-\tif t == nil || !t.enabled {\n+\tif t == nil || !t.IsEnabled() {\n \t\treturn\n \t}\n \n-\tt.enabled = false\n-\tconn := t.conn\n-\tt.conn = nil\n+\tt.Disabled()\n+\n+\tt.conn.Lock()\n+\tconn := t.conn.conn\n+\tt.conn.conn = nil\n \n \tif conn != nil {\n \t\t(*conn).Close()\n \t}\n+\tt.conn.Unlock()\n+\n }\n \n // run should not be called directly, but via start\n // run will establish an ssh server listening on the backchannel\n func (t *attachServerSSH) run() error {\n \tdefer trace.End(trace.Begin(\"main attach server loop\"))\n \n-\tvar serverConn *ssh.ServerConn\n+\tvar serverConn struct {\n+\t\tsync.Mutex\n+\t\t*ssh.ServerConn\n+\t}\n+\tvar established bool\n+\n \tvar chans <-chan ssh.NewChannel\n \tvar reqs <-chan *ssh.Request\n \tvar err error\n \n-\tfor t.enabled {\n+\tfor t.IsEnabled() {\n+\t\tserverConn.Lock()\n+\t\testablished = serverConn.ServerConn != nil\n+\t\tserverConn.Unlock()\n \t\t// keep waiting for the connection to establish\n-\t\tfor serverConn == nil {\n+\t\tfor !established {\n+\t\t\tlog.Debugf(\"Trying to establish a connection\")\n \t\t\t// tests are passing their own connections so do not create connections when testing is set\n \t\t\tif !t.testing {\n+\t\t\t\tt.conn.Lock()","path":"cmd/tether/attach.go","position":118,"original_position":118,"commit_id":"3f7dc9eb6b5a53f7f66502fdc60b668d2f82f2ad","original_commit_id":"3f7dc9eb6b5a53f7f66502fdc60b668d2f82f2ad","user":{"login":"caglar10ur","id":205498,"avatar_url":"https://avatars.githubusercontent.com/u/205498?v=3","gravatar_id":"","url":"https://api.github.com/users/caglar10ur","html_url":"https://github.com/caglar10ur","followers_url":"https://api.github.com/users/caglar10ur/followers","following_url":"https://api.github.com/users/caglar10ur/following{/other_user}","gists_url":"https://api.github.com/users/caglar10ur/gists{/gist_id}","starred_url":"https://api.github.com/users/caglar10ur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caglar10ur/subscriptions","organizations_url":"https://api.github.com/users/caglar10ur/orgs","repos_url":"https://api.github.com/users/caglar10ur/repos","events_url":"https://api.github.com/users/caglar10ur/events{/privacy}","received_events_url":"https://api.github.com/users/caglar10ur/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2016-10-12T22:48:43Z","updated_at":"2016-10-12T22:48:43Z","html_url":"https://github.com/vmware/vic/pull/2702#discussion_r83115136","pull_request_url":"https://api.github.com/repos/vmware/vic/pulls/2702","_links":{"self":{"href":"https://api.github.com/repos/vmware/vic/pulls/comments/83115136"},"html":{"href":"https://github.com/vmware/vic/pull/2702#discussion_r83115136"},"pull_request":{"href":"https://api.github.com/repos/vmware/vic/pulls/2702"}}},"pull_request":{"url":"https://api.github.com/repos/vmware/vic/pulls/2702","id":89103407,"html_url":"https://github.com/vmware/vic/pull/2702","diff_url":"https://github.com/vmware/vic/pull/2702.diff","patch_url":"https://github.com/vmware/vic/pull/2702.patch","issue_url":"https://api.github.com/repos/vmware/vic/issues/2702","number":2702,"state":"open","locked":false,"title":"[full ci] Fix multiple data races reported by race detector","user":{"login":"caglar10ur","id":205498,"avatar_url":"https://avatars.githubusercontent.com/u/205498?v=3","gravatar_id":"","url":"https://api.github.com/users/caglar10ur","html_url":"https://github.com/caglar10ur","followers_url":"https://api.github.com/users/caglar10ur/followers","following_url":"https://api.github.com/users/caglar10ur/following{/other_user}","gists_url":"https://api.github.com/users/caglar10ur/gists{/gist_id}","starred_url":"https://api.github.com/users/caglar10ur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caglar10ur/subscriptions","organizations_url":"https://api.github.com/users/caglar10ur/orgs","repos_url":"https://api.github.com/users/caglar10ur/repos","events_url":"https://api.github.com/users/caglar10ur/events{/privacy}","received_events_url":"https://api.github.com/users/caglar10ur/received_events","type":"User","site_admin":false},"body":"- attachServerSSH uses sync/atomic to get/set enabled value as there was\r\na race between stop and run\r\n\r\n- underlying *net.Conn is now protected by its own mutex as there was a\r\nrace between stop and run\r\n\r\n- *ssh.ServerConn is now protected by its own mutex as we are sending\r\nit to channel mux (as a part of the cleanup function)\r\n\r\n- incoming signals channel in tether is now accompanied by another\r\nchannel called done. Its whole purpose is to stop the reaper loop after we\r\nclose the incoming channel. Without this we keep reading from it.\r\n\r\nFixes #2647, #2646 and #2330","created_at":"2016-10-12T22:10:10Z","updated_at":"2016-10-12T22:48:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72d879390d1279579a9bcdf84417dcff79613dec","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vmware/vic/pulls/2702/commits","review_comments_url":"https://api.github.com/repos/vmware/vic/pulls/2702/comments","review_comment_url":"https://api.github.com/repos/vmware/vic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vmware/vic/issues/2702/comments","statuses_url":"https://api.github.com/repos/vmware/vic/statuses/3f7dc9eb6b5a53f7f66502fdc60b668d2f82f2ad","head":{"label":"caglar10ur:tether","ref":"tether","sha":"3f7dc9eb6b5a53f7f66502fdc60b668d2f82f2ad","user":{"login":"caglar10ur","id":205498,"avatar_url":"https://avatars.githubusercontent.com/u/205498?v=3","gravatar_id":"","url":"https://api.github.com/users/caglar10ur","html_url":"https://github.com/caglar10ur","followers_url":"https://api.github.com/users/caglar10ur/followers","following_url":"https://api.github.com/users/caglar10ur/following{/other_user}","gists_url":"https://api.github.com/users/caglar10ur/gists{/gist_id}","starred_url":"https://api.github.com/users/caglar10ur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caglar10ur/subscriptions","organizations_url":"https://api.github.com/users/caglar10ur/orgs","repos_url":"https://api.github.com/users/caglar10ur/repos","events_url":"https://api.github.com/users/caglar10ur/events{/privacy}","received_events_url":"https://api.github.com/users/caglar10ur/received_events","type":"User","site_admin":false},"repo":{"id":55449160,"name":"vic","full_name":"caglar10ur/vic","owner":{"login":"caglar10ur","id":205498,"avatar_url":"https://avatars.githubusercontent.com/u/205498?v=3","gravatar_id":"","url":"https://api.github.com/users/caglar10ur","html_url":"https://github.com/caglar10ur","followers_url":"https://api.github.com/users/caglar10ur/followers","following_url":"https://api.github.com/users/caglar10ur/following{/other_user}","gists_url":"https://api.github.com/users/caglar10ur/gists{/gist_id}","starred_url":"https://api.github.com/users/caglar10ur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caglar10ur/subscriptions","organizations_url":"https://api.github.com/users/caglar10ur/orgs","repos_url":"https://api.github.com/users/caglar10ur/repos","events_url":"https://api.github.com/users/caglar10ur/events{/privacy}","received_events_url":"https://api.github.com/users/caglar10ur/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/caglar10ur/vic","description":"Integrated containers on vSphere","fork":true,"url":"https://api.github.com/repos/caglar10ur/vic","forks_url":"https://api.github.com/repos/caglar10ur/vic/forks","keys_url":"https://api.github.com/repos/caglar10ur/vic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caglar10ur/vic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caglar10ur/vic/teams","hooks_url":"https://api.github.com/repos/caglar10ur/vic/hooks","issue_events_url":"https://api.github.com/repos/caglar10ur/vic/issues/events{/number}","events_url":"https://api.github.com/repos/caglar10ur/vic/events","assignees_url":"https://api.github.com/repos/caglar10ur/vic/assignees{/user}","branches_url":"https://api.github.com/repos/caglar10ur/vic/branches{/branch}","tags_url":"https://api.github.com/repos/caglar10ur/vic/tags","blobs_url":"https://api.github.com/repos/caglar10ur/vic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caglar10ur/vic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caglar10ur/vic/git/refs{/sha}","trees_url":"https://api.github.com/repos/caglar10ur/vic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caglar10ur/vic/statuses/{sha}","languages_url":"https://api.github.com/repos/caglar10ur/vic/languages","stargazers_url":"https://api.github.com/repos/caglar10ur/vic/stargazers","contributors_url":"https://api.github.com/repos/caglar10ur/vic/contributors","subscribers_url":"https://api.github.com/repos/caglar10ur/vic/subscribers","subscription_url":"https://api.github.com/repos/caglar10ur/vic/subscription","commits_url":"https://api.github.com/repos/caglar10ur/vic/commits{/sha}","git_commits_url":"https://api.github.com/repos/caglar10ur/vic/git/commits{/sha}","comments_url":"https://api.github.com/repos/caglar10ur/vic/comments{/number}","issue_comment_url":"https://api.github.com/repos/caglar10ur/vic/issues/comments{/number}","contents_url":"https://api.github.com/repos/caglar10ur/vic/contents/{+path}","compare_url":"https://api.github.com/repos/caglar10ur/vic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caglar10ur/vic/merges","archive_url":"https://api.github.com/repos/caglar10ur/vic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caglar10ur/vic/downloads","issues_url":"https://api.github.com/repos/caglar10ur/vic/issues{/number}","pulls_url":"https://api.github.com/repos/caglar10ur/vic/pulls{/number}","milestones_url":"https://api.github.com/repos/caglar10ur/vic/milestones{/number}","notifications_url":"https://api.github.com/repos/caglar10ur/vic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caglar10ur/vic/labels{/name}","releases_url":"https://api.github.com/repos/caglar10ur/vic/releases{/id}","deployments_url":"https://api.github.com/repos/caglar10ur/vic/deployments","created_at":"2016-04-04T22:13:10Z","updated_at":"2016-04-04T22:13:12Z","pushed_at":"2016-10-12T22:18:06Z","git_url":"git://github.com/caglar10ur/vic.git","ssh_url":"git@github.com:caglar10ur/vic.git","clone_url":"https://github.com/caglar10ur/vic.git","svn_url":"https://github.com/caglar10ur/vic","homepage":null,"size":29758,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"vmware:master","ref":"master","sha":"02834ba57c4b247ef41c6a734712534a8be8ee53","user":{"login":"vmware","id":473334,"avatar_url":"https://avatars.githubusercontent.com/u/473334?v=3","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"repo":{"id":49597898,"name":"vic","full_name":"vmware/vic","owner":{"login":"vmware","id":473334,"avatar_url":"https://avatars.githubusercontent.com/u/473334?v=3","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vmware/vic","description":"Integrated containers engine on vSphere","fork":false,"url":"https://api.github.com/repos/vmware/vic","forks_url":"https://api.github.com/repos/vmware/vic/forks","keys_url":"https://api.github.com/repos/vmware/vic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vmware/vic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vmware/vic/teams","hooks_url":"https://api.github.com/repos/vmware/vic/hooks","issue_events_url":"https://api.github.com/repos/vmware/vic/issues/events{/number}","events_url":"https://api.github.com/repos/vmware/vic/events","assignees_url":"https://api.github.com/repos/vmware/vic/assignees{/user}","branches_url":"https://api.github.com/repos/vmware/vic/branches{/branch}","tags_url":"https://api.github.com/repos/vmware/vic/tags","blobs_url":"https://api.github.com/repos/vmware/vic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vmware/vic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vmware/vic/git/refs{/sha}","trees_url":"https://api.github.com/repos/vmware/vic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vmware/vic/statuses/{sha}","languages_url":"https://api.github.com/repos/vmware/vic/languages","stargazers_url":"https://api.github.com/repos/vmware/vic/stargazers","contributors_url":"https://api.github.com/repos/vmware/vic/contributors","subscribers_url":"https://api.github.com/repos/vmware/vic/subscribers","subscription_url":"https://api.github.com/repos/vmware/vic/subscription","commits_url":"https://api.github.com/repos/vmware/vic/commits{/sha}","git_commits_url":"https://api.github.com/repos/vmware/vic/git/commits{/sha}","comments_url":"https://api.github.com/repos/vmware/vic/comments{/number}","issue_comment_url":"https://api.github.com/repos/vmware/vic/issues/comments{/number}","contents_url":"https://api.github.com/repos/vmware/vic/contents/{+path}","compare_url":"https://api.github.com/repos/vmware/vic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vmware/vic/merges","archive_url":"https://api.github.com/repos/vmware/vic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vmware/vic/downloads","issues_url":"https://api.github.com/repos/vmware/vic/issues{/number}","pulls_url":"https://api.github.com/repos/vmware/vic/pulls{/number}","milestones_url":"https://api.github.com/repos/vmware/vic/milestones{/number}","notifications_url":"https://api.github.com/repos/vmware/vic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vmware/vic/labels{/name}","releases_url":"https://api.github.com/repos/vmware/vic/releases{/id}","deployments_url":"https://api.github.com/repos/vmware/vic/deployments","created_at":"2016-01-13T19:53:57Z","updated_at":"2016-10-10T03:44:55Z","pushed_at":"2016-10-12T22:44:16Z","git_url":"git://github.com/vmware/vic.git","ssh_url":"git@github.com:vmware/vic.git","clone_url":"https://github.com/vmware/vic.git","svn_url":"https://github.com/vmware/vic","homepage":"","size":83404,"stargazers_count":139,"watchers_count":139,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":53,"mirror_url":null,"open_issues_count":476,"forks":53,"open_issues":476,"watchers":139,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vmware/vic/pulls/2702"},"html":{"href":"https://github.com/vmware/vic/pull/2702"},"issue":{"href":"https://api.github.com/repos/vmware/vic/issues/2702"},"comments":{"href":"https://api.github.com/repos/vmware/vic/issues/2702/comments"},"review_comments":{"href":"https://api.github.com/repos/vmware/vic/pulls/2702/comments"},"review_comment":{"href":"https://api.github.com/repos/vmware/vic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vmware/vic/pulls/2702/commits"},"statuses":{"href":"https://api.github.com/repos/vmware/vic/statuses/3f7dc9eb6b5a53f7f66502fdc60b668d2f82f2ad"}}}}
{"actor":{"display_login":"caglar10ur"}}