)]}'
{"id":"openstack%2Fswift~270233","triplet_id":"openstack%2Fswift~master~Ib86c4c45641485ce1034212bf6f53bb84f02f612","project":"openstack/swift","branch":"master","topic":"bug/1493303","hashtags":[],"change_id":"Ib86c4c45641485ce1034212bf6f53bb84f02f612","subject":"Fix memory/socket leak in proxy on truncated SLO/DLO GET","status":"MERGED","created":"2016-01-20 14:59:53.000000000","updated":"2016-01-22 03:41:07.000000000","submitted":"2016-01-22 03:41:07.000000000","submitter":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"total_comment_count":0,"unresolved_comment_count":0,"has_review_started":true,"meta_rev_id":"bfca4077238b2a71d7e889b29e9235fb3a719592","_number":270233,"virtual_id_number":270233,"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:41:07.000000000","post_submit":true,"_account_id":3,"name":"Jenkins","username":"jenkins"},{"value":0,"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},{"value":0,"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"}],"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:01:21.000000000","permitted_voting_range":{"min":2,"max":2},"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},{"value":0,"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"}],"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:01:21.000000000","permitted_voting_range":{"min":1,"max":1},"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},{"value":0,"date":"2016-01-20 14:59:54.000000000","_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"}],"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"},{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"}]},"pending_reviewers":{},"reviewer_updates":[{"updated":"2016-01-20 14:59:54.000000000","updated_by":{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"},"reviewer":{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"},"state":"REVIEWER"},{"updated":"2016-01-22 03:41:07.000000000","updated_by":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"reviewer":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"state":"REVIEWER"}],"messages":[{"id":"1326639a29654d470c9498f4d75bdf26e4a89b3e","author":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"date":"2016-01-20 14:59:53.000000000","message":"Uploaded patch set 1.","accounts_in_message":[],"_revision_number":1},{"id":"4df9e9e70d2e9e923c8b9741d6cae65a85e87e42","author":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"date":"2016-01-20 15:01:21.000000000","message":"Patch Set 1: Code-Review+2 Workflow+1","accounts_in_message":[],"_revision_number":1},{"id":"74c8ab7813e3914d06adfd36224839392c6b1359","author":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"date":"2016-01-20 17:17:36.000000000","message":"Patch Set 1: Verified+1\n\nBuild succeeded (check pipeline).\n\n- gate-swift-pep8 http://logs.openstack.org/33/270233/1/check/gate-swift-pep8/b9cdddd/ : SUCCESS in 1m 15s\n- gate-swift-docs http://docs-draft.openstack.org/33/270233/1/check/gate-swift-docs/f58aef7//doc/build/html/ : SUCCESS in 2m 42s\n- gate-swift-python27 http://logs.openstack.org/33/270233/1/check/gate-swift-python27/45b87cd/ : SUCCESS in 4m 25s\n- gate-swift-python34 http://logs.openstack.org/33/270233/1/check/gate-swift-python34/99399ee/ : SUCCESS in 1m 52s\n- gate-swift-tox-func http://logs.openstack.org/33/270233/1/check/gate-swift-tox-func/24155a4/ : SUCCESS in 4m 08s\n- gate-tempest-dsvm-full http://logs.openstack.org/33/270233/1/check/gate-tempest-dsvm-full/5d1e8f1/ : SUCCESS in 51m 40s\n- gate-grenade-dsvm http://logs.openstack.org/33/270233/1/check/gate-grenade-dsvm/b6ef0ee/ : SUCCESS in 46m 59s\n- gate-swift-dsvm-functional http://logs.openstack.org/33/270233/1/check/gate-swift-dsvm-functional/26f6f0d/ : SUCCESS in 30m 38s","accounts_in_message":[],"_revision_number":1},{"id":"f430adc12d7307f187bfb546640f2fedbaa6175c","author":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"date":"2016-01-20 17:17:55.000000000","message":"Patch Set 1: -Verified\n\nStarting gate jobs.\nhttp://status.openstack.org/zuul/","accounts_in_message":[],"_revision_number":1},{"id":"ef4f8fed49173e1338b795fd7a657aca5a349ca1","author":{"_account_id":13052,"name":"SwiftStack Cluster CI","email":"openstack-ci@swiftstack.com","username":"swiftstack-cluster-ci","tags":["SERVICE_USER"]},"date":"2016-01-21 09:10:42.000000000","message":"Patch Set 1:\n\nBuild succeeded \n\n* cluster-swift-tox-func-ec https://8b86aea46fb38e6450f2-0e5f4c086da474abc1df58826577db2f.ssl.cf1.rackcdn.com/270233/1828/ : SUCCESS\n\n* vm-saio-probe https://8b86aea46fb38e6450f2-0e5f4c086da474abc1df58826577db2f.ssl.cf1.rackcdn.com/270233/1547/probetests/ : SUCCESS\n\n* cluster-swift-ssbench https://8b86aea46fb38e6450f2-0e5f4c086da474abc1df58826577db2f.ssl.cf1.rackcdn.com/270233/2424/ssbench : SUCCESS\n\n* cluster-swift-tox-func https://8b86aea46fb38e6450f2-0e5f4c086da474abc1df58826577db2f.ssl.cf1.rackcdn.com/270233/3787/ : SUCCESS","accounts_in_message":[],"_revision_number":1},{"id":"d2b3b3fc92453034141ae3ff8be3c5e06c86c043","date":"2016-01-22 03:41:07.000000000","message":"Change has been successfully merged into the git repository by Jenkins","accounts_in_message":[],"_revision_number":1},{"id":"9a400f47a8d531bd8a51dba2b73590a076648d86","author":{"_account_id":3,"name":"Jenkins","username":"jenkins"},"date":"2016-01-22 03:41:07.000000000","message":"Patch Set 1: Verified+2\n\nBuild succeeded (gate pipeline).\n\n- gate-swift-docs http://docs-draft.openstack.org/33/270233/1/gate/gate-swift-docs/8a2ca78//doc/build/html/ : SUCCESS in 3m 19s\n- gate-swift-pep8 http://logs.openstack.org/33/270233/1/gate/gate-swift-pep8/4abefbd/ : SUCCESS in 1m 16s\n- gate-swift-python27 http://logs.openstack.org/33/270233/1/gate/gate-swift-python27/2487331/ : SUCCESS in 4m 05s\n- gate-swift-python34 http://logs.openstack.org/33/270233/1/gate/gate-swift-python34/89d2d96/ : SUCCESS in 2m 32s\n- gate-swift-tox-func http://logs.openstack.org/33/270233/1/gate/gate-swift-tox-func/82258c1/ : SUCCESS in 4m 43s\n- gate-tempest-dsvm-full http://logs.openstack.org/33/270233/1/gate/gate-tempest-dsvm-full/7f2e7eb/ : SUCCESS in 44m 34s\n- gate-grenade-dsvm http://logs.openstack.org/33/270233/1/gate/gate-grenade-dsvm/371b997/ : SUCCESS in 44m 14s\n- gate-swift-dsvm-functional http://logs.openstack.org/33/270233/1/gate/gate-swift-dsvm-functional/d32af06/ : SUCCESS in 24m 30s","accounts_in_message":[],"_revision_number":1}],"current_revision_number":1,"current_revision":"58359269b0e971e52f0eb7f97221566ca2148014","revisions":{"58359269b0e971e52f0eb7f97221566ca2148014":{"kind":"REWORK","_number":1,"created":"2016-01-20 14:59:53.000000000","uploader":{"_account_id":330,"name":"John Dickinson","email":"me@not.mn","username":"notmyname"},"ref":"refs/changes/33/270233/1","fetch":{"anonymous http":{"url":"https://review.opendev.org/openstack/swift","ref":"refs/changes/33/270233/1","commands":{"Checkout":"git fetch https://review.opendev.org/openstack/swift refs/changes/33/270233/1 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.opendev.org/openstack/swift refs/changes/33/270233/1 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.opendev.org/openstack/swift refs/changes/33/270233/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.opendev.org/openstack/swift refs/changes/33/270233/1"}}},"commit":{"parents":[{"commit":"b9fd530657e885bd7c1796d1075803e690563b1d","subject":"Merge \"Sleep enough for trampoline\"","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/swift/commit/b9fd530657e885bd7c1796d1075803e690563b1d"}]}],"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:54:14.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\nCo-Authored-By: Kota Tsuyuzaki \u003ctsuyuzaki.kota@lab.ntt.co.jp\u003e\n\nChange-Id: Ib86c4c45641485ce1034212bf6f53bb84f02f612\n","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/swift/commit/58359269b0e971e52f0eb7f97221566ca2148014"}],"resolve_conflicts_web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/swift/commit/58359269b0e971e52f0eb7f97221566ca2148014"}]},"branch":"refs/heads/master"}},"requirements":[],"submit_records":[],"submit_requirements":[]}
