{"action":"created","comment":{"url":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/comments/30422268","id":30422268,"diff_hunk":"@@ -129,6 +130,53 @@ def run(self):\n         self.periodic_resync()\n \n     def call_driver(self, action, network, **action_kwargs):\n+        # Spawn a thread for this network, if there isn't one already.\n+        if network.id not in self.driver_queues:\n+            LOG.info(\"Create queue and thread for network %s\", network)\n+            self.driver_queues[network.id] = eventlet.queue.Queue()\n+            eventlet.spawn(self._call_driver_thread,\n+                           network,","path":"neutron/agent/dhcp_agent.py","position":17,"original_position":17,"commit_id":"b69fc1f3672f5dbd2eab055350c624f9dd1130e1","original_commit_id":"b69fc1f3672f5dbd2eab055350c624f9dd1130e1","user":{"login":"fasaxc","id":469264,"avatar_url":"https://avatars.githubusercontent.com/u/469264?v=3","gravatar_id":"","url":"https://api.github.com/users/fasaxc","html_url":"https://github.com/fasaxc","followers_url":"https://api.github.com/users/fasaxc/followers","following_url":"https://api.github.com/users/fasaxc/following{/other_user}","gists_url":"https://api.github.com/users/fasaxc/gists{/gist_id}","starred_url":"https://api.github.com/users/fasaxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasaxc/subscriptions","organizations_url":"https://api.github.com/users/fasaxc/orgs","repos_url":"https://api.github.com/users/fasaxc/repos","events_url":"https://api.github.com/users/fasaxc/events{/privacy}","received_events_url":"https://api.github.com/users/fasaxc/received_events","type":"User","site_admin":false},"body":"I think network is mutable so it's not safe to pass it to the other thread like this, that's why I moved all the access to the cache onto my worker thread.  It removed all the possibility of multi-threaded access to the cache.\r\n\r\nYou could fix that up by taking a deep copy of the network to send to the other thread, but that might be expensive if there are 10k ports in there.  Alternatively, you could lock around the cache access on the worker thread but that's more complex than my solution so I don't think it's a good plan!","created_at":"2015-05-15T16:14:23Z","updated_at":"2015-05-15T16:14:23Z","html_url":"https://github.com/Metaswitch/calico-neutron/pull/10#discussion_r30422268","pull_request_url":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/comments/30422268"},"html":{"href":"https://github.com/Metaswitch/calico-neutron/pull/10#discussion_r30422268"},"pull_request":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/10","id":35523729,"html_url":"https://github.com/Metaswitch/calico-neutron/pull/10","diff_url":"https://github.com/Metaswitch/calico-neutron/pull/10.diff","patch_url":"https://github.com/Metaswitch/calico-neutron/pull/10.patch","issue_url":"https://api.github.com/repos/Metaswitch/calico-neutron/issues/10","number":10,"state":"open","locked":false,"title":"Nj 2014.2.2 dhcp action thread","user":{"login":"neiljerram","id":2089263,"avatar_url":"https://avatars.githubusercontent.com/u/2089263?v=3","gravatar_id":"","url":"https://api.github.com/users/neiljerram","html_url":"https://github.com/neiljerram","followers_url":"https://api.github.com/users/neiljerram/followers","following_url":"https://api.github.com/users/neiljerram/following{/other_user}","gists_url":"https://api.github.com/users/neiljerram/gists{/gist_id}","starred_url":"https://api.github.com/users/neiljerram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neiljerram/subscriptions","organizations_url":"https://api.github.com/users/neiljerram/orgs","repos_url":"https://api.github.com/users/neiljerram/repos","events_url":"https://api.github.com/users/neiljerram/events{/privacy}","received_events_url":"https://api.github.com/users/neiljerram/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-15T15:33:34Z","updated_at":"2015-05-15T16:14:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"768721e10660a33e90897049626981a4d682134c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/10/commits","review_comments_url":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/10/comments","review_comment_url":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Metaswitch/calico-neutron/issues/10/comments","statuses_url":"https://api.github.com/repos/Metaswitch/calico-neutron/statuses/b69fc1f3672f5dbd2eab055350c624f9dd1130e1","head":{"label":"Metaswitch:nj-2014.2.2-dhcp-action-thread","ref":"nj-2014.2.2-dhcp-action-thread","sha":"b69fc1f3672f5dbd2eab055350c624f9dd1130e1","user":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"repo":{"id":21242807,"name":"calico-neutron","full_name":"Metaswitch/calico-neutron","owner":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metaswitch/calico-neutron","description":"The Project Calico specific fork of Neutron.","fork":false,"url":"https://api.github.com/repos/Metaswitch/calico-neutron","forks_url":"https://api.github.com/repos/Metaswitch/calico-neutron/forks","keys_url":"https://api.github.com/repos/Metaswitch/calico-neutron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metaswitch/calico-neutron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metaswitch/calico-neutron/teams","hooks_url":"https://api.github.com/repos/Metaswitch/calico-neutron/hooks","issue_events_url":"https://api.github.com/repos/Metaswitch/calico-neutron/issues/events{/number}","events_url":"https://api.github.com/repos/Metaswitch/calico-neutron/events","assignees_url":"https://api.github.com/repos/Metaswitch/calico-neutron/assignees{/user}","branches_url":"https://api.github.com/repos/Metaswitch/calico-neutron/branches{/branch}","tags_url":"https://api.github.com/repos/Metaswitch/calico-neutron/tags","blobs_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metaswitch/calico-neutron/statuses/{sha}","languages_url":"https://api.github.com/repos/Metaswitch/calico-neutron/languages","stargazers_url":"https://api.github.com/repos/Metaswitch/calico-neutron/stargazers","contributors_url":"https://api.github.com/repos/Metaswitch/calico-neutron/contributors","subscribers_url":"https://api.github.com/repos/Metaswitch/calico-neutron/subscribers","subscription_url":"https://api.github.com/repos/Metaswitch/calico-neutron/subscription","commits_url":"https://api.github.com/repos/Metaswitch/calico-neutron/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metaswitch/calico-neutron/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metaswitch/calico-neutron/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metaswitch/calico-neutron/contents/{+path}","compare_url":"https://api.github.com/repos/Metaswitch/calico-neutron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metaswitch/calico-neutron/merges","archive_url":"https://api.github.com/repos/Metaswitch/calico-neutron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metaswitch/calico-neutron/downloads","issues_url":"https://api.github.com/repos/Metaswitch/calico-neutron/issues{/number}","pulls_url":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls{/number}","milestones_url":"https://api.github.com/repos/Metaswitch/calico-neutron/milestones{/number}","notifications_url":"https://api.github.com/repos/Metaswitch/calico-neutron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metaswitch/calico-neutron/labels{/name}","releases_url":"https://api.github.com/repos/Metaswitch/calico-neutron/releases{/id}","created_at":"2014-06-26T14:08:01Z","updated_at":"2015-05-06T16:01:45Z","pushed_at":"2015-05-15T15:33:34Z","git_url":"git://github.com/Metaswitch/calico-neutron.git","ssh_url":"git@github.com:Metaswitch/calico-neutron.git","clone_url":"https://github.com/Metaswitch/calico-neutron.git","svn_url":"https://github.com/Metaswitch/calico-neutron","homepage":"http://projectcalico.org/","size":41060,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"calico-readme"}},"base":{"label":"Metaswitch:calico_2014.2.2","ref":"calico_2014.2.2","sha":"145f7c20a5bda51446196a89770d17b8e12cb6dc","user":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"repo":{"id":21242807,"name":"calico-neutron","full_name":"Metaswitch/calico-neutron","owner":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metaswitch/calico-neutron","description":"The Project Calico specific fork of Neutron.","fork":false,"url":"https://api.github.com/repos/Metaswitch/calico-neutron","forks_url":"https://api.github.com/repos/Metaswitch/calico-neutron/forks","keys_url":"https://api.github.com/repos/Metaswitch/calico-neutron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metaswitch/calico-neutron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metaswitch/calico-neutron/teams","hooks_url":"https://api.github.com/repos/Metaswitch/calico-neutron/hooks","issue_events_url":"https://api.github.com/repos/Metaswitch/calico-neutron/issues/events{/number}","events_url":"https://api.github.com/repos/Metaswitch/calico-neutron/events","assignees_url":"https://api.github.com/repos/Metaswitch/calico-neutron/assignees{/user}","branches_url":"https://api.github.com/repos/Metaswitch/calico-neutron/branches{/branch}","tags_url":"https://api.github.com/repos/Metaswitch/calico-neutron/tags","blobs_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metaswitch/calico-neutron/statuses/{sha}","languages_url":"https://api.github.com/repos/Metaswitch/calico-neutron/languages","stargazers_url":"https://api.github.com/repos/Metaswitch/calico-neutron/stargazers","contributors_url":"https://api.github.com/repos/Metaswitch/calico-neutron/contributors","subscribers_url":"https://api.github.com/repos/Metaswitch/calico-neutron/subscribers","subscription_url":"https://api.github.com/repos/Metaswitch/calico-neutron/subscription","commits_url":"https://api.github.com/repos/Metaswitch/calico-neutron/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metaswitch/calico-neutron/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metaswitch/calico-neutron/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metaswitch/calico-neutron/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metaswitch/calico-neutron/contents/{+path}","compare_url":"https://api.github.com/repos/Metaswitch/calico-neutron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metaswitch/calico-neutron/merges","archive_url":"https://api.github.com/repos/Metaswitch/calico-neutron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metaswitch/calico-neutron/downloads","issues_url":"https://api.github.com/repos/Metaswitch/calico-neutron/issues{/number}","pulls_url":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls{/number}","milestones_url":"https://api.github.com/repos/Metaswitch/calico-neutron/milestones{/number}","notifications_url":"https://api.github.com/repos/Metaswitch/calico-neutron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metaswitch/calico-neutron/labels{/name}","releases_url":"https://api.github.com/repos/Metaswitch/calico-neutron/releases{/id}","created_at":"2014-06-26T14:08:01Z","updated_at":"2015-05-06T16:01:45Z","pushed_at":"2015-05-15T15:33:34Z","git_url":"git://github.com/Metaswitch/calico-neutron.git","ssh_url":"git@github.com:Metaswitch/calico-neutron.git","clone_url":"https://github.com/Metaswitch/calico-neutron.git","svn_url":"https://github.com/Metaswitch/calico-neutron","homepage":"http://projectcalico.org/","size":41060,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"calico-readme"}},"_links":{"self":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/10"},"html":{"href":"https://github.com/Metaswitch/calico-neutron/pull/10"},"issue":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/issues/10"},"comments":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/Metaswitch/calico-neutron/statuses/b69fc1f3672f5dbd2eab055350c624f9dd1130e1"}}}}