I’m having an issue after updating: Upload an object to an Amazon S3 bucket using an AWS SDK:(https://docs.aws.amazon.com/AmazonS3/latest/userguide/example_s3_PutObject_section.html)
int main(int, char **)
{
Aws::SDKOptions options;
classB::initAwsApi(options);
while (true)
{
//...
if (threadApi.joinable())
threadApi.join();
threadApi = std::thread(request, &connection, &headers);
std::this_thread::sleep_for(std::chrono::seconds(5));
// if I close the stream, the error doesn't appear. But I would like to close the stream
stream_.release();
}
if (threadApi.joinable())
threadApi.join();
// when closing the SDK, the error appears
classB::shutdownAwsApi(options);
}
output:
Fatal error condition occurred in /home/x/x/deps/aws-sdk-cpp/crt/aws-crt-cpp/crt/aws-c-common/source/allocator.c:209: allocator != ((void *)0)
Exiting Application
No call stack information available
Aborted(core dumped)
2
Answers
the error was in the new version of aws. I lowered the version and compiled it again and it worked
I don’t know much about this issue but I got the same error in a slightly different context. In my case it appeared in
__libc_start_main
(this is the function that callsmain
.)My problem was caused by a global variable that was cleaned up in
__libc_start_main
which occurred after theAws::ShutdownAPI
call:The problem only became visible after updating the AWS library. I suspect that
Aws::S3::S3Client
did not contain anything that was allocated before and a recent release changed that.