{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/32211267","id":32211267,"diff_hunk":"@@ -166,26 +168,28 @@ func makeHookPod(hook *deployapi.LifecycleHook, deployment *kapi.ReplicationCont\n // HookExecutorPodClient abstracts access to pods.\n type HookExecutorPodClient interface {\n \tCreatePod(namespace string, pod *kapi.Pod) (*kapi.Pod, error)\n-\tPodWatch(namespace, name, resourceVersion string) func() *kapi.Pod\n+\tPodWatch(namespace, name, resourceVersion string) (func() *kapi.Pod, chan struct{})\n }\n \n // HookExecutorPodClientImpl is a pluggable HookExecutorPodClient.\n type HookExecutorPodClientImpl struct {\n \tCreatePodFunc func(namespace string, pod *kapi.Pod) (*kapi.Pod, error)\n-\tPodWatchFunc  func(namespace, name, resourceVersion string) func() *kapi.Pod\n+\tPodWatchFunc  func(namespace, name, resourceVersion string) (func() *kapi.Pod, chan struct{})\n }\n \n func (i *HookExecutorPodClientImpl) CreatePod(namespace string, pod *kapi.Pod) (*kapi.Pod, error) {\n \treturn i.CreatePodFunc(namespace, pod)\n }\n \n-func (i *HookExecutorPodClientImpl) PodWatch(namespace, name, resourceVersion string) func() *kapi.Pod {\n+func (i *HookExecutorPodClientImpl) PodWatch(namespace, name, resourceVersion string) (func() *kapi.Pod, chan struct{}) {\n \treturn i.PodWatchFunc(namespace, name, resourceVersion)\n }\n \n // NewPodWatch creates a pod watching function which is backed by a\n // FIFO/reflector pair. This avoids managing watches directly.\n-func NewPodWatch(client kclient.Interface, namespace, name, resourceVersion string) func() *kapi.Pod {\n+// A stop channel to close the watch's reflector is also returned.\n+// It is the caller's responsibility to defer closing the stop channel to prevent leaking resources.\n+func NewPodWatch(client kclient.Interface, namespace, name, resourceVersion string) (func() *kapi.Pod, chan struct{}) {","path":"pkg/deploy/strategy/support/lifecycle.go","position":40,"original_position":40,"commit_id":"de61003a4a039521a61405e9db46b46ded16a1d9","original_commit_id":"de61003a4a039521a61405e9db46b46ded16a1d9","user":{"login":"ironcladlou","id":298299,"avatar_url":"https://avatars.githubusercontent.com/u/298299?v=3","gravatar_id":"","url":"https://api.github.com/users/ironcladlou","html_url":"https://github.com/ironcladlou","followers_url":"https://api.github.com/users/ironcladlou/followers","following_url":"https://api.github.com/users/ironcladlou/following{/other_user}","gists_url":"https://api.github.com/users/ironcladlou/gists{/gist_id}","starred_url":"https://api.github.com/users/ironcladlou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ironcladlou/subscriptions","organizations_url":"https://api.github.com/users/ironcladlou/orgs","repos_url":"https://api.github.com/users/ironcladlou/repos","events_url":"https://api.github.com/users/ironcladlou/events{/privacy}","received_events_url":"https://api.github.com/users/ironcladlou/received_events","type":"User","site_admin":false},"body":"`HookExecutorPodClient.PodWatch` has to change one way or the other (to take or return a channel). The [consuming code](https://github.com/openshift/origin/blob/master/pkg/deploy/strategy/support/lifecycle.go#L82) doesn't call `NewPodWatch` directly.","created_at":"2015-06-11T11:23:14Z","updated_at":"2015-06-11T11:23:14Z","html_url":"https://github.com/openshift/origin/pull/3078#discussion_r32211267","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/3078","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/32211267"},"html":{"href":"https://github.com/openshift/origin/pull/3078#discussion_r32211267"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/3078"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/3078","id":37408409,"html_url":"https://github.com/openshift/origin/pull/3078","diff_url":"https://github.com/openshift/origin/pull/3078.diff","patch_url":"https://github.com/openshift/origin/pull/3078.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/3078","number":3078,"state":"open","locked":false,"title":"Added stop channel to watched pods to prevent thread leak","user":{"login":"markturansky","id":8001968,"avatar_url":"https://avatars.githubusercontent.com/u/8001968?v=3","gravatar_id":"","url":"https://api.github.com/users/markturansky","html_url":"https://github.com/markturansky","followers_url":"https://api.github.com/users/markturansky/followers","following_url":"https://api.github.com/users/markturansky/following{/other_user}","gists_url":"https://api.github.com/users/markturansky/gists{/gist_id}","starred_url":"https://api.github.com/users/markturansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markturansky/subscriptions","organizations_url":"https://api.github.com/users/markturansky/orgs","repos_url":"https://api.github.com/users/markturansky/repos","events_url":"https://api.github.com/users/markturansky/events{/privacy}","received_events_url":"https://api.github.com/users/markturansky/received_events","type":"User","site_admin":false},"body":"Resolves #2869.\r\n\r\n@ironcladlou @abhgupta \r\n\r\nEdit:   Fixed the thread leak by returning a stop channel created at the same time/place where the reflector is created and started.  The caller of the watch is responsible for a deferred close on the channel.\r\n","created_at":"2015-06-10T21:48:52Z","updated_at":"2015-06-11T11:23:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93374bea55c7feb6a8fcf00c7c32c1803aabdda3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/3078/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/3078/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/3078/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/de61003a4a039521a61405e9db46b46ded16a1d9","head":{"label":"markturansky:thread_leak_fix","ref":"thread_leak_fix","sha":"de61003a4a039521a61405e9db46b46ded16a1d9","user":{"login":"markturansky","id":8001968,"avatar_url":"https://avatars.githubusercontent.com/u/8001968?v=3","gravatar_id":"","url":"https://api.github.com/users/markturansky","html_url":"https://github.com/markturansky","followers_url":"https://api.github.com/users/markturansky/followers","following_url":"https://api.github.com/users/markturansky/following{/other_user}","gists_url":"https://api.github.com/users/markturansky/gists{/gist_id}","starred_url":"https://api.github.com/users/markturansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markturansky/subscriptions","organizations_url":"https://api.github.com/users/markturansky/orgs","repos_url":"https://api.github.com/users/markturansky/repos","events_url":"https://api.github.com/users/markturansky/events{/privacy}","received_events_url":"https://api.github.com/users/markturansky/received_events","type":"User","site_admin":false},"repo":{"id":24418520,"name":"origin","full_name":"markturansky/origin","owner":{"login":"markturansky","id":8001968,"avatar_url":"https://avatars.githubusercontent.com/u/8001968?v=3","gravatar_id":"","url":"https://api.github.com/users/markturansky","html_url":"https://github.com/markturansky","followers_url":"https://api.github.com/users/markturansky/followers","following_url":"https://api.github.com/users/markturansky/following{/other_user}","gists_url":"https://api.github.com/users/markturansky/gists{/gist_id}","starred_url":"https://api.github.com/users/markturansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markturansky/subscriptions","organizations_url":"https://api.github.com/users/markturansky/orgs","repos_url":"https://api.github.com/users/markturansky/repos","events_url":"https://api.github.com/users/markturansky/events{/privacy}","received_events_url":"https://api.github.com/users/markturansky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/markturansky/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/markturansky/origin","forks_url":"https://api.github.com/repos/markturansky/origin/forks","keys_url":"https://api.github.com/repos/markturansky/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/markturansky/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/markturansky/origin/teams","hooks_url":"https://api.github.com/repos/markturansky/origin/hooks","issue_events_url":"https://api.github.com/repos/markturansky/origin/issues/events{/number}","events_url":"https://api.github.com/repos/markturansky/origin/events","assignees_url":"https://api.github.com/repos/markturansky/origin/assignees{/user}","branches_url":"https://api.github.com/repos/markturansky/origin/branches{/branch}","tags_url":"https://api.github.com/repos/markturansky/origin/tags","blobs_url":"https://api.github.com/repos/markturansky/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/markturansky/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/markturansky/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/markturansky/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/markturansky/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/markturansky/origin/languages","stargazers_url":"https://api.github.com/repos/markturansky/origin/stargazers","contributors_url":"https://api.github.com/repos/markturansky/origin/contributors","subscribers_url":"https://api.github.com/repos/markturansky/origin/subscribers","subscription_url":"https://api.github.com/repos/markturansky/origin/subscription","commits_url":"https://api.github.com/repos/markturansky/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/markturansky/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/markturansky/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/markturansky/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/markturansky/origin/contents/{+path}","compare_url":"https://api.github.com/repos/markturansky/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/markturansky/origin/merges","archive_url":"https://api.github.com/repos/markturansky/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/markturansky/origin/downloads","issues_url":"https://api.github.com/repos/markturansky/origin/issues{/number}","pulls_url":"https://api.github.com/repos/markturansky/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/markturansky/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/markturansky/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/markturansky/origin/labels{/name}","releases_url":"https://api.github.com/repos/markturansky/origin/releases{/id}","created_at":"2014-09-24T14:35:37Z","updated_at":"2015-01-22T17:00:08Z","pushed_at":"2015-06-10T21:48:21Z","git_url":"git://github.com/markturansky/origin.git","ssh_url":"git@github.com:markturansky/origin.git","clone_url":"https://github.com/markturansky/origin.git","svn_url":"https://github.com/markturansky/origin","homepage":"https://openshift.github.io","size":114346,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"openshift:master","ref":"master","sha":"e9c2266855c1deeefd316ce5439aa0760e40efc6","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","created_at":"2014-07-30T20:04:05Z","updated_at":"2015-06-11T10:21:06Z","pushed_at":"2015-06-11T11:05:40Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":196238,"stargazers_count":469,"watchers_count":469,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":241,"mirror_url":null,"open_issues_count":284,"forks":241,"open_issues":284,"watchers":469,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/3078"},"html":{"href":"https://github.com/openshift/origin/pull/3078"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/3078"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/3078/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/3078/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/3078/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/de61003a4a039521a61405e9db46b46ded16a1d9"}}}}