)]}'
{"id":"openstack%2Fswift~270235","triplet_id":"openstack%2Fswift~stable%2Fliberty~I74ea49eaa7d5c372cdc2399148d5495d3007dbd0","project":"openstack/swift","branch":"stable/liberty","topic":"bug/1493303","hashtags":[],"change_id":"I74ea49eaa7d5c372cdc2399148d5495d3007dbd0","subject":"Fix memory/socket leak in proxy on truncated SLO/DLO GET","status":"MERGED","created":"2016-01-20 15:00:30.000000000","updated":"2016-01-22 03:41:00.000000000","submitted":"2016-01-22 03:40:59.000000000","submitter":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"total_comment_count":0,"unresolved_comment_count":0,"has_review_started":true,"meta_rev_id":"c543f86cf5d01878b73d4dcad8b4c41ee2fcbcf6","_number":270235,"virtual_id_number":270235,"owner":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"actions":{},"labels":{"Verified":{"approved":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"all":[{"value":2,"date":"2016-01-22 03:40:59.000000000","_account_id":3,"name":"Jenkins","username":"jenkins"},{"value":0,"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"}],"values":{"-2":"Fails","-1":"Doesn\u0027t seem to work"," 0":"No score","+1":"Works for me","+2":"Verified"},"description":"","default_value":0,"optional":true},"Code-Review":{"approved":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"all":[{"value":0,"_account_id":3,"name":"Jenkins","username":"jenkins"},{"value":2,"date":"2016-01-20 15:00:52.000000000","permitted_voting_range":{"min":2,"max":2},"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"}],"values":{"-2":"Do not merge","-1":"This patch needs further work before it can be merged"," 0":"No score","+1":"Looks good to me, but someone else must approve","+2":"Looks good to me (core reviewer)"},"description":"","default_value":0,"optional":true},"Workflow":{"approved":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"all":[{"value":0,"_account_id":3,"name":"Jenkins","username":"jenkins"},{"value":1,"date":"2016-01-20 15:00:52.000000000","permitted_voting_range":{"min":1,"max":1},"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"}],"values":{"-1":"Work in progress"," 0":"Ready for reviews","+1":"Approved"},"description":"","default_value":0,"optional":true}},"removable_reviewers":[],"reviewers":{"REVIEWER":[{"_account_id":3,"name":"Jenkins","username":"jenkins"},{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"}]},"pending_reviewers":{},"reviewer_updates":[{"updated":"2016-01-22 03:40:59.000000000","updated_by":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"reviewer":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"state":"REVIEWER"}],"messages":[{"id":"2466fef889cd56e0489529edb8ae90a7e9b35fd5","author":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"date":"2016-01-20 15:00:30.000000000","message":"Uploaded patch set 1.","accounts_in_message":[],"_revision_number":1},{"id":"22c25310e3c1e22fd908bac49bf6beb88010ec95","author":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"date":"2016-01-20 15:00:52.000000000","message":"Patch Set 1: Code-Review+2 Workflow+1","accounts_in_message":[],"_revision_number":1},{"id":"458d147a4fd858e0c0f1f9dca91a7852ba4c9eb2","author":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"date":"2016-01-20 17:16:18.000000000","message":"Patch Set 1: Verified+1\n\nBuild succeeded (check pipeline).\n\n- gate-swift-pep8 http://logs.openstack.org/35/270235/1/check/gate-swift-pep8/f7a8268/ : SUCCESS in 1m 47s\n- gate-swift-docs http://docs-draft.openstack.org/35/270235/1/check/gate-swift-docs/e950fdb//doc/build/html/ : SUCCESS in 3m 20s\n- gate-swift-python27 http://logs.openstack.org/35/270235/1/check/gate-swift-python27/3686f7f/ : SUCCESS in 5m 43s\n- gate-swift-tox-func http://logs.openstack.org/35/270235/1/check/gate-swift-tox-func/dd854e4/ : SUCCESS in 6m 11s\n- gate-tempest-dsvm-full http://logs.openstack.org/35/270235/1/check/gate-tempest-dsvm-full/62ebbd8/ : SUCCESS in 42m 33s\n- gate-grenade-dsvm http://logs.openstack.org/35/270235/1/check/gate-grenade-dsvm/bb587b0/ : SUCCESS in 45m 04s\n- gate-swift-dsvm-functional http://logs.openstack.org/35/270235/1/check/gate-swift-dsvm-functional/59a9b11/ : SUCCESS in 35m 30s","accounts_in_message":[],"_revision_number":1},{"id":"ec3616a4fff0077d62a21a83a872b192b1297534","author":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"date":"2016-01-20 17:16:35.000000000","message":"Patch Set 1: -Verified\n\nStarting gate jobs.\nhttp://status.openstack.org/zuul/","accounts_in_message":[],"_revision_number":1},{"id":"91e294839629b6c4ad1d222e2c3144e14f5f0b72","author":{"_account_id":13052,"name":"SwiftStack Cluster CI","email":"openstack-ci@swiftstack.com","username":"swiftstack-cluster-ci","tags":["SERVICE_USER"]},"date":"2016-01-21 11:43:23.000000000","message":"Patch Set 1:\n\nBuild succeeded \n\n* cluster-swift-tox-func-ec https://8b86aea46fb38e6450f2-0e5f4c086da474abc1df58826577db2f.ssl.cf1.rackcdn.com/270235/1831/ : SUCCESS\n\n* vm-saio-probe https://8b86aea46fb38e6450f2-0e5f4c086da474abc1df58826577db2f.ssl.cf1.rackcdn.com/270235/1550/probetests/ : SUCCESS\n\n* cluster-swift-ssbench https://8b86aea46fb38e6450f2-0e5f4c086da474abc1df58826577db2f.ssl.cf1.rackcdn.com/270235/2427/ssbench : SUCCESS\n\n* cluster-swift-tox-func https://8b86aea46fb38e6450f2-0e5f4c086da474abc1df58826577db2f.ssl.cf1.rackcdn.com/270235/3790/ : SUCCESS","accounts_in_message":[],"_revision_number":1},{"id":"ef2baa80e5a1f16bcc8e778c401727a38b78d720","author":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"date":"2016-01-22 03:40:59.000000000","message":"Patch Set 1: Verified+2\n\nBuild succeeded (gate pipeline).\n\n- gate-swift-docs http://docs-draft.openstack.org/35/270235/1/gate/gate-swift-docs/73dbb14//doc/build/html/ : SUCCESS in 3m 08s\n- gate-swift-pep8 http://logs.openstack.org/35/270235/1/gate/gate-swift-pep8/f4e98a5/ : SUCCESS in 1m 58s\n- gate-swift-python27 http://logs.openstack.org/35/270235/1/gate/gate-swift-python27/fb70f0c/ : SUCCESS in 4m 26s\n- gate-swift-tox-func http://logs.openstack.org/35/270235/1/gate/gate-swift-tox-func/ef29f35/ : SUCCESS in 5m 41s\n- gate-tempest-dsvm-full http://logs.openstack.org/35/270235/1/gate/gate-tempest-dsvm-full/4916e8c/ : SUCCESS in 59m 09s\n- gate-grenade-dsvm http://logs.openstack.org/35/270235/1/gate/gate-grenade-dsvm/4ba2d7f/ : SUCCESS in 35m 33s\n- gate-swift-dsvm-functional http://logs.openstack.org/35/270235/1/gate/gate-swift-dsvm-functional/5375ac4/ : SUCCESS in 27m 01s","accounts_in_message":[],"_revision_number":1},{"id":"8ad3d42d45d09b2dd3177fd7c2fdb780283d4cae","date":"2016-01-22 03:41:00.000000000","message":"Change has been successfully merged into the git repository by Jenkins","accounts_in_message":[],"_revision_number":1}],"current_revision_number":1,"current_revision":"8c1976aa771f8c43c5dbe676bd9a5efc69f09eae","revisions":{"8c1976aa771f8c43c5dbe676bd9a5efc69f09eae":{"kind":"REWORK","_number":1,"created":"2016-01-20 15:00:30.000000000","uploader":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"ref":"refs/changes/35/270235/1","fetch":{"anonymous http":{"url":"https://review.opendev.org/openstack/swift","ref":"refs/changes/35/270235/1","commands":{"Checkout":"git fetch https://review.opendev.org/openstack/swift refs/changes/35/270235/1 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.opendev.org/openstack/swift refs/changes/35/270235/1 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.opendev.org/openstack/swift refs/changes/35/270235/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.opendev.org/openstack/swift refs/changes/35/270235/1"}}},"commit":{"parents":[{"commit":"74b12f26c43b3afca90a4b49f1e5a9503548ec0f","subject":"Update .gitreview for stable/liberty","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/swift/commit/74b12f26c43b3afca90a4b49f1e5a9503548ec0f"}]}],"author":{"name":"Samuel Merritt","email":"sam@swiftstack.com","date":"2015-12-09 00:36:05.000000000","tz":-480},"committer":{"name":"John Dickinson","email":"me@not.mn","date":"2016-01-20 14:56:50.000000000","tz":-480},"subject":"Fix memory/socket leak in proxy on truncated SLO/DLO GET","message":"Fix memory/socket leak in proxy on truncated SLO/DLO GET\n\nWhen a client disconnected while consuming an SLO or DLO GET response,\nthe proxy would leak a socket. This could be observed via strace as a\nsocket that had shutdown() called on it, but was never closed. It\ncould also be observed by counting entries in /proc/\u003cpid\u003e/fd, where\n\u003cpid\u003e is the pid of a proxy server worker process.\n\nThis is due to a memory leak in SegmentedIterable. A SegmentedIterable\nhas an \u0027app_iter\u0027 attribute, which is a generator. That generator\nreferences \u0027self\u0027 (the SegmentedIterable object). This creates a\ncyclic reference: the generator refers to the SegmentedIterable, and\nthe SegmentedIterable refers to the generator.\n\nPython can normally handle cyclic garbage; reference counting won\u0027t\nreclaim it, but the garbage collector will. However, objects with\nfinalizers will stop the garbage collector from collecting them* and\nthe cycle of which they are part.\n\nFor most objects, \"has finalizer\" is synonymous with \"has a __del__\nmethod\". However, a generator has a finalizer once it\u0027s started\nrunning and before it finishes: basically, while it has stack frames\nassociated with it**.\n\nWhen a client disconnects mid-stream, we get a memory leak. We have\nour SegmentedIterable object (call it \"si\"), and its associated\ngenerator. si.app_iter is the generator, and the generator closes over\nsi, so we have a cycle; and the generator has started but not yet\nfinished, so the generator needs finalization; hence, the garbage\ncollector won\u0027t ever clean it up.\n\nThe socket leak comes in because the generator *also* refers to the\nrequest\u0027s WSGI environment, which contains wsgi.input, which\nultimately refers to a _socket object from the standard\nlibrary. Python\u0027s _socket objects only close their underlying file\ndescriptor when their reference counts fall to 0***.\n\nThis commit makes SegmentedIterable.close() call\nself.app_iter.close(), thereby unwinding its generator\u0027s stack and\nmaking it eligible for garbage collection.\n\n* in Python \u003c 3.4, at least. See PEP 442.\n\n** see PyGen_NeedsFinalizing() in Objects/genobject.c and also\n   has_finalizer() in Modules/gcmodule.c in Python.\n\n*** see sock_dealloc() in Modules/socketmodule.c in Python. See\n    sock_close() in the same file for the other half of the sad story.\n\nThis closes CVE-2016-0738.\n\nCloses-Bug: 1493303\n\nChange-Id: I74ea49eaa7d5c372cdc2399148d5495d3007dbd0\nCo-Authored-By: Kota Tsuyuzaki \u003ctsuyuzaki.kota@lab.ntt.co.jp\u003e\n","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/swift/commit/8c1976aa771f8c43c5dbe676bd9a5efc69f09eae"}],"resolve_conflicts_web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/swift/commit/8c1976aa771f8c43c5dbe676bd9a5efc69f09eae"}]},"branch":"refs/heads/stable/liberty"}},"requirements":[],"submit_records":[],"submit_requirements":[]}
