aws-sdk-cpp
aws-sdk-cpp copied to clipboard
TransferManager race condition in DoSinglePartDownload
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- [x ] I've gone though Developer Guide and API reference
- [x ] I've searched for previous similar issues and didn't find any solution
Describe the bug Application code is downloading a small file using transfer manager. Application needs to open the file and verify contents but the file is open in the TransferManager and application code intermittently fails.
SDK version number 1.8.46
Platform/OS/Hardware/Device Windows
To Reproduce (observed behavior)
auto createStreamFn = [=]() { return Aws::New<Aws::FStream>("Download", file.c_str(), std::ios_base::out | std::ios_base::in | std::ios_base::binary | std::ios_base::trunc); };
auto handle = m_TransferManager->DownloadFile(...);
handle->WaitUntilFinished();
// open file here
TransferManager::DoSinglePartDownload eventually calls handle->UpdateStatus(Transfer::COMPLETED) upon success which releases the application code that is blocked on WaitUntilFinished() but the getObjectOutcome doesn't always go out of scope to close the stream so the application code is failing to open the file because it is still open.
Expected behavior Stream should be cleaned up before callback releasing client code waiting on WaitUntiFinished(). I believe this is happening in the Multipart case.
Logs/output
To enable logging, set the following system properties:
REMEMBER TO SANITIZE YOUR PERSONAL INFO
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
Aws::InitAPI(options)
Additional context Thank you!
Greetings! Sorry to say but this is a very old issue that is probably not getting as much attention as it deservers. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to open a new one.