{"action":"closed","number":20934,"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/20934","id":61663683,"html_url":"https://github.com/docker/docker/pull/20934","diff_url":"https://github.com/docker/docker/pull/20934.diff","patch_url":"https://github.com/docker/docker/pull/20934.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/20934","number":20934,"state":"closed","locked":false,"title":"Fix race condition on daemon shutdown (#20543)","user":{"login":"icecrime","id":1564054,"avatar_url":"https://avatars.githubusercontent.com/u/1564054?v=3","gravatar_id":"","url":"https://api.github.com/users/icecrime","html_url":"https://github.com/icecrime","followers_url":"https://api.github.com/users/icecrime/followers","following_url":"https://api.github.com/users/icecrime/following{/other_user}","gists_url":"https://api.github.com/users/icecrime/gists{/gist_id}","starred_url":"https://api.github.com/users/icecrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icecrime/subscriptions","organizations_url":"https://api.github.com/users/icecrime/orgs","repos_url":"https://api.github.com/users/icecrime/repos","events_url":"https://api.github.com/users/icecrime/events{/privacy}","received_events_url":"https://api.github.com/users/icecrime/received_events","type":"User","site_admin":false},"body":"Last investigations on #20543 show that the integration-test daemon receives a SIGTERM which was apparently sent to all running processes.\r\n\r\nSuspicious lines:\r\n- [opencontainers/runc/libcontainer/container_linux.go:1038](https://github.com/docker/docker/blob/ea5acb08fa429b1d1833aa855793e8cbfabe25d8/vendor/src/github.com/opencontainers/runc/libcontainer/container_linux.go#L1038): pid initialized to `-1`\r\n- [opencontainers/runc/libcontainer/container_linux.go:177-200](https://github.com/docker/docker/blob/ea5acb08fa429b1d1833aa855793e8cbfabe25d8/vendor/src/github.com/opencontainers/runc/libcontainer/container_linux.go#L177-L200): there is a delay during which `initProcess` is not set in the `linuxContainer` (done by [`linuxContainer.updateState`](opencontainers/runc/libcontainer/container_linux.go#L959))\r\n- [native/driver.go:305](https://github.com/docker/docker/blob/master/daemon/execdriver/native/driver.go#L305): send a signal to `state.InitProcessId` (which is `-1` during a time window described above)\r\n\r\nSequence is the following:\r\n\r\n- `daemon/execdriver/native/driver.go` calls `d.factory.Create()`: the resullt is a `linuxContainer` where `initProcess` is `nil`\r\n- `daemon/execdriver/native/driver.go` calls `cont.Start()`\r\n- `libcontainer/container_linux.go` only sets the `initProcess` when it reaches `c.UpdateState`\r\n- until it reaches that point of the code, the container is already registered in `activeContainers` so if we attempt to kill, we signal `-1`\r\n\r\nHopefully fixes #20543.","created_at":"2016-03-04T03:46:58Z","updated_at":"2016-03-04T19:08:50Z","closed_at":"2016-03-04T19:08:50Z","merged_at":"2016-03-04T19:08:50Z","merge_commit_sha":"03bd89dd1c945874be8ed641dd1003efef443911","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/20934/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/20934/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/20934/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/ad2fa3945997905760a4c7ef0444580ffb4b939a","head":{"label":"icecrime:20543_debugging","ref":"20543_debugging","sha":"ad2fa3945997905760a4c7ef0444580ffb4b939a","user":{"login":"icecrime","id":1564054,"avatar_url":"https://avatars.githubusercontent.com/u/1564054?v=3","gravatar_id":"","url":"https://api.github.com/users/icecrime","html_url":"https://github.com/icecrime","followers_url":"https://api.github.com/users/icecrime/followers","following_url":"https://api.github.com/users/icecrime/following{/other_user}","gists_url":"https://api.github.com/users/icecrime/gists{/gist_id}","starred_url":"https://api.github.com/users/icecrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icecrime/subscriptions","organizations_url":"https://api.github.com/users/icecrime/orgs","repos_url":"https://api.github.com/users/icecrime/repos","events_url":"https://api.github.com/users/icecrime/events{/privacy}","received_events_url":"https://api.github.com/users/icecrime/received_events","type":"User","site_admin":false},"repo":{"id":19612523,"name":"docker","full_name":"icecrime/docker","owner":{"login":"icecrime","id":1564054,"avatar_url":"https://avatars.githubusercontent.com/u/1564054?v=3","gravatar_id":"","url":"https://api.github.com/users/icecrime","html_url":"https://github.com/icecrime","followers_url":"https://api.github.com/users/icecrime/followers","following_url":"https://api.github.com/users/icecrime/following{/other_user}","gists_url":"https://api.github.com/users/icecrime/gists{/gist_id}","starred_url":"https://api.github.com/users/icecrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icecrime/subscriptions","organizations_url":"https://api.github.com/users/icecrime/orgs","repos_url":"https://api.github.com/users/icecrime/repos","events_url":"https://api.github.com/users/icecrime/events{/privacy}","received_events_url":"https://api.github.com/users/icecrime/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/icecrime/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/icecrime/docker","forks_url":"https://api.github.com/repos/icecrime/docker/forks","keys_url":"https://api.github.com/repos/icecrime/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/icecrime/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/icecrime/docker/teams","hooks_url":"https://api.github.com/repos/icecrime/docker/hooks","issue_events_url":"https://api.github.com/repos/icecrime/docker/issues/events{/number}","events_url":"https://api.github.com/repos/icecrime/docker/events","assignees_url":"https://api.github.com/repos/icecrime/docker/assignees{/user}","branches_url":"https://api.github.com/repos/icecrime/docker/branches{/branch}","tags_url":"https://api.github.com/repos/icecrime/docker/tags","blobs_url":"https://api.github.com/repos/icecrime/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/icecrime/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/icecrime/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/icecrime/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/icecrime/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/icecrime/docker/languages","stargazers_url":"https://api.github.com/repos/icecrime/docker/stargazers","contributors_url":"https://api.github.com/repos/icecrime/docker/contributors","subscribers_url":"https://api.github.com/repos/icecrime/docker/subscribers","subscription_url":"https://api.github.com/repos/icecrime/docker/subscription","commits_url":"https://api.github.com/repos/icecrime/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/icecrime/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/icecrime/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/icecrime/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/icecrime/docker/contents/{+path}","compare_url":"https://api.github.com/repos/icecrime/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/icecrime/docker/merges","archive_url":"https://api.github.com/repos/icecrime/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/icecrime/docker/downloads","issues_url":"https://api.github.com/repos/icecrime/docker/issues{/number}","pulls_url":"https://api.github.com/repos/icecrime/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/icecrime/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/icecrime/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/icecrime/docker/labels{/name}","releases_url":"https://api.github.com/repos/icecrime/docker/releases{/id}","deployments_url":"https://api.github.com/repos/icecrime/docker/deployments","created_at":"2014-05-09T13:46:45Z","updated_at":"2016-02-27T01:47:43Z","pushed_at":"2016-03-04T04:25:10Z","git_url":"git://github.com/icecrime/docker.git","ssh_url":"git@github.com:icecrime/docker.git","clone_url":"https://github.com/icecrime/docker.git","svn_url":"https://github.com/icecrime/docker","homepage":"http://www.docker.io","size":81941,"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":"docker:master","ref":"master","sha":"ea5acb08fa429b1d1833aa855793e8cbfabe25d8","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","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":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","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/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","deployments_url":"https://api.github.com/repos/docker/docker/deployments","created_at":"2013-01-18T18:10:57Z","updated_at":"2016-03-04T18:43:40Z","pushed_at":"2016-03-04T19:08:50Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":138033,"stargazers_count":29150,"watchers_count":29150,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8153,"mirror_url":null,"open_issues_count":1361,"forks":8153,"open_issues":1361,"watchers":29150,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/20934"},"html":{"href":"https://github.com/docker/docker/pull/20934"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/20934"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/20934/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/20934/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/20934/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/ad2fa3945997905760a4c7ef0444580ffb4b939a"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"calavera","id":1050,"avatar_url":"https://avatars.githubusercontent.com/u/1050?v=3","gravatar_id":"","url":"https://api.github.com/users/calavera","html_url":"https://github.com/calavera","followers_url":"https://api.github.com/users/calavera/followers","following_url":"https://api.github.com/users/calavera/following{/other_user}","gists_url":"https://api.github.com/users/calavera/gists{/gist_id}","starred_url":"https://api.github.com/users/calavera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calavera/subscriptions","organizations_url":"https://api.github.com/users/calavera/orgs","repos_url":"https://api.github.com/users/calavera/repos","events_url":"https://api.github.com/users/calavera/events{/privacy}","received_events_url":"https://api.github.com/users/calavera/received_events","type":"User","site_admin":false},"comments":11,"review_comments":0,"commits":1,"additions":7,"deletions":4,"changed_files":1}}