{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/58200318","id":58200318,"diff_hunk":"@@ -567,19 +567,19 @@ class HttpExt(private val config: Config)(implicit val system: ActorSystem) exte\n     val gatewayPromise = Promise[PoolGateway]()\n     hostPoolCache.putIfAbsent(setup, gatewayPromise.future) match {\n       case null ⇒ // only one thread can get here at a time\n-        val whenShuttingDown = Promise[Done]()\n+        // holds the reference to the fastFuture, so we can remove it on the shutdown started hook of the pool gateway\n+        var fastFuture: Future[PoolGateway] = null\n         val gateway =\n-          try new PoolGateway(setup, whenShuttingDown)\n+          try new PoolGateway(setup, () => hostPoolCache.remove(setup, fastFuture))","path":"akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala","position":18,"original_position":18,"commit_id":"765ed007b529147d57fcbe02723b5cd28749dfb7","original_commit_id":"765ed007b529147d57fcbe02723b5cd28749dfb7","user":{"login":"viktorklang","id":10871,"avatar_url":"https://avatars.githubusercontent.com/u/10871?v=3","gravatar_id":"","url":"https://api.github.com/users/viktorklang","html_url":"https://github.com/viktorklang","followers_url":"https://api.github.com/users/viktorklang/followers","following_url":"https://api.github.com/users/viktorklang/following{/other_user}","gists_url":"https://api.github.com/users/viktorklang/gists{/gist_id}","starred_url":"https://api.github.com/users/viktorklang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viktorklang/subscriptions","organizations_url":"https://api.github.com/users/viktorklang/orgs","repos_url":"https://api.github.com/users/viktorklang/repos","events_url":"https://api.github.com/users/viktorklang/events{/privacy}","received_events_url":"https://api.github.com/users/viktorklang/received_events","type":"User","site_admin":false},"body":"How is it safe to refer to the `fastFuture`-var in the supplied function?","created_at":"2016-04-01T12:48:15Z","updated_at":"2016-04-01T12:48:15Z","html_url":"https://github.com/akka/akka/pull/20190#discussion_r58200318","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/20190","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/58200318"},"html":{"href":"https://github.com/akka/akka/pull/20190#discussion_r58200318"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/20190"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/20190","id":64780508,"html_url":"https://github.com/akka/akka/pull/20190","diff_url":"https://github.com/akka/akka/pull/20190.diff","patch_url":"https://github.com/akka/akka/pull/20190.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/20190","number":20190,"state":"open","locked":false,"title":"http: Fix spinlock race condition in PoolGateway","user":{"login":"nkvoll","id":391931,"avatar_url":"https://avatars.githubusercontent.com/u/391931?v=3","gravatar_id":"","url":"https://api.github.com/users/nkvoll","html_url":"https://github.com/nkvoll","followers_url":"https://api.github.com/users/nkvoll/followers","following_url":"https://api.github.com/users/nkvoll/following{/other_user}","gists_url":"https://api.github.com/users/nkvoll/gists{/gist_id}","starred_url":"https://api.github.com/users/nkvoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkvoll/subscriptions","organizations_url":"https://api.github.com/users/nkvoll/orgs","repos_url":"https://api.github.com/users/nkvoll/repos","events_url":"https://api.github.com/users/nkvoll/events{/privacy}","received_events_url":"https://api.github.com/users/nkvoll/received_events","type":"User","site_admin":false},"body":"Removes the race condition between the side effects needed from \"shutdown started\" and \"shutdown completed\" by waiting for the shutdown started `Promise` to eventually callback the `shutdownStartedHandled` `Future`.\r\n\r\nUsages of the `PoolGateway` that do not need special handling / side effects can use the `shutdownStartedPromise.future` as the `shutdownStartedHandled` argument, as shown in https://github.com/akka/akka/compare/master...nkvoll:fix-spinlock-race-condition-in-akka-http-client-connection-pool?expand=1#diff-57c314af9e0369f72b0f60ff1fa56f0aR574\r\n\r\nAttempts to address: https://github.com/akka/akka/issues/20071.","created_at":"2016-03-31T12:19:56Z","updated_at":"2016-04-01T12:48:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"395e0f157b4647f45c4973ae4655e2be37e6ae68","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/20190/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/20190/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/20190/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/765ed007b529147d57fcbe02723b5cd28749dfb7","head":{"label":"nkvoll:fix-spinlock-race-condition-in-akka-http-client-connection-pool","ref":"fix-spinlock-race-condition-in-akka-http-client-connection-pool","sha":"765ed007b529147d57fcbe02723b5cd28749dfb7","user":{"login":"nkvoll","id":391931,"avatar_url":"https://avatars.githubusercontent.com/u/391931?v=3","gravatar_id":"","url":"https://api.github.com/users/nkvoll","html_url":"https://github.com/nkvoll","followers_url":"https://api.github.com/users/nkvoll/followers","following_url":"https://api.github.com/users/nkvoll/following{/other_user}","gists_url":"https://api.github.com/users/nkvoll/gists{/gist_id}","starred_url":"https://api.github.com/users/nkvoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkvoll/subscriptions","organizations_url":"https://api.github.com/users/nkvoll/orgs","repos_url":"https://api.github.com/users/nkvoll/repos","events_url":"https://api.github.com/users/nkvoll/events{/privacy}","received_events_url":"https://api.github.com/users/nkvoll/received_events","type":"User","site_admin":false},"repo":{"id":55147981,"name":"akka","full_name":"nkvoll/akka","owner":{"login":"nkvoll","id":391931,"avatar_url":"https://avatars.githubusercontent.com/u/391931?v=3","gravatar_id":"","url":"https://api.github.com/users/nkvoll","html_url":"https://github.com/nkvoll","followers_url":"https://api.github.com/users/nkvoll/followers","following_url":"https://api.github.com/users/nkvoll/following{/other_user}","gists_url":"https://api.github.com/users/nkvoll/gists{/gist_id}","starred_url":"https://api.github.com/users/nkvoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkvoll/subscriptions","organizations_url":"https://api.github.com/users/nkvoll/orgs","repos_url":"https://api.github.com/users/nkvoll/repos","events_url":"https://api.github.com/users/nkvoll/events{/privacy}","received_events_url":"https://api.github.com/users/nkvoll/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nkvoll/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/nkvoll/akka","forks_url":"https://api.github.com/repos/nkvoll/akka/forks","keys_url":"https://api.github.com/repos/nkvoll/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nkvoll/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nkvoll/akka/teams","hooks_url":"https://api.github.com/repos/nkvoll/akka/hooks","issue_events_url":"https://api.github.com/repos/nkvoll/akka/issues/events{/number}","events_url":"https://api.github.com/repos/nkvoll/akka/events","assignees_url":"https://api.github.com/repos/nkvoll/akka/assignees{/user}","branches_url":"https://api.github.com/repos/nkvoll/akka/branches{/branch}","tags_url":"https://api.github.com/repos/nkvoll/akka/tags","blobs_url":"https://api.github.com/repos/nkvoll/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nkvoll/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nkvoll/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/nkvoll/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nkvoll/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/nkvoll/akka/languages","stargazers_url":"https://api.github.com/repos/nkvoll/akka/stargazers","contributors_url":"https://api.github.com/repos/nkvoll/akka/contributors","subscribers_url":"https://api.github.com/repos/nkvoll/akka/subscribers","subscription_url":"https://api.github.com/repos/nkvoll/akka/subscription","commits_url":"https://api.github.com/repos/nkvoll/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/nkvoll/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/nkvoll/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/nkvoll/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/nkvoll/akka/contents/{+path}","compare_url":"https://api.github.com/repos/nkvoll/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nkvoll/akka/merges","archive_url":"https://api.github.com/repos/nkvoll/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nkvoll/akka/downloads","issues_url":"https://api.github.com/repos/nkvoll/akka/issues{/number}","pulls_url":"https://api.github.com/repos/nkvoll/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/nkvoll/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/nkvoll/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nkvoll/akka/labels{/name}","releases_url":"https://api.github.com/repos/nkvoll/akka/releases{/id}","deployments_url":"https://api.github.com/repos/nkvoll/akka/deployments","created_at":"2016-03-31T12:15:03Z","updated_at":"2016-03-31T12:15:14Z","pushed_at":"2016-03-31T15:13:47Z","git_url":"git://github.com/nkvoll/akka.git","ssh_url":"git@github.com:nkvoll/akka.git","clone_url":"https://github.com/nkvoll/akka.git","svn_url":"https://github.com/nkvoll/akka","homepage":"http://akka.io","size":191975,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"akka:master","ref":"master","sha":"a0515780dbd59fc8064cd16a402920766f0131cb","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2016-04-01T06:20:19Z","pushed_at":"2016-04-01T12:17:45Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":203518,"stargazers_count":5320,"watchers_count":5320,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1651,"mirror_url":null,"open_issues_count":717,"forks":1651,"open_issues":717,"watchers":5320,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/20190"},"html":{"href":"https://github.com/akka/akka/pull/20190"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/20190"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/20190/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/20190/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/20190/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/765ed007b529147d57fcbe02723b5cd28749dfb7"}}}}