Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash when upload file with transfer manager #3151

Closed
lzw06061139 opened this issue Oct 17, 2024 · 3 comments
Closed

crash when upload file with transfer manager #3151

lzw06061139 opened this issue Oct 17, 2024 · 3 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@lzw06061139
Copy link

Describe the bug

using transfermanager and fsstream to upload file to aws s3 compitable storage(ceph), the c program crashed.

Expected Behavior

upload the file successfully.

Current Behavior

log:
multipart_upload_concurrency: key={bucket}/file1.txt file=/{xxx}/file1.txt
dmesg:
trap divide error ip:7f4bdc614383 sp:7f4ba4ff62d0 error:0 in libaws-cpp-sdk-transfer.so[7f4bdc5fd000+22000]

core dump stack:
gdb) bt
#0 [34m0x00007f4bdc614383[m in [33mAws::Transfer::TransferManager::DoMultiPartUpload(std::shared_ptrstd::iostream const&, std::shared_ptrAws::Transfer::TransferHandle const&)[m () from [32m/usr/local/lib/libaws-cpp-sdk-transfer.so[m
#1 [34m0x00007f4bdc615fc3[m in [33mstd::_Function_handler<void (), std::_Bind<Aws::Transfer::TransferManager::SubmitUpload(std::shared_ptrAws::Transfer::TransferHandle const&, std::shared_ptrstd::iostream const&)::{lambda()#1} ()> >::_M_invoke(std::_Any_data const&)[m
() from [32m/usr/local/lib/libaws-cpp-sdk-transfer.so[m
#2 [34m0x00007f4bdc95a45d[m in [33mAws::Utils::Threading::ThreadTask::MainTaskRunner()[m () from [32m/usr/local/lib/libaws-cpp-sdk-core.so[m
#3 [34m0x00007f4bdc2f2df4[m in [33m??[m () from [32m/usr/lib/x86_64-linux-gnu/libstdc++.so.6[m
#4 [34m0x00007f4bdcaf3609[m in [33mstart_thread[m ([36marg[m=) at [32mpthread_create.c[m:477
#5 [34m0x00007f4bdc51d353[m in [33mclone[m () at [32m../sysdeps/unix/sysv/linux/x86_64/clone.S[m:95

Reproduction Steps

log_debug("multipart_upload_concurrency: key=%s/%s file=%s", bucket.c_str(), key.c_str(), filename.c_str());
auto executor = Aws::MakeSharedAws::Utils::Threading::PooledThreadExecutor("executor", TRANSFER_MANAGER_THREADS_NUM);
Aws::Transfer::TransferManagerConfiguration transfer_config(executor.get());
transfer_config.s3Client = client;
transfer_config.bufferSize = chunk_size;
transfer_config.transferBufferMaxHeapSize = chunk_size * threads_num;

auto transfer_manager = Aws::Transfer::TransferManager::Create(transfer_config);

auto ioStream = Aws::MakeShared<Aws::FStream>("FileStream", filename.c_str());
auto uploadHandle = transfer_manager->UploadFile(ioStream, bucket.c_str(), key.c_str(), "text/plain", Aws::Map<Aws::String, Aws::String>());
uploadHandle->WaitUntilFinished();

bool success = uploadHandle->GetStatus() == Aws::Transfer::TransferStatus::COMPLETED; 
if (!success)
{
    auto error = uploadHandle->GetLastError();           
    log_error("multipart_upload_concurrency: bucket=%s key=%s error_message=%s", bucket.c_str(), key.c_str(), error.GetMessage().c_str());
    return static_cast<int>(error.GetErrorType());
}
return 0;

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.11.386

Compiler and Version used

cd aws-sdk-cpp \ && mkdir build && cd build \ && cmake3 -DBUILD_ONLY="core;s3;transfer" .. \ && cmake3 --build . \ && cmake3 --install . \

Operating System and version

ubuntu 20.04 (5.15.0-122-generic)

@lzw06061139 lzw06061139 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 17, 2024
@lzw06061139
Copy link
Author

ps: if read data out from file and then upload by PutObject it works well. the code snippet of upload file by putobject:
const std::shared_ptrAws::IOStream input_data = Aws::MakeSharedAws::StringStream("");
*input_data << data;

Aws::S3::Model::PutObjectRequest request;
request.SetBucket(bucket);
request.SetKey(key);
request.SetBody(input_data);
auto outcome = client->PutObject(request);
if (outcome.IsSuccess())
{
    return 0;
}
else
{
    auto error = outcome.GetError();
    log_error("upload_object: bucket=%s key=%s error_message=%s", bucket, key, error.GetMessage().c_str());
    return static_cast<int>(error.GetErrorType());
}

@lzw06061139
Copy link
Author

oh sorry! it's my fault. the tranferconfig::buffersize was set to 0 incorrectly

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant