diff --git a/s3transfer/futures.py b/s3transfer/futures.py index 39e071fb..fccc997d 100644 --- a/s3transfer/futures.py +++ b/s3transfer/futures.py @@ -320,7 +320,15 @@ def submit(self, executor, task, tag=None): task, executor, self.transfer_id ) ) - future = executor.submit(task, tag=tag) + try: + future = executor.submit(task, tag=tag) + except RuntimeError: + # We just tried to submit a task to an executor that was shutdown + # If that task was the CompleteDownloadNOOPTask, then we had + # expected it to call .announce_done(). If that isn't happening, + # then we need to call it ourselves + self.announce_done() + raise # Add this created future to the list of associated future just # in case it is needed during cleanups. self.add_associated_future(future)