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

Long loading time when initializing Aws::Auth::AWSCredentials #3004

Closed
JeffreyChee opened this issue Jun 16, 2024 · 7 comments
Closed

Long loading time when initializing Aws::Auth::AWSCredentials #3004

JeffreyChee opened this issue Jun 16, 2024 · 7 comments
Labels
bug This issue is a bug. p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@JeffreyChee
Copy link

JeffreyChee commented Jun 16, 2024

Describe the bug

    TRACE("CAWSManager::InitFunctions 1\n");
    ASSERT(NULL == m_pcClientPtr);
    m_pcClientPtr = new std::shared_ptr<Aws::Lambda::LambdaClient>;
    if (NULL == m_pcClientPtr) {
        ASSERT(FALSE);
        return FALSE;
    }
    TRACE("CAWSManager::InitFunctions 2\n");
    Aws::Client::ClientConfiguration config;
    config.region = "us-east-1";
    config.disableIMDS = true;
    // this credential only have access lamba function and s3 read/write to a certain bucket
    Aws::Auth::AWSCredentials credentials("my accessKeyId", "my secretKey");
    TRACE("CAWSManager::InitFunctions 3\n");
    *m_pcClientPtr = Aws::MakeShared<Aws::Lambda::LambdaClient>(ALLOCATION_TAG, credentials, config);
    if (NULL == *m_pcClientPtr) {
        ASSERT(FALSE);
        return FALSE;
    }
    TRACE("CAWSManager::InitFunctions 4\n");

Expected Behavior

I Expected no or minimal delays between printing the log
CAWSManager::InitFunctions 1
CAWSManager::InitFunctions 2
CAWSManager::InitFunctions 3
CAWSManager::InitFunctions 4

but in between "CAWSManager::InitFunctions 2" and "CAWSManager::InitFunctions 3"
it takes around 5 seconds to finish constructing the Aws::Auth::AWSCredentials

may I know how should I eliminate this problem?
I saw a similar problem in the past where adding disableIMDS = true solves it, but this time it doesn't

Current Behavior

but in between "CAWSManager::InitFunctions 2" and "CAWSManager::InitFunctions 3"
it takes around 5 seconds to finish constructing the Aws::Auth::AWSCredentials

may I know how should I eliminate this problem?
I saw a similar problem in the past where adding disableIMDS = true solves it, but this time it doesn't

Reproduction Steps

    TRACE("CAWSManager::InitFunctions 1\n");
    ASSERT(NULL == m_pcClientPtr);
    m_pcClientPtr = new std::shared_ptr<Aws::Lambda::LambdaClient>;
    if (NULL == m_pcClientPtr) {
        ASSERT(FALSE);
        return FALSE;
    }
    TRACE("CAWSManager::InitFunctions 2\n");
    Aws::Client::ClientConfiguration config;
    config.region = "us-east-1";
    config.disableIMDS = true;
    // this credential only have access lamba function and s3 read/write to a certain bucket
    Aws::Auth::AWSCredentials credentials("my accessKeyId", "my secretKey");
    TRACE("CAWSManager::InitFunctions 3\n");
    *m_pcClientPtr = Aws::MakeShared<Aws::Lambda::LambdaClient>(ALLOCATION_TAG, credentials, config);
    if (NULL == *m_pcClientPtr) {
        ASSERT(FALSE);
        return FALSE;
    }
    TRACE("CAWSManager::InitFunctions 4\n");

Possible Solution

im looking for the solution...

Additional Information/Context

No response

AWS CPP SDK version used

1.11.330 from homebrew

Compiler and Version used

Apple clang in Xcode latest

Operating System and version

macOS 14.5 (23F79)

@JeffreyChee JeffreyChee added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 16, 2024
@JeffreyChee JeffreyChee changed the title (short issue description) Long loading time when initializing Aws::Auth::AWSCredentials Jun 16, 2024
@jmklix
Copy link
Member

jmklix commented Jun 17, 2024

I can't seem to reproduce the same loading time that you're seeing. I modified your sample slightly to get it to run by itself, but I'm only seeing 1 millisecond elapse:

[TRACE] 2024-06-17 23:16:08.811 main [140681837720320] CAWSManager::InitFunctions 1
[TRACE] 2024-06-17 23:16:08.811 main [140681837720320] CAWSManager::InitFunctions 2
[DEBUG] 2024-06-17 23:16:08.811 ClientConfiguration [140681837720320] Request Compression enabled
[DEBUG] 2024-06-17 23:16:08.811 ClientConfiguration [140681837720320] ClientConfiguration will use MinReqCompression: 10240
[DEBUG] 2024-06-17 23:16:08.811 ClientConfiguration [140681837720320] ClientConfiguration will use SDK Auto Resolved profile: [default] if not specified by users.
[INFO] 2024-06-17 23:16:08.811 ClientConfiguration [140681837720320] Retry Strategy will use the default max attempts.
[TRACE] 2024-06-17 23:16:08.811 main [140681837720320] CAWSManager::InitFunctions 3
[INFO] 2024-06-17 23:16:08.812 CurlHandleContainer [140681837720320] Initializing CurlHandleContainer with size 25
[TRACE] 2024-06-17 23:16:08.812 main [140681837720320] CAWSManager::InitFunctions 4

Can you provide more details on reproducing this. (a docker container would be great). It it possible something else in your test is causing this to take 5 seconds? Something in your environment?

@jmklix jmklix added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jun 17, 2024
@JeffreyChee
Copy link
Author

Hi, im really new to the aws cpp sdk. I just download it from homebrew, put the lib and headers in my project and run it.
I did not configure any aws client on my computer at all.

@jmklix
Copy link
Member

jmklix commented Jun 19, 2024

Can you try building this sdk from source and see if you can document your reproduction steps. Here are the steps for how to do this. Please let me know if you have any problems/questions while trying to do this.

@jmklix jmklix added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. labels Jun 19, 2024
@JeffreyChee
Copy link
Author

JeffreyChee commented Jun 19, 2024

I've tried to compile the sdk myself. but I keep getting runtime missing dylib errors. the homebrew version only needs a few dylibs, but when I build the sdk myself. it seem to ask for a lot of other dylibs.
I'll stick to using the homebrew version for my Mac build (for testing only) and using the mobile sdks for android and iOS.
Was thinking it should be best to use the cpp library for all platforms...

@JeffreyChee
Copy link
Author

if only someone could provide a cpp binary package that works on all platform with instructions on which libraries are meant for which.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@jmklix
Copy link
Member

jmklix commented Jun 20, 2024

I sorry that you were unable to build this sdk without running into missing dylibs. We provide many different configuration options when building this sdk and there are many difference platforms that this sdk can be build for. So for those reasons and many others we don't provide a binary package. If you share the errors that you are currently running into I can try to help you build this sdk.

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. p3 This is a minor priority issue 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