aws / aws-sdk-cpp

AWS SDK for C++
Apache License 2.0
1.97k stars 1.06k forks source link

s3-crt: Crash when calling PutObjectAsync without context #3171

Open kledom opened 1 day ago

kledom commented 1 day ago

Describe the bug

We are encountering a segmentation fault when calling the PutObjectAsync method in the s3-crt client. The issue specifically occurs when the Aws::Client::AsyncCallerContext parameter is not provided.

This issue did not occur with previous versions of the AWS SDK, suggesting a possible regression. Based on the timing, the problem may be linked to changes introduced in https://github.com/aws/aws-sdk-cpp/issues/3138.

Regression Issue

Expected Behavior

The program should execute without crashing, even when PutObjectAsync is called without an AsyncCallerContext.

Current Behavior

The program crashes with a segmentation fault.

(gdb) 
#0  0x000055c273be98db in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data (this=<optimized out>)
    at <redacted>/sysroots/skylake-server-64-vigem-linux/usr/include/c++/13.3.0/bits/basic_string.h:223
#1  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local (this=<optimized out>)
    at <redacted>/sysroots/skylake-server-64-vigem-linux/usr/include/c++/13.3.0/bits/basic_string.h:264
#2  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::capacity (this=<optimized out>)
    at <redacted>/sysroots/skylake-server-64-vigem-linux/usr/include/c++/13.3.0/bits/basic_string.h:1171
#3  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign (this=0x28, __str="S3CrtClient")
    at <redacted>/sysroots/skylake-server-64-vigem-linux/usr/include/c++/13.3.0/bits/basic_string.tcc:283
#4  0x00007f80266c8acc in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign (__str=..., this=<optimized out>)
    at /usr/src/debug/aws-sdk-cpp/1.11.432/src/aws-cpp-sdk-core/include/aws/core/client/AsyncCallerContext.h:35
#5  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator= (__str=..., this=<optimized out>) at /usr/include/c++/13.3.0/bits/basic_string.h:814
#6  Aws::Client::MonitorContext::StartMonitorContext (this=0x28, client="S3CrtClient", request="PutObject", 
    httpRequest=std::shared_ptr<Aws::Http::HttpRequest> (use count 2, weak count 0) = {...})
    at /usr/src/debug/aws-sdk-cpp/1.11.432/src/aws-cpp-sdk-core/include/aws/core/client/AsyncCallerContext.h:35
#7  0x00007f802669a28c in Aws::S3Crt::S3CrtClient::PutObjectAsync(Aws::S3Crt::Model::PutObjectRequest const&, std::function<void (Aws::S3Crt::S3CrtClient const*, Aws::S3Crt::Model::PutObjectRequest const&, Aws::Utils::Outcome<Aws::S3Crt::Model::PutObjectResult, Aws::S3Crt::S3CrtError> const&, std::shared_ptr<Aws::Client::AsyncCallerContext const> const&)> const&, std::shared_ptr<Aws::Client::AsyncCallerContext const> const&) const (this=0x7f801011ea20, request=..., handler=..., 
    handlerContext=std::shared_ptr<const Aws::Client::AsyncCallerContext> (use count 2, weak count 0) = {...})
    at /usr/src/debug/aws-sdk-cpp/1.11.432/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp:1107

Reproduction Steps

N/A

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.11.432

Compiler and Version used

(GCC) 13.3.0

Operating System and version

Linux / Yocto Scarthgap

sbera87 commented 14 hours ago

Could you please paste your code snippet so that we can troubleshoot your specific case?