{"action":"closed","number":1533,"pull_request":{"url":"https://api.github.com/repos/docker/libnetwork/pulls/1533","id":91871934,"html_url":"https://github.com/docker/libnetwork/pull/1533","diff_url":"https://github.com/docker/libnetwork/pull/1533.diff","patch_url":"https://github.com/docker/libnetwork/pull/1533.patch","issue_url":"https://api.github.com/repos/docker/libnetwork/issues/1533","number":1533,"state":"closed","locked":false,"title":"Allow concurrent calls to agentClose","user":{"login":"aboch","id":10080882,"avatar_url":"https://avatars.githubusercontent.com/u/10080882?v=3","gravatar_id":"","url":"https://api.github.com/users/aboch","html_url":"https://github.com/aboch","followers_url":"https://api.github.com/users/aboch/followers","following_url":"https://api.github.com/users/aboch/following{/other_user}","gists_url":"https://api.github.com/users/aboch/gists{/gist_id}","starred_url":"https://api.github.com/users/aboch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aboch/subscriptions","organizations_url":"https://api.github.com/users/aboch/orgs","repos_url":"https://api.github.com/users/aboch/repos","events_url":"https://api.github.com/users/aboch/events{/privacy}","received_events_url":"https://api.github.com/users/aboch/received_events","type":"User","site_admin":false},"body":"- This fixes a panic in memberlist.Leave() because called\r\n  after memberlist.shutdown = false\r\n  It happens because of two interlocking calls to NetworkDB.clusterLeave()\r\n  It is easily reproducible with two back-to-back calls\r\n  to docker swarm init && docker swarm leave --force\r\n  While the first clusterLeave() is waiting for sendNodeEvent(NodeEventTypeLeave)\r\n  to timeout (5 sec) a second clusterLeave() is called. The second clusterLeave()\r\n  will end up invoking memberlist.Leave() after the previous call already did\r\n  the same, therefore after memberlist.shutdown was set false.\r\n- The fix is to have agentClose() acquire the agent instance and reset the\r\n  agent pointer right away under lock. Then execute the closing/leave functions\r\n  on the agent instance.\r\n\r\nThis is exposed by running recent docker-py integration test on docker master and blocks https://github.com/docker/docker/pull/26880 to get a succesfull jenkins.\r\n\r\nAlso related to https://github.com/docker/for-mac/issues/849\r\n\r\nTo reproduce\r\n```\r\n$ docker swarm init && docker swarm leave --force &&  docker swarm init && docker swarm leave --force \r\n```\r\n\r\nResult:\r\n```\r\nINFO[0039] Stopping manager                             \r\nINFO[0039] Manager shut down                            \r\nINFO[0039] Listening for connections                     addr=\"[::]:2377\" proto=tcp\r\nINFO[0039] Listening for local connections               addr=\"/var/run/docker/swarm/control.sock\" proto=unix\r\nINFO[0039] 785457d99e225831 became follower at term 0   \r\nINFO[0039] newRaft 785457d99e225831 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0] \r\nINFO[0039] 785457d99e225831 became follower at term 1   \r\nINFO[0039] 785457d99e225831 is starting a new election at term 1 \r\nINFO[0039] 785457d99e225831 became candidate at term 2  \r\nINFO[0039] 785457d99e225831 received vote from 785457d99e225831 at term 2 \r\nINFO[0039] 785457d99e225831 became leader at term 2     \r\nINFO[0039] raft.node: 785457d99e225831 elected leader 785457d99e225831 at term 2 \r\nINFO[0000] Firewalld running: false                     \r\nWARN[0040] secrets update ignored; executor does not support secrets  module=\"node/agent\"\r\nINFO[0040] Initializing Libnetwork Agent Listen-Addr=0.0.0.0 Local-addr=192.168.100.177 Adv-addr=192.168.100.177 Remote-addr = \r\nINFO[0040] Stopping manager                             \r\nINFO[0040] shuting down certificate renewal routine      module=\"node/tls\" node.id=v0oq5u0c2dy61sup800ahtxvd node.role=swarm-manager\r\nINFO[0040] Manager shut down                            \r\nINFO[0040] No non-localhost DNS nameservers are left in resolv.conf. Using default external servers : [nameserver 8.8.8.8 nameserver 8.8.4.4] \r\nINFO[0040] IPv6 enabled; Adding default IPv6 external servers : [nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844] \r\nINFO[0000] Firewalld running: false                     \r\nERRO[0044] failed to send node leave: timed out broadcasting node event \r\npanic: leave after shutdown\r\n\r\ngoroutine 355 [running]:\r\npanic(0x15ef4a0, 0xc4213e03a0)\r\n\t/usr/local/go/src/runtime/panic.go:500 +0x1a1\r\ngithub.com/hashicorp/memberlist.(*Memberlist).Leave(0xc4200a4540, 0x3b9aca00, 0x1, 0x15ef4a0)\r\n\t/go/src/github.com/docker/docker/vendor/src/github.com/hashicorp/memberlist/memberlist.go:578 +0x42e\r\ngithub.com/docker/libnetwork/networkdb.(*NetworkDB).clusterLeave(0xc421af0f00, 0xc421887e00, 0xc94658)\r\n\t/go/src/github.com/docker/docker/vendor/src/github.com/docker/libnetwork/networkdb/cluster.go:212 +0x24a\r\ngithub.com/docker/libnetwork/networkdb.(*NetworkDB).Close(0xc421af0f00)\r\n\t/go/src/github.com/docker/docker/vendor/src/github.com/docker/libnetwork/networkdb/networkdb.go:198 +0x2f\r\ngithub.com/docker/libnetwork.(*controller).agentClose(0xc4204e4000)\r\n\t/go/src/github.com/docker/docker/vendor/src/github.com/docker/libnetwork/agent.go:345 +0x129\r\ngithub.com/docker/libnetwork.(*controller).clusterAgentInit(0xc4204e4000)\r\n\t/go/src/github.com/docker/docker/vendor/src/github.com/docker/libnetwork/controller.go:333 +0x250\r\ncreated by github.com/docker/libnetwork.(*controller).SetClusterProvider\r\n\t/go/src/github.com/docker/docker/vendor/src/github.com/docker/libnetwork/controller.go:243 +0xe5\r\n```\r\nSigned-off-by: Alessandro Boch <aboch@docker.com>","created_at":"2016-11-01T21:57:07Z","updated_at":"2016-11-02T16:53:29Z","closed_at":"2016-11-02T16:53:28Z","merged_at":"2016-11-02T16:53:28Z","merge_commit_sha":"1185882b429ba617326e3432471d126a1a479b59","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/libnetwork/pulls/1533/commits","review_comments_url":"https://api.github.com/repos/docker/libnetwork/pulls/1533/comments","review_comment_url":"https://api.github.com/repos/docker/libnetwork/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/libnetwork/issues/1533/comments","statuses_url":"https://api.github.com/repos/docker/libnetwork/statuses/856ea84cde4ee0b655d719082e0016950d3f0d88","head":{"label":"aboch:ag","ref":"ag","sha":"856ea84cde4ee0b655d719082e0016950d3f0d88","user":{"login":"aboch","id":10080882,"avatar_url":"https://avatars.githubusercontent.com/u/10080882?v=3","gravatar_id":"","url":"https://api.github.com/users/aboch","html_url":"https://github.com/aboch","followers_url":"https://api.github.com/users/aboch/followers","following_url":"https://api.github.com/users/aboch/following{/other_user}","gists_url":"https://api.github.com/users/aboch/gists{/gist_id}","starred_url":"https://api.github.com/users/aboch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aboch/subscriptions","organizations_url":"https://api.github.com/users/aboch/orgs","repos_url":"https://api.github.com/users/aboch/repos","events_url":"https://api.github.com/users/aboch/events{/privacy}","received_events_url":"https://api.github.com/users/aboch/received_events","type":"User","site_admin":false},"repo":{"id":34007834,"name":"libnetwork_new","full_name":"aboch/libnetwork_new","owner":{"login":"aboch","id":10080882,"avatar_url":"https://avatars.githubusercontent.com/u/10080882?v=3","gravatar_id":"","url":"https://api.github.com/users/aboch","html_url":"https://github.com/aboch","followers_url":"https://api.github.com/users/aboch/followers","following_url":"https://api.github.com/users/aboch/following{/other_user}","gists_url":"https://api.github.com/users/aboch/gists{/gist_id}","starred_url":"https://api.github.com/users/aboch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aboch/subscriptions","organizations_url":"https://api.github.com/users/aboch/orgs","repos_url":"https://api.github.com/users/aboch/repos","events_url":"https://api.github.com/users/aboch/events{/privacy}","received_events_url":"https://api.github.com/users/aboch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aboch/libnetwork_new","description":"networking for containers","fork":true,"url":"https://api.github.com/repos/aboch/libnetwork_new","forks_url":"https://api.github.com/repos/aboch/libnetwork_new/forks","keys_url":"https://api.github.com/repos/aboch/libnetwork_new/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aboch/libnetwork_new/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aboch/libnetwork_new/teams","hooks_url":"https://api.github.com/repos/aboch/libnetwork_new/hooks","issue_events_url":"https://api.github.com/repos/aboch/libnetwork_new/issues/events{/number}","events_url":"https://api.github.com/repos/aboch/libnetwork_new/events","assignees_url":"https://api.github.com/repos/aboch/libnetwork_new/assignees{/user}","branches_url":"https://api.github.com/repos/aboch/libnetwork_new/branches{/branch}","tags_url":"https://api.github.com/repos/aboch/libnetwork_new/tags","blobs_url":"https://api.github.com/repos/aboch/libnetwork_new/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aboch/libnetwork_new/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aboch/libnetwork_new/git/refs{/sha}","trees_url":"https://api.github.com/repos/aboch/libnetwork_new/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aboch/libnetwork_new/statuses/{sha}","languages_url":"https://api.github.com/repos/aboch/libnetwork_new/languages","stargazers_url":"https://api.github.com/repos/aboch/libnetwork_new/stargazers","contributors_url":"https://api.github.com/repos/aboch/libnetwork_new/contributors","subscribers_url":"https://api.github.com/repos/aboch/libnetwork_new/subscribers","subscription_url":"https://api.github.com/repos/aboch/libnetwork_new/subscription","commits_url":"https://api.github.com/repos/aboch/libnetwork_new/commits{/sha}","git_commits_url":"https://api.github.com/repos/aboch/libnetwork_new/git/commits{/sha}","comments_url":"https://api.github.com/repos/aboch/libnetwork_new/comments{/number}","issue_comment_url":"https://api.github.com/repos/aboch/libnetwork_new/issues/comments{/number}","contents_url":"https://api.github.com/repos/aboch/libnetwork_new/contents/{+path}","compare_url":"https://api.github.com/repos/aboch/libnetwork_new/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aboch/libnetwork_new/merges","archive_url":"https://api.github.com/repos/aboch/libnetwork_new/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aboch/libnetwork_new/downloads","issues_url":"https://api.github.com/repos/aboch/libnetwork_new/issues{/number}","pulls_url":"https://api.github.com/repos/aboch/libnetwork_new/pulls{/number}","milestones_url":"https://api.github.com/repos/aboch/libnetwork_new/milestones{/number}","notifications_url":"https://api.github.com/repos/aboch/libnetwork_new/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aboch/libnetwork_new/labels{/name}","releases_url":"https://api.github.com/repos/aboch/libnetwork_new/releases{/id}","deployments_url":"https://api.github.com/repos/aboch/libnetwork_new/deployments","created_at":"2015-04-15T17:16:09Z","updated_at":"2016-01-27T21:23:38Z","pushed_at":"2016-11-01T21:51:30Z","git_url":"git://github.com/aboch/libnetwork_new.git","ssh_url":"git@github.com:aboch/libnetwork_new.git","clone_url":"https://github.com/aboch/libnetwork_new.git","svn_url":"https://github.com/aboch/libnetwork_new","homepage":"","size":10087,"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":"afa9396ba8c69f499e473be450bdb30a391c1cc9","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":31046054,"name":"libnetwork","full_name":"docker/libnetwork","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/libnetwork","description":"Docker Networking","fork":false,"url":"https://api.github.com/repos/docker/libnetwork","forks_url":"https://api.github.com/repos/docker/libnetwork/forks","keys_url":"https://api.github.com/repos/docker/libnetwork/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/libnetwork/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/libnetwork/teams","hooks_url":"https://api.github.com/repos/docker/libnetwork/hooks","issue_events_url":"https://api.github.com/repos/docker/libnetwork/issues/events{/number}","events_url":"https://api.github.com/repos/docker/libnetwork/events","assignees_url":"https://api.github.com/repos/docker/libnetwork/assignees{/user}","branches_url":"https://api.github.com/repos/docker/libnetwork/branches{/branch}","tags_url":"https://api.github.com/repos/docker/libnetwork/tags","blobs_url":"https://api.github.com/repos/docker/libnetwork/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/libnetwork/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/libnetwork/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/libnetwork/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/libnetwork/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/libnetwork/languages","stargazers_url":"https://api.github.com/repos/docker/libnetwork/stargazers","contributors_url":"https://api.github.com/repos/docker/libnetwork/contributors","subscribers_url":"https://api.github.com/repos/docker/libnetwork/subscribers","subscription_url":"https://api.github.com/repos/docker/libnetwork/subscription","commits_url":"https://api.github.com/repos/docker/libnetwork/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/libnetwork/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/libnetwork/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/libnetwork/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/libnetwork/contents/{+path}","compare_url":"https://api.github.com/repos/docker/libnetwork/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/libnetwork/merges","archive_url":"https://api.github.com/repos/docker/libnetwork/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/libnetwork/downloads","issues_url":"https://api.github.com/repos/docker/libnetwork/issues{/number}","pulls_url":"https://api.github.com/repos/docker/libnetwork/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/libnetwork/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/libnetwork/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/libnetwork/labels{/name}","releases_url":"https://api.github.com/repos/docker/libnetwork/releases{/id}","deployments_url":"https://api.github.com/repos/docker/libnetwork/deployments","created_at":"2015-02-20T01:20:15Z","updated_at":"2016-11-02T02:13:00Z","pushed_at":"2016-11-02T16:53:29Z","git_url":"git://github.com/docker/libnetwork.git","ssh_url":"git@github.com:docker/libnetwork.git","clone_url":"https://github.com/docker/libnetwork.git","svn_url":"https://github.com/docker/libnetwork","homepage":"","size":15114,"stargazers_count":777,"watchers_count":777,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":385,"mirror_url":null,"open_issues_count":247,"forks":385,"open_issues":247,"watchers":777,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/libnetwork/pulls/1533"},"html":{"href":"https://github.com/docker/libnetwork/pull/1533"},"issue":{"href":"https://api.github.com/repos/docker/libnetwork/issues/1533"},"comments":{"href":"https://api.github.com/repos/docker/libnetwork/issues/1533/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/libnetwork/pulls/1533/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/libnetwork/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/libnetwork/pulls/1533/commits"},"statuses":{"href":"https://api.github.com/repos/docker/libnetwork/statuses/856ea84cde4ee0b655d719082e0016950d3f0d88"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"mrjana","id":1693482,"avatar_url":"https://avatars.githubusercontent.com/u/1693482?v=3","gravatar_id":"","url":"https://api.github.com/users/mrjana","html_url":"https://github.com/mrjana","followers_url":"https://api.github.com/users/mrjana/followers","following_url":"https://api.github.com/users/mrjana/following{/other_user}","gists_url":"https://api.github.com/users/mrjana/gists{/gist_id}","starred_url":"https://api.github.com/users/mrjana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrjana/subscriptions","organizations_url":"https://api.github.com/users/mrjana/orgs","repos_url":"https://api.github.com/users/mrjana/repos","events_url":"https://api.github.com/users/mrjana/events{/privacy}","received_events_url":"https://api.github.com/users/mrjana/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"commits":1,"additions":11,"deletions":7,"changed_files":1}}
{"actor":{"display_login":"mrjana"}}