aws / aws-sdk-cpp

AWS SDK for C++
Apache License 2.0
1.95k stars 1.05k forks source link

Initializing Client Configuration does not work #1722

Closed HavenRemix closed 3 years ago

HavenRemix commented 3 years ago

Confirm by changing [ ] to [x] below:

Platform/OS/Hardware/Device What are you running the sdk on?

Windows

Describe the question

In visual studio I have the following

Aws::Utils::Logging::LogLevel logLevel{ Aws::Utils::Logging::LogLevel::Error };
options.loggingOptions.logger_create_fn = [logLevel] {return make_shared<Aws::Utils::Logging::ConsoleLogSystem>(logLevel); };

Aws::InitAPI(options);

Aws::Client::ClientConfiguration clientConfiguration;

clientConfiguration.region = REGION;    // region must be set for Amazon Cognito operations
s_AmazonCognitoClient = Aws::MakeShared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>("CognitoIdentityProviderClient", clientConfiguration);

Region and options are both defined in the .h file

/**Options to create and remove the sdk*/
Aws::SDKOptions options;

When Aws::Client::ClientConfiguration clientConfiguration; is run, in the debugger I get the following The thread 0x2d14 has exited with code 0 (0x0). and a bit later Run-Time Check Failure #2 - Stack around the variable 'clientConfiguration' was corrupted.. I also can't find runtime check failure 1

I also have libcurl as a shared library added but it was neither included nor initialized when testing this. Also removing the .lib from the additional libraries did not love this issue.

Logs/output If applicable, add logs or error output.

To enable logging, set the following system properties:

REMEMBER TO SANITIZE YOUR PERSONAL INFO

options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
Aws::InitAPI(options)
HavenRemix commented 3 years ago

I have also got this:

Exception thrown: read access violation.
**pointerToAmount** was 0xFFFFFFFFFFFFFFFF.

this is in AWSMemory.h line 213

KaibaLopez commented 3 years ago

Hi @HavenRemix , So I'm going to need more info to be able to reproduce this issue:

HavenRemix commented 3 years ago

I am using Visual Studio 2019, cmake 3.18.4, and the latest version of the sdk. The one in the master branch.

I built the sdk using cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="cognito-idp"

I then installed it to program files x86/aws sdk all.

To link to my project, I added the path to the additional libraries directory and includes directory and included the specific libraries I needed in the Addition dependencies. I also copied over all the required dlls.

The code sample:

#include <iostream>

#include <aws/core/Aws.h>
#include <aws/core/Region.h>

#include <aws/core/utils/logging/ConsoleLogSystem.h>
#include <aws/core/utils/logging/AWSLogging.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/cognito-idp/CognitoIdentityProviderClient.h>

using namespace std;

static std::shared_ptr<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient> s_AmazonCognitoClient;

int main()
{
    Aws::Utils::Logging::LogLevel logLevel{ Aws::Utils::Logging::LogLevel::Error };
        Aws::SDKOptions options;
    options.loggingOptions.logger_create_fn = [logLevel] {return make_shared<Aws::Utils::Logging::ConsoleLogSystem>(logLevel); };

    Aws::InitAPI(options);
    {
        Aws::Client::ClientConfiguration clientConfiguration;

        clientConfiguration.region = REGION;    // region must be set for Amazon Cognito operations
        s_AmazonCognitoClient = Aws::MakeShared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>("CognitoIdentityProviderClient", clientConfiguration);
    }

        Aws::ShutdownAPI(options);

    return 0;
}

this is enough to cause that error

KaibaLopez commented 3 years ago

@HavenRemix , I just ran your sample code and I'm not seeing the error at all, for me it just runs.

The only thing that comes to mind in the sample which might be causing this error is that you are defining the credential provider as a static variable before initializing the API. I don't know why you see the error on your code while I don't but this is not expected usage. To initialize the credentials provider the InitAPI call must happen first. Could you try that and see if that helps?

HavenRemix commented 3 years ago

Hi, I tried moving it to after I initialized the API but got the same error.

I ended up deleting the sdk folder and reinstalling it and it works now.

I'm not sure if it was a corruption issue or what happened.

But thank you so much for your time and for trying to help!

github-actions[bot] commented 3 years ago

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

HavenRemix commented 3 years ago

Ok, so this problem came back. I tried logging with trace and I got this.

