aws-sdk-cpp icon indicating copy to clipboard operation
aws-sdk-cpp copied to clipboard

Segmentation fault in S3CrtClient::init()

Open MarcusHellqvist opened this issue 3 years ago • 3 comments
trafficstars

Describe the bug

Credential provider may not be initialized resulting in a segmentation fault here:

https://github.com/aws/aws-sdk-cpp/blob/4db1ff69fa185c7910394f4a6462cbea278a1707/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp#L223

Expected behavior

Log an error and abort initialization.

Current behavior

Segmentation fault

Steps to Reproduce

Set credential provider to environment but don't setup access key via environment variable.

access_key_id_cursor.len will then be 0 here https://github.com/awslabs/aws-c-auth/blob/f29ffca89dc0b6a1d722ae9bacb230ec9dc765f4/source/credentials.c#L67

resulting in that no credential provider is initialized

Possible Solution

No response

AWS CPP SDK version used

1.9

Compiler and Version used

clang --10

Operating System and version

Ubuntu

MarcusHellqvist avatar Jan 13 '22 16:01 MarcusHellqvist

Hi @MarcusHellqvist , Yea I am able to reproduce this too, thanks for bringing this up, we'll take a look.

KaibaLopez avatar Jan 19 '22 23:01 KaibaLopez

I've encountered a similar problem and my workaround is to forcibly exclude EnvironmentAWSCredentialsProvider that is normally part of the DefaultAWSCredentialsProviderChain chain. In our case, this change doesn't break any of our existing deployments.

mikemccarty-vertex avatar Jan 21 '22 15:01 mikemccarty-vertex

I run into this right now.

unknown location(0): fatal error: in "memory_access_violation_test": memory access violation at address: 0x00000000: no mapping at fault address
test_s3client.cc(136): last checkpoint: "memory_access_violation_test" test entry
BOOST_AUTO_TEST_CASE(memory_access_violation_test)
{
    auto executor = Aws::MakeShared<Aws::Utils::Threading::PooledThreadExecutor>("s3-executor", 10);

    Aws::S3Crt::ClientConfiguration configClient;
    configClient.endpointOverride = "http://127.0.0.1:9888";
    configClient.executor = executor;
    configClient.enableHostPrefixInjection = false;
    configClient.scheme = Aws::Http::Scheme::HTTP;

    Aws::S3Crt::S3CrtClient client{
        Aws::Auth::AWSCredentials{"", ""},
        configClient,
        Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never,
        false /* useVirtualAddressing */,
        Aws::S3Crt::US_EAST_1_REGIONAL_ENDPOINT_OPTION::NOT_SET};

    (void)client;
}

fboranek avatar Apr 28 '22 16:04 fboranek

Should be resolved now, re-open if you have a case where it does not.

sbiscigl avatar Sep 01 '22 20:09 sbiscigl

⚠️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.

github-actions[bot] avatar Sep 01 '22 20:09 github-actions[bot]