From c03d53ab7737e208d9c436088e41f60fdab96b30 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Wed, 4 Nov 2015 12:25:19 -0800 Subject: [PATCH] Close EC fragment iterators in the GreenThread that's consuming them Otherwise, we might try to close them while they're already running. This should prevent conditional SLO requests from returning 500 when they should have returned 304 or 412. Change-Id: I075a892f901c18ab5c178c9c4a2f367b76ae78e2 Related-Change: I156d873c72c19623bcfbf39bf120c98800b3cada --- swift/proxy/controllers/base.py | 5 ----- swift/proxy/controllers/obj.py | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py index 1e55264045..a5983a93d4 100644 --- a/swift/proxy/controllers/base.py +++ b/swift/proxy/controllers/base.py @@ -920,7 +920,6 @@ class ResumingGetter(object): if nchunks % 5 == 0: sleep() - part_iter = None try: while True: start_byte, end_byte, length, headers, part = \ @@ -932,10 +931,6 @@ class ResumingGetter(object): 'entity_length': length, 'headers': headers, 'part_iter': part_iter} self.pop_range() - except GeneratorExit: - if part_iter: - part_iter.close() - raise except StopIteration: req.environ['swift.non_client_disconnect'] = True diff --git a/swift/proxy/controllers/obj.py b/swift/proxy/controllers/obj.py index 92d76eb418..87d3b5241c 100644 --- a/swift/proxy/controllers/obj.py +++ b/swift/proxy/controllers/obj.py @@ -1428,6 +1428,7 @@ class ECAppIter(object): finally: queue.resize(2) # ensure there's room queue.put(None) + frag_iter.close() with ContextPool(len(fragment_iters)) as pool: for frag_iter, queue in zip(fragment_iters, queues):