[INFO] 2021-08-18 06:39:09.310 Aws_Init_Cleanup [10912] Initiate AWS SDK for C++ with Version:1.9.56
[TRACE] 2021-08-18 06:39:09.310 FileSystem [10912] Checking USERPROFILE for the home directory.
[DEBUG] 2021-08-18 06:39:09.310 FileSystem [10912] Environment value for variable USERPROFILE is C:\Users\Haven_Remix
[INFO] 2021-08-18 06:39:09.310 Aws::Config::AWSConfigFileProfileConfigLoader [10912] Initializing config loader against fileName C:\Users\Haven_Remix\.aws\credentials and using profilePrefix = 0
[TRACE] 2021-08-18 06:39:09.310 FileSystem [10912] Checking USERPROFILE for the home directory.
[DEBUG] 2021-08-18 06:39:09.310 FileSystem [10912] Environment value for variable USERPROFILE is C:\Users\Haven_Remix
[INFO] 2021-08-18 06:39:09.310 Aws::Config::AWSConfigFileProfileConfigLoader [10912] Initializing config loader against fileName C:\Users\Haven_Remix\.aws\config and using profilePrefix = 1
[TRACE] 2021-08-18 06:39:09.310 FileSystem [10912] Checking USERPROFILE for the home directory.
[DEBUG] 2021-08-18 06:39:09.311 FileSystem [10912] Environment value for variable USERPROFILE is C:\Users\Haven_Remix
[DEBUG] 2021-08-18 06:39:09.311 Aws::Config::ConfigFileProfileFSM [10912] found profile havenremix-auth-dev-serverless
[DEBUG] 2021-08-18 06:39:09.311 Aws::Config::ConfigFileProfileFSM [10912] found access key AKIAWOK43RKE37NJXGOR
[INFO] 2021-08-18 06:39:09.311 Aws::Config::AWSProfileConfigLoader [10912] Successfully reloaded configuration.
[TRACE] 2021-08-18 06:39:09.311 Aws::Config::AWSProfileConfigLoader [10912] reloaded config at 2021-08-18T06:39:09Z
[TRACE] 2021-08-18 06:39:09.311 FileSystem [10912] Checking USERPROFILE for the home directory.
[DEBUG] 2021-08-18 06:39:09.311 FileSystem [10912] Environment value for variable USERPROFILE is C:\Users\Haven_Remix
[INFO] 2021-08-18 06:39:09.311 Aws::Config::AWSConfigFileProfileConfigLoader [10912] Unable to open config file C:\Users\Haven_Remix\.aws\config for reading.
[INFO] 2021-08-18 06:39:09.311 Aws::Config::AWSProfileConfigLoader [10912] Failed to reload configuration.
[INFO] 2021-08-18 06:39:09.311 event-loop [10912] id=00000144E2937B10: Initializing IO Completion Port
[INFO] 2021-08-18 06:39:09.311 event-loop [10912] id=00000144E2937B10: Starting event-loop thread.
[INFO] 2021-08-18 06:39:09.312 thread [10912] id=00000144E29C94E8: cpu affinity of cpu_id i was specified, attempting to honor the value.
[DEBUG] 2021-08-18 06:39:09.312 thread [10912] id=00000144E29C94E8: computed mask llx on group hu.
[DEBUG] 2021-08-18 06:39:09.312 thread [10912] id=00000144E29C94E8: SetThreadGroupAffinity() result hhi.
[INFO] 2021-08-18 06:39:09.312 event-loop [4852] id=00000144E2937B10: main loop started
[DEBUG] 2021-08-18 06:39:09.312 thread [10912] id=00000144E29C94E8: SetThreadIdealProcessorEx() result hhi.
[INFO] 2021-08-18 06:39:09.312 event-loop [4852] id=00000144E2937B10: default timeout 100000
[INFO] 2021-08-18 06:39:09.312 event-loop [10912] id=00000144E29372A0: Initializing IO Completion Port
[TRACE] 2021-08-18 06:39:09.312 event-loop [4852] id=00000144E2937B10: waiting for a maximum of 100000 ms
[INFO] 2021-08-18 06:39:09.312 event-loop [10912] id=00000144E29372A0: Starting event-loop thread.
[INFO] 2021-08-18 06:39:09.312 thread [10912] id=00000144E29C7C78: cpu affinity of cpu_id i was specified, attempting to honor the value.
[DEBUG] 2021-08-18 06:39:09.312 thread [10912] id=00000144E29C7C78: computed mask llx on group hu.
[INFO] 2021-08-18 06:39:09.312 event-loop [18904] id=00000144E29372A0: main loop started
[DEBUG] 2021-08-18 06:39:09.312 thread [10912] id=00000144E29C7C78: SetThreadGroupAffinity() result hhi.
[INFO] 2021-08-18 06:39:09.312 event-loop [18904] id=00000144E29372A0: default timeout 100000
[DEBUG] 2021-08-18 06:39:09.312 thread [10912] id=00000144E29C7C78: SetThreadIdealProcessorEx() result hhi.
[TRACE] 2021-08-18 06:39:09.312 event-loop [18904] id=00000144E29372A0: waiting for a maximum of 100000 ms
[INFO] 2021-08-18 06:39:09.312 dns [10912] id=00000144E6F6DAB0: Initializing default host resolver with 8 max host entries.
[INFO] 2021-08-18 06:39:09.312 channel-bootstrap [10912] id=00000144E29B9680: Initializing client bootstrap with event-loop group 00000144E29B95E0
[DEBUG] 2021-08-18 06:39:09.313 ClientConfiguration [10912] ClientConfiguration will use SDK Auto Resolved profile: [default] if not specified by users.
[WARN] 2021-08-18 06:39:09.313 ClientConfiguration [10912] Retry Strategy will use the default max attempts.
[INFO] 2021-08-18 06:39:09.313 EC2MetadataClient [10912] Creating AWSHttpResourceClient with max connections 2 and scheme http
[INFO] 2021-08-18 06:39:09.313 WinHttpSyncHttpClient [10912] Creating http client with user agent  with max connections 2 request timeout 1000,and connect timeout 1000
[DEBUG] 2021-08-18 06:39:09.314 WinHttpHttp2 [10912] HTTP/2 enabled on WinHttp handle: 00000144E6F82690.
[DEBUG] 2021-08-18 06:39:09.321 WinHttpSyncHttpClient [10912] API handle 00000144E6F82690
[INFO] 2021-08-18 06:39:09.321 ConnectionPoolMgr [10912] Creating connection pool mgr with handle 00000144E6F82690, and max connections per host 2, request timeout 1000 ms, and connect timeout in 1000 ms, enabling TCP keep-alive.

The line which interests me is near the end [WARN] 2021-08-18 06:39:09.313 ClientConfiguration [10912] Retry Strategy will use the default max attempts.

Code to reproduce:

options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
/*Aws::Utils::Logging::LogLevel logLevel{ Aws::Utils::Logging::LogLevel::Trace };
options.loggingOptions.logger_create_fn = [logLevel] {return make_shared<Aws::Utils::Logging::ConsoleLogSystem>(logLevel); };*/

Aws::InitAPI(options);

Aws::Utils::Logging::InitializeAWSLogging(Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>("AwsLogTemp", Aws::Utils::Logging::LogLevel::Trace, "aws_sdk_"));
Aws::Utils::Logging::LogSystemInterface* LogSystem = Aws::Utils::Logging::GetLogSystem();
LogSystem->Log(Aws::Utils::Logging::LogLevel::Info, "TEST", "THIS IS A TEST");
{
    Aws::Client::ClientConfiguration clientConfiguration;

    clientConfiguration.region = REGION;    // region must be set for Amazon Cognito operations
    AmazonCognitoClient = Aws::MakeShared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>("CognitoIdentityProviderClient", clientConfiguration);
}

That is the exact code which I am using.

If I remove:

Aws::Client::ClientConfiguration clientConfiguration;

clientConfiguration.region = REGION;    // region must be set for Amazon Cognito operations
AmazonCognitoClient = Aws::MakeShared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>("CognitoIdentityProviderClient", clientConfiguration);

Then it works, but unfortunately, I need that for cognito.

Any idea what might be happening?

KaibaLopez commented 3 years ago

so the warning you mention is expected, it's just there as a way to let users know that it is a modifiable configuration (some times you might want to fail out quickly instead of retrying until the call succeeds or fails on a non-retry able error). To be clear though you still get the read access violation at some point when running the sample?

HavenRemix commented 3 years ago

Hey. Firstly, I just wanted to apologize for the slow responses I've been quite busy recently and I am trying to manage a lot of stuff.

And to answer your question I am still getting the read access violation.

Also, for more information in case I've just been an idiot in my implementation:

This is the code with the includes and everything

#include <iostream>

#define USE_IMPORT_EXPORT

#include <aws/core/Aws.h>
#include <aws/core/Region.h>

#include <aws/core/utils/logging/ConsoleLogSystem.h>
#include <aws/core/utils/logging/AWSLogging.h>
#include <aws/core/utils/logging/DefaultLogSystem.h>
#include <aws/core/utils/Outcome.h>
#include <aws/cognito-idp/model/AttributeType.h>
#include <aws/cognito-idp/model/SignUpRequest.h>
#include <aws/cognito-idp/model/SignUpResult.h>
#include <aws/cognito-idp/model/RevokeTokenRequest.h>
#include <aws/cognito-idp/model/RevokeTokenResult.h>
#include <aws/cognito-idp/model/ConfirmSignUpRequest.h>
#include <aws/cognito-idp/model/ConfirmSignUpResult.h>
#include <aws/cognito-idp/model/InitiateAuthRequest.h>
#include <aws/cognito-idp/model/InitiateAuthResult.h>
#include <aws/cognito-idp/model/ForgotPasswordRequest.h>
#include <aws/cognito-idp/model/ForgotPasswordResult.h>
#include <aws/cognito-idp/model/ConfirmForgotPasswordRequest.h>
#include <aws/cognito-idp/model/ConfirmForgotPasswordResult.h>
#include <aws/cognito-idp/model/ChangePasswordRequest.h>
#include <aws/cognito-idp/model/ChangePasswordResult.h>
#include <aws/cognito-idp/model/GetUserRequest.h>
#include <aws/cognito-idp/model/GetUserResult.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/cognito-idp/CognitoIdentityProviderClient.h>

#include "include/common.h"

#undef GetMessage

#include "accounthandler.h"

using namespace std;

static std::shared_ptr<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient> AmazonCognitoClient;

AccountHandler::AccountHandler()
{
    options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
    /*Aws::Utils::Logging::LogLevel logLevel{ Aws::Utils::Logging::LogLevel::Trace };
    options.loggingOptions.logger_create_fn = [logLevel] {return make_shared<Aws::Utils::Logging::ConsoleLogSystem>(logLevel); };*/

    Aws::InitAPI(options);

    Aws::Utils::Logging::InitializeAWSLogging(Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>("AwsLogTemp", Aws::Utils::Logging::LogLevel::Trace, "aws_sdk_"));
    Aws::Utils::Logging::LogSystemInterface* LogSystem = Aws::Utils::Logging::GetLogSystem();
    LogSystem->Log(Aws::Utils::Logging::LogLevel::Info, "TEST", "THIS IS A TEST");
    {
        Aws::Client::ClientConfiguration clientConfiguration;

        clientConfiguration.region = REGION;    // region must be set for Amazon Cognito operations
        AmazonCognitoClient = Aws::MakeShared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>("CognitoIdentityProviderClient", clientConfiguration);
    }
}

AccountHandler::~AccountHandler()
{
    Aws::ShutdownAPI(options);
}

I do have some functions with logic as well, but none are being invoked

#pragma once

#include <aws/core/Aws.h>
#include <aws/cognito-idp/CognitoIdentityProviderClient.h>

class AccountHandler
{
public:

    AccountHandler();
    ~AccountHandler();
};

Thats the .h file.

The class is being initialized as an std::stared_ptr

.h

/**Handle all account functions*/
std::shared_ptr<class AccountHandler> AccHandler;

.cpp

AccHandler = std::make_shared<AccountHandler>();

I have also tried initializing the Client Configuration after the sdk, as per your previous suggestion, but unfortunately, I got the same results.

Also something interesting from the visual studio debug logs:

'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-cal.dll'. 
'main-launcher.exe' (Win32): Unloaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-cal.dll'

That dll gets loaded and immediately unloaded. Not sure if that is expected, however, it is always a different dll

This is the full debug log

'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\main-launcher.exe'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-cpp-sdk-core.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-cpp-sdk-cognito-idp.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1d.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\libcef.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\userenv.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\wininet.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\winhttp.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dbghelp.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-crt-cpp.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\wintrust.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-event-stream.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-common.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\IPHLPAPI.DLL'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\comdlg32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dxgi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\propsys.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\secur32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\oleacc.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\netapi32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-mqtt.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-auth.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-s3.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\UIAutomationCore.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-http.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-io.dll'. 
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\sechost.dll'
'main-launcher.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_60b5254171f9507e\comctl32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-checksums.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-cal.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\hid.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\wtsapi32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\chrome_elf.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\DWrite.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\usp10.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\d3d9.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dxva2.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\winspool.drv'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\urlmon.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\credui.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\cryptui.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\wevtapi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\ncrypt.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dhcpcsvc.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\esent.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Users\Haven_Remix\Documents\Haven_Remix\haven-remix-launcher\haven-remix-launcher\x64\Debug\main-launcher\aws-c-compression.dll'. 
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\iertutil.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\netutils.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\wldp.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\sspicli.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\wkscli.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\sspicli.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\srvcli.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\sspicli.dll'
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\samcli.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\ntasn1.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\msasn1.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dpapi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\nlaapi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. Symbols loaded.
The thread 0x13e4 has exited with code 0 (0x0).
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dhcpcsvc6.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dnsapi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\clbcatq.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\profapi.dll'. Symbols loaded.
[0818/171643.830:VERBOSE1:pref_proxy_config_tracker_impl.cc(186)] 00003BF2006242C0: set chrome proxy config service to 00003BF200344340
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\gpapi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\mdmregistration.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110_win.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\omadmapi.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dmcmnutils.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\powrprof.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\iri.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\umpdc.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\umpdc.dll'
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\powrprof.dll'
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\cryptsp.dll'
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\msvcp110_win.dll'
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\dmcmnutils.dll'
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\iri.dll'
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\omadmapi.dll'
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\mdmregistration.dll'
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\winsta.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\MMDevAPI.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. Symbols loaded.
[0818/171643.938:VERBOSE1:webrtc_internals.cc(118)] Could not get the download directory.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\Windows.UI.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\WindowManagementAPI.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\InputHost.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\twinapi.appcore.dll'. 
[0818/171644.030:VERBOSE1:media_stream_manager.cc(705)] MSM::InitializeMaybeAsync([this=00003BF2006303C0])
[0818/171644.032:VERBOSE1:media_stream_manager.cc(705)] MDM::MediaDevicesManager()
[0818/171644.035:VERBOSE1:media_stream_manager.cc(705)] MSM::MediaStreamManager([this=00003BF2006303C0]))
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\mscms.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\coloradapterclient.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\mswsock.dll'. Symbols loaded.
onecore\com\combase\dcomrem\resolver.cxx(2299)\combase.dll!00007FFFEB7A206D: (caller: 00007FFFEB7A4F4E) ReturnHr(1) tid(3de0) 80040154 Class not registered
onecore\com\combase\dcomrem\resolver.cxx(2507)\combase.dll!00007FFFEB7A4F76: (caller: 00007FFFEB7A1A05) ReturnHr(2) tid(3de0) 80040154 Class not registered
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\DataExchange.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\dcomp.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\d3d11.dll'. Symbols loaded.
[0818/171644.181:VERBOSE1:pref_proxy_config_tracker_impl.cc(186)] 00003BF200625B80: set chrome proxy config service to 00003BF200345EE0
'main-launcher.exe' (Win32): Loaded 'C:\Program Files (x86)\Mirillis\Action!\action_x64.dll'. Module was built without symbols.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\wsock32.dll'. Symbols loaded.
The thread 0x3be4 has exited with code -1817313280 (0x93ae0000).
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\OnDemandConnRouteHelper.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Unloaded 'C:\Windows\System32\OnDemandConnRouteHelper.dll'
The thread 0x48e4 has exited with code 0 (0x0).
The thread 0x3ea4 has exited with code 0 (0x0).
The thread 0x3eac has exited with code 0 (0x0).
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\webio.dll'. Symbols loaded.
'main-launcher.exe' (Win32): Loaded 'C:\Windows\System32\winnsi.dll'. Symbols loaded.
Exception thrown at 0x00007FFFCDE613CC (vcruntime140d.dll) in main-launcher.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

Interestingly the line which causes the error

Aws::Client::ClientConfiguration clientConfiguration;

returns in the debugger

clientConfiguration | {userAgent=<Error reading characters of string.> scheme=-858993460 region=<Error reading characters of string.> ...} | Aws::Client::ClientConfiguration

which changes to this when running the next line

clientConfiguration | {userAgent=" TÖ2r\x2" scheme=HTTPS \| 14 (15) region=<Error reading characters of string.> ...} | Aws::Client::ClientConfiguration

Then the line after that I get the read access violation in vcruntine140d.dll

So far maybe Ive done something to mess up the way Aws allocated memory for strings?

Sorry for the long read, I figured its best to share all the information I have

And thank you so much for your time!

KaibaLopez commented 3 years ago

Hmmm that is weird, I am assuming the region you are putting there is something like "us-west-2"... but just to test things out, could you try defining the enviroment variable AWS_DEFAULT_REGION with the region you want to use and remove the line:

clientConfiguration.region = REGION; 
HavenRemix commented 3 years ago

Hey, firstly I would like to apologize for the late response again.

I tried

_putenv("AWS_DEFAULT_REGION=us-west-2");

and I also tried to put it in the environment section of visual studio

Same results, unfortunately

The region variable is defined as such

const char* REGION = Aws::Region::US_WEST_2;
KaibaLopez commented 3 years ago

Hi @HavenRemix , Sorry it seems like I got another error going that prevents me from seeing this, but I'll udpate as soon as I get something, for the moment I am kind of able to reproduce it but haven't figured out the root cause.

HavenRemix commented 3 years ago

Alright, thank you for your time so far! Please do let me know if you come up with something!

HavenRemix commented 3 years ago

Just in case this information is useful:

The problem seems to be with clientConfiguration.region specifically. I think that the variable is either never being set or being removed immediately after.

The visual studio debugger always leads to a file called memcpy.asm

I wrote this out for the sake of testing

#include <aws/core/Aws.h>
#include <aws/core/Region.h>

#include <aws/core/utils/logging/ConsoleLogSystem.h>
#include <aws/core/utils/logging/AWSLogging.h>
#include <aws/core/utils/logging/DefaultLogSystem.h>
#include <aws/core/utils/Outcome.h>
#include <aws/cognito-idp/model/AttributeType.h>
#include <aws/cognito-idp/model/SignUpRequest.h>
#include <aws/cognito-idp/model/SignUpResult.h>
#include <aws/cognito-idp/model/RevokeTokenRequest.h>
#include <aws/cognito-idp/model/RevokeTokenResult.h>
#include <aws/cognito-idp/model/ConfirmSignUpRequest.h>
#include <aws/cognito-idp/model/ConfirmSignUpResult.h>
#include <aws/cognito-idp/model/InitiateAuthRequest.h>
#include <aws/cognito-idp/model/InitiateAuthResult.h>
#include <aws/cognito-idp/model/ForgotPasswordRequest.h>
#include <aws/cognito-idp/model/ForgotPasswordResult.h>
#include <aws/cognito-idp/model/ConfirmForgotPasswordRequest.h>
#include <aws/cognito-idp/model/ConfirmForgotPasswordResult.h>
#include <aws/cognito-idp/model/ChangePasswordRequest.h>
#include <aws/cognito-idp/model/ChangePasswordResult.h>
#include <aws/cognito-idp/model/GetUserRequest.h>
#include <aws/cognito-idp/model/GetUserResult.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/cognito-idp/CognitoIdentityProviderClient.h>

static const char* REGION = Aws::Region::US_WEST_2;

static std::shared_ptr<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient> AmazonCognitoClient;

int main()
{
    Aws::SDKOptions options;

    options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;

    Aws::InitAPI(options);

    Aws::Utils::Logging::InitializeAWSLogging(Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>("AwsLogTemp", Aws::Utils::Logging::LogLevel::Trace, "aws_sdk_"));
    Aws::Utils::Logging::LogSystemInterface* LogSystem = Aws::Utils::Logging::GetLogSystem();
    LogSystem->Log(Aws::Utils::Logging::LogLevel::Info, "TEST", "THIS IS A TEST");
    {
        Aws::Client::ClientConfiguration clientConfiguration;

        std::cout << REGION << std::endl;

        clientConfiguration.region = REGION;    // region must be set for Amazon Cognito operations
        std::cout << clientConfiguration.region << std::endl;
        std::cout << "something" << std::endl;
        AmazonCognitoClient = Aws::MakeShared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>("CognitoIdentityProviderClient", clientConfiguration);
    }

    return 0;
}

I get a crash and a access read error at

std::cout << clientConfiguration.region << std::endl;

Basically anytime I attempt to read it.

Also in the debugger, it shows the value to be

<error reading characters of string> 

Also I am using libcef in case that adds something problametic

HavenRemix commented 3 years ago

Ok so after recreating the project and slowly changing things I found out was was causing the error. I had

_HAS_ITERATOR_DEBUGGING=0
_ITERATOR_DEBUGGING_LEVEL=0

And removing those fixed this particular issue, but I have a new one although that's a new issue.

github-actions[bot] commented 3 years ago

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