Shutdown internally-created executor on error in TransferManager - #3427
Merged
bhoradc merged 2 commits intoSep 24, 2026
Merged
Conversation
bhoradc
marked this pull request as ready for review
September 24, 2026 00:33
|
Detected 1 possible performance regressions:
|
jterapin
reviewed
Sep 24, 2026
jterapin
left a comment
Contributor
There was a problem hiding this comment.
Once you address the below comment regarding object customization, we should be good to approve.
Unrelated: I found some bugs relating to TM so I will have a fix out shortly.
richardwang1124
approved these changes
Sep 24, 2026
1 task
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3419
Description
TransferManagershuts down its internally-createdDefaultExecutorafter the operation completes. Because the shutdown call is not in anensureblock, any error raised during the transfer skips it, leaving the executor's worker threads parked on its internal queue forever. In long-running processes with repeated failures this accumulates untilthread or memory limits are hit.
Present in all five methods that create an internal executor:
upload_file,upload_stream,download_file,upload_directory,download_directory.Fix
Wrap each operation body in
begin/ensuresoexecutor.shutdown unless @executorruns on both success and error paths. Theunless @executorguard is preserved, so custom executors remain the caller'sresponsibility.
DefaultExecutor#shutdownis idempotent, so no double-shutdown risk.Testing
Added one regression spec per method. Each stubs a failure, captures the internally-created
DefaultExecutor, and assertsshutdownwas called on it. All five fail onmainand pass with this change.Locally ran the full CI-equivalent suite (
rake build,rake test:spec,rbs collection install && rake rbs:test) - all green.AI-assisted and manually reviewed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.