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

aws_fatal_assert (cond_str=0x7ffff79449be "allocator != ((void *)0)" #2499

Closed
aphage opened this issue May 22, 2023 · 3 comments
Closed

aws_fatal_assert (cond_str=0x7ffff79449be "allocator != ((void *)0)" #2499

aphage opened this issue May 22, 2023 · 3 comments
Assignees
Labels
bug This issue is a bug. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@aphage
Copy link

aphage commented May 22, 2023

Describe the bug

Thread 1 "aws-sdk-test" received signal SIGTRAP, Trace/breakpoint trap.
__pthread_kill_implementation (no_tid=0, signo=5, threadid=140737329288256) at ./nptl/pthread_kill.c:44
44      ./nptl/pthread_kill.c: No such file or directory.
(gdb) where
#0  __pthread_kill_implementation (no_tid=0, signo=5, threadid=140737329288256)
    at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=5, threadid=140737329288256) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737329288256, signo=signo@entry=5) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6a42476 in __GI_raise (sig=5) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7892464 in aws_debug_break ()
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/posix/system_info.c:164
#5  0x00007ffff787c18c in aws_fatal_assert (cond_str=0x7ffff79449be "allocator != ((void *)0)", 
    file=0x7ffff7944950 "../crt/aws-crt-cpp/crt/aws-c-common/source/allocator.c", line=209)
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/assert.c:14
#6  0x00007ffff787aa0a in aws_mem_release (allocator=0x0, ptr=0x555555723950)
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/allocator.c:209
--Type <RET> for more, q to quit, c to continue without paging--
#7  0x00007ffff788dc16 in s_aws_cJSON_free (ptr=0x555555723950)
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/json.c:361
#8  0x00007ffff789fb0d in cJSON_Delete (item=0x5555556a4220)
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/external/cJSON.c:259
#9  0x00007ffff789fadc in cJSON_Delete (item=0x5555556a4730)
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/external/cJSON.c:255
#10 0x00007ffff788dcf4 in aws_json_value_destroy (value=0x5555556a4730)
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/json.c:388
#11 0x00007ffff7871133 in s_endpoints_ruleset_destroy (data=0x5555556f1ae0)
    at ../crt/aws-crt-cpp/crt/aws-c-sdkutils/source/endpoints_ruleset.c:917
#12 0x00007ffff78947ff in aws_ref_count_release (ref_count=0x5555556f1ae8)
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/ref_count.c:29
--Type <RET> for more, q to quit, c to continue without paging--
#13 0x00007ffff78712e6 in aws_endpoints_ruleset_release (ruleset=0x5555556f1ae0)
    at ../crt/aws-crt-cpp/crt/aws-c-sdkutils/source/endpoints_ruleset.c:955
#14 0x00007ffff786c1bb in s_endpoints_rule_engine_destroy (data=0x55555585aa80)
    at ../crt/aws-crt-cpp/crt/aws-c-sdkutils/source/endpoints_rule_engine.c:873
#15 0x00007ffff78947ff in aws_ref_count_release (ref_count=0x55555585aa88)
    at ../crt/aws-crt-cpp/crt/aws-c-common/source/ref_count.c:29
#16 0x00007ffff786c33a in aws_endpoints_rule_engine_release (rule_engine=0x55555585aa80)
    at ../crt/aws-crt-cpp/crt/aws-c-sdkutils/source/endpoints_rule_engine.c:908
#17 0x00007ffff76534ff in Aws::Crt::Endpoints::RuleEngine::~RuleEngine (this=0x555555721dc8, 
    __in_chrg=<optimized out>) at ../crt/aws-crt-cpp/source/endpoints/RuleEngine.cpp:156
#18 0x0000555555563ca2 in Aws::Endpoint::DefaultEndpointProvider<Aws::S3::S3ClientConfiguration, Aws::S3::Endpoint::S3BuiltInParameters, Aws::S3::Endpoint::S3ClientContextParameters>::~DefaultEndpointProvid--Type <RET> for more, q to quit, c to continue without paging--
er (this=0x555555721dc0, __in_chrg=<optimized out>)
    at ../aws-release/include/aws/core/endpoint/DefaultEndpointProvider.h:63
#19 0x0000555555563ed4 in Aws::S3::Endpoint::S3EndpointProvider::~S3EndpointProvider (
    this=0x555555721dc0, __in_chrg=<optimized out>)
    at ../aws-release/include/aws/s3/S3EndpointProvider.h:110
#20 0x00005555555670a9 in __gnu_cxx::new_allocator<Aws::S3::Endpoint::S3EndpointProvider>::destroy<Aws::S3::Endpoint::S3EndpointProvider> (this=0x555555721dc0, __p=0x555555721dc0)
    at /usr/include/c++/11/ext/new_allocator.h:168
#21 0x0000555555566ffb in std::allocator_traits<std::allocator<Aws::S3::Endpoint::S3EndpointProvider> >::destroy<Aws::S3::Endpoint::S3EndpointProvider> (__a=..., __p=0x555555721dc0)
    at /usr/include/c++/11/bits/alloc_traits.h:535
#22 0x0000555555566e4f in std::_Sp_counted_ptr_inplace<Aws::S3::Endpoint::S3EndpointProvider, std::allo--Type <RET> for more, q to quit, c to continue without paging--
cator<Aws::S3::Endpoint::S3EndpointProvider>, (__gnu_cxx::_Lock_policy)2>::_M_dispose (
    this=0x555555721db0) at /usr/include/c++/11/bits/shared_ptr_base.h:528
