-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shutdown task executor before aborting multipart uploads
There's a race condition in which multipart uploads can still be kept alive because aborting a multipart uploads can happen while existing tasks are still being executed. We must shutdown the executor before we can then abort multipart uploads. This order was correct in the normal shutdown case, but for the case where a user 'Ctrl-C's the process or where unexpected exceptions propogate back to the S3 handler, the order was reversed. In other words, the race condition exposed two possibilities: Proper cleanup: t1 ---|start_part|-------------|end_part|--------------------- | join t2 ---|start_part|-------------|end_part|--------------------- | join main -----------------|ctrl-c|---------------|abort_upload|----- Bad cleanup: t1 ---|start_part|--------------------------------|end_part|-- | join t2 ---|start_part|--------------------------------|end_part|-- | join main -----------------|ctrl-c|--|abort_upload|------------------ There's also a gap in test coverage here, so I've added a test case for this case.
- Loading branch information
Showing
2 changed files
with
51 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters