{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-storage-python/issues/215","repository_url":"https://api.github.com/repos/Azure/azure-storage-python","labels_url":"https://api.github.com/repos/Azure/azure-storage-python/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-storage-python/issues/215/comments","events_url":"https://api.github.com/repos/Azure/azure-storage-python/issues/215/events","html_url":"https://github.com/Azure/azure-storage-python/pull/215","id":172535112,"number":215,"title":"BlockBlobService.exists leaks connections","user":{"login":"rraval","id":373566,"avatar_url":"https://avatars.githubusercontent.com/u/373566?v=3","gravatar_id":"","url":"https://api.github.com/users/rraval","html_url":"https://github.com/rraval","followers_url":"https://api.github.com/users/rraval/followers","following_url":"https://api.github.com/users/rraval/following{/other_user}","gists_url":"https://api.github.com/users/rraval/gists{/gist_id}","starred_url":"https://api.github.com/users/rraval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rraval/subscriptions","organizations_url":"https://api.github.com/users/rraval/orgs","repos_url":"https://api.github.com/users/rraval/repos","events_url":"https://api.github.com/users/rraval/events{/privacy}","received_events_url":"https://api.github.com/users/rraval/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/azure-storage-python/labels/cla-not-required","name":"cla-not-required","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-22T19:34:03Z","updated_at":"2016-09-01T00:09:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Azure/azure-storage-python/pulls/215","html_url":"https://github.com/Azure/azure-storage-python/pull/215","diff_url":"https://github.com/Azure/azure-storage-python/pull/215.diff","patch_url":"https://github.com/Azure/azure-storage-python/pull/215.patch"},"body":"If the underlying blob does not exist, the connection isn't returned\r\nback to the pool. Instead, it's left hanging in an incomplete state and\r\nfuture queries end up creating new connections.\r\n\r\n    >>> import logging\r\n    >>> logging.basicConfig(level=logging.DEBUG)\r\n\r\n    >>> service = BlockBlobService(...)\r\n    >>> service.create_container('container')\r\n    >>> service.create_blob_from_text('container', 'blob', 'some text')\r\n\r\nThe connection is properly returned to the pool when testing existence\r\nof a blob that does exist.\r\n\r\n    >>> service.exists('container', 'blob')\r\n    INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): encircledevstorage.blob.core.windows.net\r\n    DEBUG:requests.packages.urllib3.connectionpool:\"HEAD /test-container/blob HTTP/1.1\" 200 0\r\n    True\r\n\r\n    >>> service.exists('container', 'blob')\r\n    DEBUG:requests.packages.urllib3.connectionpool:\"HEAD /test-container/blob HTTP/1.1\" 200 0\r\n    True\r\n\r\nHowever, if the blob does not exist, a new connection is created every\r\ntime. Note the `INFO` log lines:\r\n\r\n    >>> # this one reuses the existing connection\r\n    >>> service.exists('test-container', 'no-exist')\r\n    DEBUG:requests.packages.urllib3.connectionpool:\"HEAD /test-container/no-exist HTTP/1.1\" 404 0\r\n    False\r\n\r\n    >>> # creates a new one!\r\n    >>> service.exists('test-container', 'no-exist')\r\n    INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (2): encircledevstorage.blob.core.windows.net\r\n    DEBUG:requests.packages.urllib3.connectionpool:\"HEAD /test-container/no-exist HTTP/1.1\" 404 0\r\n    False\r\n\r\n    >>> # creates another one\r\n    >>> service.exists('test-container', 'no-exist')\r\n    INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (3): encircledevstorage.blob.core.windows.net\r\n    DEBUG:requests.packages.urllib3.connectionpool:\"HEAD /test-container/no-exist HTTP/1.1\" 404 0\r\n    False"},"comment":{"url":"https://api.github.com/repos/Azure/azure-storage-python/issues/comments/243939543","html_url":"https://github.com/Azure/azure-storage-python/pull/215#issuecomment-243939543","issue_url":"https://api.github.com/repos/Azure/azure-storage-python/issues/215","id":243939543,"user":{"login":"kfarmer-msft","id":16674922,"avatar_url":"https://avatars.githubusercontent.com/u/16674922?v=3","gravatar_id":"","url":"https://api.github.com/users/kfarmer-msft","html_url":"https://github.com/kfarmer-msft","followers_url":"https://api.github.com/users/kfarmer-msft/followers","following_url":"https://api.github.com/users/kfarmer-msft/following{/other_user}","gists_url":"https://api.github.com/users/kfarmer-msft/gists{/gist_id}","starred_url":"https://api.github.com/users/kfarmer-msft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kfarmer-msft/subscriptions","organizations_url":"https://api.github.com/users/kfarmer-msft/orgs","repos_url":"https://api.github.com/users/kfarmer-msft/repos","events_url":"https://api.github.com/users/kfarmer-msft/events{/privacy}","received_events_url":"https://api.github.com/users/kfarmer-msft/received_events","type":"User","site_admin":false},"created_at":"2016-09-01T00:09:49Z","updated_at":"2016-09-01T00:09:49Z","body":"Thanks, @rraval --\r\n\r\nCould you please resubmit this against the dev branch, and add a change log entry (as version 0.34.0)?"}}
{"actor":{"display_login":"kfarmer-msft"}}