#23 0x00005555555654df in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (
    this=0x555555721db0) at /usr/include/c++/11/bits/shared_ptr_base.h:168
#24 0x0000555555564789 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (
    this=0x7fffffffd5e0, __in_chrg=<optimized out>) at /usr/include/c++/11/bits/shared_ptr_base.h:705
#25 0x0000555555564688 in std::__shared_ptr<Aws::Endpoint::EndpointProviderBase<Aws::S3::S3ClientConfiguration, Aws::S3::Endpoint::S3BuiltInParameters, Aws::S3::Endpoint::S3ClientContextParameters>, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7fffffffd5d8, __in_chrg=<optimized out>)
    at /usr/include/c++/11/bits/shared_ptr_base.h:1154
#26 0x00005555555646a8 in std::shared_ptr<Aws::Endpoint::EndpointProviderBase<Aws::S3::S3ClientConfiguration, Aws::S3::Endpoint::S3BuiltInParameters, Aws::S3::Endpoint::S3ClientContextParameters> >::~shared--Type <RET> for more, q to quit, c to continue without paging--
_ptr (this=0x7fffffffd5d8, __in_chrg=<optimized out>) at /usr/include/c++/11/bits/shared_ptr.h:122
#27 0x00007ffff7d89158 in Aws::S3::S3Client::~S3Client (this=0x7fffffffd200, 
    __in_chrg=<optimized out>)
    at /home/foo/foo/aws-sdk-cpp/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp:248
#28 0x0000555555562d39 in main (argc=1, argv=0x7fffffffd718) at ../main.cc:55

Expected Behavior

don't crash

Current Behavior

program has crashed

Reproduction Steps

#include <iostream>

#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/Bucket.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/core/auth/AWSCredentialsProviderChain.h>
#include <aws/core/utils/Outcome.h>

bool ListBuckets(const Aws::S3::S3Client &client) {
    auto outcome = client.ListBuckets();

    bool result = true;
    if (!outcome.IsSuccess()) {
        std::cerr << "Failed with error: " << outcome.GetError() << std::endl;
        result = false;
    }
    else {
        std::cout << "Found " << outcome.GetResult().GetBuckets().size() << " buckets\n";
        for (auto &&b: outcome.GetResult().GetBuckets()) {
            std::cout << b.GetName() << std::endl;
        }
    }

    return result;
}


int main(int argc, char** argv)
{
    Aws::SDKOptions options;

    options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
    Aws::InitAPI(options);

    const char* access_key_id = "";
    const char* secret_access_key = "";
    Aws::Auth::AWSCredentials credentials(access_key_id, secret_access_key);
    
    Aws::Client::ClientConfiguration clientConfig;
    clientConfig.verifySSL = false;
    clientConfig.endpointOverride = "";
    
    Aws::S3::S3Client client(credentials,
        Aws::MakeShared<Aws::S3::S3EndpointProvider>("AWS_SDK_TEST"),
        clientConfig);

    ListBuckets(client);

    Aws::ShutdownAPI(options);

    return 0;
}

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.11.82

Compiler and Version used

gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0

Operating System and version

Ubuntu 22.04.2 LTS

@aphage aphage added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 22, 2023
@aphage aphage changed the title (short issue description) aws_fatal_assert (cond_str=0x7ffff79449be "allocator != ((void *)0)" May 22, 2023
@yasminetalby
Copy link
Contributor

Hello @aphage ,

Thank you very much for your submission.

Based on the error message you are receiving and your code sample, my first guess is that you are not following the basic use guidelines for Initializing and Shutting Down the SDK.

Per the AWS CPP SDK Developer guide Basic use documentation:

Best practice requires all AWS SDK for C++ calls performed between Aws::InitAPI and Aws::ShutdownAPI either to be contained within a pair of curly braces or be invoked by functions called between the two methods.
A basic skeleton application is shown below:

#include <aws/core/Aws.h>
int main(int argc, char** argv)
{
   Aws::SDKOptions options;
   Aws::InitAPI(options);
   {
      // make your SDK calls here.
   }
   Aws::ShutdownAPI(options);
   return 0;
}

I have attempted to reproduce the issue using your code sample and was able to get the same behavior.
Making the following modification to your code sample allowed me to solve the problem:

int main(int argc, char** argv)
{
    Aws::SDKOptions options;

    options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
    Aws::InitAPI(options);
    {
        const char *access_key_id = "";
        const char *secret_access_key = "";
        Aws::Auth::AWSCredentials credentials(access_key_id, secret_access_key);

        Aws::Client::ClientConfiguration clientConfig;
        clientConfig.verifySSL = false;
        clientConfig.endpointOverride = "";

        Aws::S3::S3Client client(credentials,
                                 Aws::MakeShared<Aws::S3::S3EndpointProvider>("AWS_SDK_TEST"),
                                 clientConfig);

        ListBuckets(client);
    }
    Aws::ShutdownAPI(options);

    return 0;
}

Let me know if this works for you or if this issue submission requires further investigation.

Thank you very much for your time and collaboration.

Sincerely,

Yasmine

@yasminetalby yasminetalby self-assigned this May 22, 2023
@yasminetalby yasminetalby added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. and removed needs-triage This issue or PR still needs to be triaged. labels May 22, 2023
@aphage
Copy link
Author

aphage commented May 23, 2023

Thank you, I got it.

@aphage aphage closed this as completed May 23, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Projects
None yet
Development

No branches or pull requests

2 participants