{"action":"opened","number":2706,"pull_request":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/2706","id":201348210,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxMzQ4MjEw","html_url":"https://github.com/docker/swarmkit/pull/2706","diff_url":"https://github.com/docker/swarmkit/pull/2706.diff","patch_url":"https://github.com/docker/swarmkit/pull/2706.patch","issue_url":"https://api.github.com/repos/docker/swarmkit/issues/2706","number":2706,"state":"open","locked":false,"title":"address unassigned task leak when service is removed","user":{"login":"dani-docker","id":33073215,"node_id":"MDQ6VXNlcjMzMDczMjE1","avatar_url":"https://avatars3.githubusercontent.com/u/33073215?v=4","gravatar_id":"","url":"https://api.github.com/users/dani-docker","html_url":"https://github.com/dani-docker","followers_url":"https://api.github.com/users/dani-docker/followers","following_url":"https://api.github.com/users/dani-docker/following{/other_user}","gists_url":"https://api.github.com/users/dani-docker/gists{/gist_id}","starred_url":"https://api.github.com/users/dani-docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dani-docker/subscriptions","organizations_url":"https://api.github.com/users/dani-docker/orgs","repos_url":"https://api.github.com/users/dani-docker/repos","events_url":"https://api.github.com/users/dani-docker/events{/privacy}","received_events_url":"https://api.github.com/users/dani-docker/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Dani Louca <dani.louca@docker.com>\r\n\r\n<!--\r\nPlease make sure you've read and understood our contributing guidelines;\r\nhttps://github.com/docker/swarmkit/blob/master/CONTRIBUTING.md\r\n\r\n** Make sure all your commits include a signature generated with `git commit -s` **\r\n\r\nFor additional information on our contributing process, read our contributing\r\nguide https://docs.docker.com/opensource/code/\r\n\r\nIf this is a bug fix, make sure your description includes \"fixes #xxxx\", or\r\n\"closes #xxxx\"\r\n\r\nPlease provide the following information:\r\n-->\r\n\r\n**- What I did**\r\n\r\nIf a task is not yet assigned (for ex: due to `noSuitableNode` ) and its service has been removed, the task stays in the `unassignedTasks` map until a new leader election.\r\n \r\n**- How I did it**\r\n\r\nBefore re-adding the task to `unassignedTasks` map, the fix checks if the task has a valid service in the store.\r\n\r\n**- How to test it**\r\n\r\nsteps to repro:\r\n- set daemon.log to debug\r\n- create a service with a node constraint that does not exist:\r\nex: `docker service create -d --constraint 'node.labels.type == queue' alpine sleep 10000`\r\n- watch the logs, you should see an error \r\n`no suitable node available for task`\r\n- delete the service and invoke the tick() by creating another service; watch the log and notice the same warning taskID in pops up after service is deleted\r\n\r\n**- Description for the changelog**\r\n<!--\r\nWrite a short (one line) summary that describes the changes in this\r\npull request for inclusion in the changelog:\r\n-->\r\n\r\nAvoid a leak when a service with unassigned tasks is deleted","created_at":"2018-07-13T17:03:46Z","updated_at":"2018-07-13T17:03:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/swarmkit/pulls/2706/commits","review_comments_url":"https://api.github.com/repos/docker/swarmkit/pulls/2706/comments","review_comment_url":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/swarmkit/issues/2706/comments","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/b5249e551bd5c02bb0ae712aaaafd4e2ec265fb5","head":{"label":"dani-docker:task_leak","ref":"task_leak","sha":"b5249e551bd5c02bb0ae712aaaafd4e2ec265fb5","user":{"login":"dani-docker","id":33073215,"node_id":"MDQ6VXNlcjMzMDczMjE1","avatar_url":"https://avatars3.githubusercontent.com/u/33073215?v=4","gravatar_id":"","url":"https://api.github.com/users/dani-docker","html_url":"https://github.com/dani-docker","followers_url":"https://api.github.com/users/dani-docker/followers","following_url":"https://api.github.com/users/dani-docker/following{/other_user}","gists_url":"https://api.github.com/users/dani-docker/gists{/gist_id}","starred_url":"https://api.github.com/users/dani-docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dani-docker/subscriptions","organizations_url":"https://api.github.com/users/dani-docker/orgs","repos_url":"https://api.github.com/users/dani-docker/repos","events_url":"https://api.github.com/users/dani-docker/events{/privacy}","received_events_url":"https://api.github.com/users/dani-docker/received_events","type":"User","site_admin":false},"repo":{"id":140870936,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA4NzA5MzY=","name":"swarmkit","full_name":"dani-docker/swarmkit","owner":{"login":"dani-docker","id":33073215,"node_id":"MDQ6VXNlcjMzMDczMjE1","avatar_url":"https://avatars3.githubusercontent.com/u/33073215?v=4","gravatar_id":"","url":"https://api.github.com/users/dani-docker","html_url":"https://github.com/dani-docker","followers_url":"https://api.github.com/users/dani-docker/followers","following_url":"https://api.github.com/users/dani-docker/following{/other_user}","gists_url":"https://api.github.com/users/dani-docker/gists{/gist_id}","starred_url":"https://api.github.com/users/dani-docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dani-docker/subscriptions","organizations_url":"https://api.github.com/users/dani-docker/orgs","repos_url":"https://api.github.com/users/dani-docker/repos","events_url":"https://api.github.com/users/dani-docker/events{/privacy}","received_events_url":"https://api.github.com/users/dani-docker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dani-docker/swarmkit","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":true,"url":"https://api.github.com/repos/dani-docker/swarmkit","forks_url":"https://api.github.com/repos/dani-docker/swarmkit/forks","keys_url":"https://api.github.com/repos/dani-docker/swarmkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dani-docker/swarmkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dani-docker/swarmkit/teams","hooks_url":"https://api.github.com/repos/dani-docker/swarmkit/hooks","issue_events_url":"https://api.github.com/repos/dani-docker/swarmkit/issues/events{/number}","events_url":"https://api.github.com/repos/dani-docker/swarmkit/events","assignees_url":"https://api.github.com/repos/dani-docker/swarmkit/assignees{/user}","branches_url":"https://api.github.com/repos/dani-docker/swarmkit/branches{/branch}","tags_url":"https://api.github.com/repos/dani-docker/swarmkit/tags","blobs_url":"https://api.github.com/repos/dani-docker/swarmkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dani-docker/swarmkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dani-docker/swarmkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/dani-docker/swarmkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dani-docker/swarmkit/statuses/{sha}","languages_url":"https://api.github.com/repos/dani-docker/swarmkit/languages","stargazers_url":"https://api.github.com/repos/dani-docker/swarmkit/stargazers","contributors_url":"https://api.github.com/repos/dani-docker/swarmkit/contributors","subscribers_url":"https://api.github.com/repos/dani-docker/swarmkit/subscribers","subscription_url":"https://api.github.com/repos/dani-docker/swarmkit/subscription","commits_url":"https://api.github.com/repos/dani-docker/swarmkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/dani-docker/swarmkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/dani-docker/swarmkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/dani-docker/swarmkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/dani-docker/swarmkit/contents/{+path}","compare_url":"https://api.github.com/repos/dani-docker/swarmkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dani-docker/swarmkit/merges","archive_url":"https://api.github.com/repos/dani-docker/swarmkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dani-docker/swarmkit/downloads","issues_url":"https://api.github.com/repos/dani-docker/swarmkit/issues{/number}","pulls_url":"https://api.github.com/repos/dani-docker/swarmkit/pulls{/number}","milestones_url":"https://api.github.com/repos/dani-docker/swarmkit/milestones{/number}","notifications_url":"https://api.github.com/repos/dani-docker/swarmkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dani-docker/swarmkit/labels{/name}","releases_url":"https://api.github.com/repos/dani-docker/swarmkit/releases{/id}","deployments_url":"https://api.github.com/repos/dani-docker/swarmkit/deployments","created_at":"2018-07-13T16:41:46Z","updated_at":"2018-07-13T16:41:50Z","pushed_at":"2018-07-13T16:56:10Z","git_url":"git://github.com/dani-docker/swarmkit.git","ssh_url":"git@github.com:dani-docker/swarmkit.git","clone_url":"https://github.com/dani-docker/swarmkit.git","svn_url":"https://github.com/dani-docker/swarmkit","homepage":"","size":21350,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"docker:master","ref":"master","sha":"231d1811458b81bdbd44e8433278e74c12f4759e","user":{"login":"docker","id":5429470,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=","avatar_url":"https://avatars1.githubusercontent.com/u/5429470?v=4","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":51556828,"node_id":"MDEwOlJlcG9zaXRvcnk1MTU1NjgyOA==","name":"swarmkit","full_name":"docker/swarmkit","owner":{"login":"docker","id":5429470,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=","avatar_url":"https://avatars1.githubusercontent.com/u/5429470?v=4","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarmkit","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":false,"url":"https://api.github.com/repos/docker/swarmkit","forks_url":"https://api.github.com/repos/docker/swarmkit/forks","keys_url":"https://api.github.com/repos/docker/swarmkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarmkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarmkit/teams","hooks_url":"https://api.github.com/repos/docker/swarmkit/hooks","issue_events_url":"https://api.github.com/repos/docker/swarmkit/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarmkit/events","assignees_url":"https://api.github.com/repos/docker/swarmkit/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarmkit/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarmkit/tags","blobs_url":"https://api.github.com/repos/docker/swarmkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarmkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarmkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarmkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarmkit/languages","stargazers_url":"https://api.github.com/repos/docker/swarmkit/stargazers","contributors_url":"https://api.github.com/repos/docker/swarmkit/contributors","subscribers_url":"https://api.github.com/repos/docker/swarmkit/subscribers","subscription_url":"https://api.github.com/repos/docker/swarmkit/subscription","commits_url":"https://api.github.com/repos/docker/swarmkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarmkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarmkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarmkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarmkit/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarmkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarmkit/merges","archive_url":"https://api.github.com/repos/docker/swarmkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarmkit/downloads","issues_url":"https://api.github.com/repos/docker/swarmkit/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarmkit/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarmkit/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarmkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarmkit/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarmkit/releases{/id}","deployments_url":"https://api.github.com/repos/docker/swarmkit/deployments","created_at":"2016-02-12T00:02:15Z","updated_at":"2018-07-13T16:54:30Z","pushed_at":"2018-07-13T14:01:19Z","git_url":"git://github.com/docker/swarmkit.git","ssh_url":"git@github.com:docker/swarmkit.git","clone_url":"https://github.com/docker/swarmkit.git","svn_url":"https://github.com/docker/swarmkit","homepage":"","size":21350,"stargazers_count":1754,"watchers_count":1754,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":397,"mirror_url":null,"archived":false,"open_issues_count":250,"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":397,"open_issues":250,"watchers":1754,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2706"},"html":{"href":"https://github.com/docker/swarmkit/pull/2706"},"issue":{"href":"https://api.github.com/repos/docker/swarmkit/issues/2706"},"comments":{"href":"https://api.github.com/repos/docker/swarmkit/issues/2706/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2706/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2706/commits"},"statuses":{"href":"https://api.github.com/repos/docker/swarmkit/statuses/b5249e551bd5c02bb0ae712aaaafd4e2ec265fb5"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":9,"deletions":0,"changed_files":1}}
{"actor":{"display_login":"dani-docker"}}