简体   繁体   English

在使用 AWS-SDK 抛出 'std::bad_alloc' Linux 实例后调用终止

[英]terminate called after throwing an instance of 'std::bad_alloc' Linux with AWS-SDK

I am using aws sdk for linux to transfer file to s3.我正在使用 aws sdk for linux 将文件传输到 s3。 I have compiled the shared library of aws sdk. Transfer of file fails with bad alloc error so thought to explore the example given by aws-sdk.我已经编译了 aws sdk 的共享库。文件传输失败并出现错误的分配错误,因此考虑探索 aws-sdk 给出的示例。 I am trying to run the example to list the bucket on s3 link .我正在尝试运行示例以列出 s3 链接上的存储桶。 Compiling the application using command:使用命令编译应用程序:

g++ testingAws.cpp  -I . -L  . -laws-cpp-sdk-transfer -laws-cpp-sdk-core -laws-cpp-sdk-s3

Everytime the executables terminates with message:每次可执行文件以消息终止时:

terminate called after throwing an instance of 'std::bad_alloc'
what():  std::bad_alloc

Bad alloc happens when it invokes the function: AwsDoc::S3::PutObject(bucket_name, object_name, clientConfig);当它调用 function 时发生错误分配: AwsDoc::S3::PutObject(bucket_name, object_name, clientConfig); Any suggestion if I am missing something.如果我遗漏了什么任何建议。 As well how to debug bad alloc issue.以及如何调试错误的分配问题。

I tried to list the bucket on my s3 server.我试图列出我的 s3 服务器上的存储桶。 Backtrace:回溯:

Backtrace: terminate called after throwing an instance of 'std::bad_alloc' what():
  std::bad_alloc Thread 1 "a.out" received signal SIGABRT, Aborted.
  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737314626112) at ./nptl/pthread_kill.c:44 44
  ./nptl/pthread_kill.c: No such file or directory.
  (gdb) bt 
  #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737314626112) at ./nptl/pthread_kill.c:44
  #1  __pthread_kill_internal (signo=6, threadid=140737314626112) at ./nptl/pthread_kill.c:78
  #2  __GI___pthread_kill (threadid=140737314626112, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
  #3  0x00007ffff6b2d476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
  #4  0x00007ffff6b137f3 in __GI_abort () at ./stdlib/abort.c:79
  #5  0x00007ffff6dd5bbe in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #6  0x00007ffff6de124c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #7  0x00007ffff6de12b7 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff6de1518 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #9  0x00007ffff6dd57cc in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #10 0x00007ffff6e7ee6f in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #11 0x00007ffff6e7f22d in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #12 0x000055555555b58d in Aws::S3::Model::PutObjectRequest::SetBucket(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
  #13 0x000055555555a78b in AwsDoc::S3::PutObject(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Aws::Client::ClientConfiguration const&) ()
  #14 0x0000000000000000 in ?? () 
  (gdb

It's been resolved.已经解决了。 I was using header files that were from windows. There was no compilation error so thought everything should work as expectation but later I have taken header files from the Linux machine and that has resolved it.我使用的是来自 windows 的 header 文件。没有编译错误所以认为一切都应该按预期工作但后来我从 Linux 机器上获取了 header 文件并且已经解决了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Memory 分配错误调用 XGBoost C function XGBoosterUpdateOneIter 失败:std::bad_alloc - Memory allocation error Call to XGBoost C function XGBoosterUpdateOneIter failed: std::bad_alloc NodeJs AWS-SDK s3.upload 上传 function 没有按预期抛出错误 - NodeJs AWS-SDK s3.upload upload function not throwing error as expected aws-sdk 与@aws-sdk 之间的区别 - Difference between aws-sdk vs @aws-sdk 如何在 NextJS 中设置 AWS-SDK 凭证 - How to setup AWS-SDK credentials in NextJS 使用玩笑模拟 aws-sdk S3#putObject 实例方法 - Mocking aws-sdk S3#putObject instance method using jest Rails 错误 - 无法加载此类文件 -- aws-sdk(您可能需要安装 aws-sdk gem) - Rails Error - cannot load such file -- aws-sdk (You may need to install the aws-sdk gem) AWS-SDK for JavaScript,获取SecretValue - AWS-SDK for JavaScript, Getting SecretValue 使用“@aws-sdk/client-sqs”和“aws-sdk/clients/sqs”有什么区别 - Whats is the difference between using '@aws-sdk/client-sqs' and 'aws-sdk/clients/sqs' @aws-sdk/client-ses 和@aws-sdk/client-sesv2 有什么区别? - What is the difference between @aws-sdk/client-ses and @aws-sdk/client-sesv2? Jest - 如何模拟 aws-sdk sqs.receiveMessage 方法 - Jest - How to mock aws-sdk sqs.receiveMessage methode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM