Skip to content

Init/Shutdown sequence cannot be done twice #3128

Closed
@rohansuri

Description

@rohansuri

Describe the bug

Hello,

It seems even after ref counting of Init/Shutdown has been added in #2411, doing a sequence of Init/Shutdown twice, fails.

In pseudocode:

Init
Do S3Get
Shutdown

Init
Do S3Get  // Fails with curlCode: 35, SSL connect error
Shutdown

Expected Behavior

It seems the SDK requires us to ensure, once Shutdown is called, we can never Init again?

Current Behavior

The outcome of S3 GET API is: curlCode: 35, SSL connect error

Reproduction Steps

Here's a GTest:

TEST_F(S3Test, awsdk){    
    Aws::SDKOptions options;
    Aws::InitAPI(options);
    Aws::S3::S3ClientConfiguration config;
    auto client = std::make_unique<Aws::S3::S3Client>(config);

    // GET
    auto get = [&](){
        Aws::S3::Model::GetObjectRequest request;
        request.SetBucket("my-bucket");
        request.SetKey("my-key");

        auto outcome = client->GetObject(request);
        if(!outcome.IsSuccess()){
            std::cout << "GET FAILED " << outcome.GetError().GetMessage() << std::endl;
        }
    };

    get(); // THIS SUCCEEDS
    client.reset();
    Aws::ShutdownAPI(options);

    Aws::InitAPI(options);
    client = std::make_unique<Aws::S3::S3Client>(config);
    get(); // THIS FAILS
    client.reset();
    Aws::ShutdownAPI(options);
}

The relevant output is:
GET FAILED curlCode: 35, SSL connect error

The entire output is:

./fusion_gtest --gtest_filter="*S3Test*sdk*"
Note: Google Test filter = *S3Test*sdk*
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from S3Test
[ RUN      ] S3Test.awsdk
GET FAILED curlCode: 35, SSL connect error
[       OK ] S3Test.awsdk (30331 ms)
[----------] 1 test from S3Test (30331 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (30331 ms total)
[  PASSED  ] 1 test.

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.11.411

Compiler and Version used

Apple clang version 15.0.0 (clang-1500.3.9.4)

Operating System and version

MacOS 14.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions