Skip to content

Segmentation fault in libaws-cpp-sdk-core.so on creation of Aws::Client::ClientConfiguration #1925

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

Closed
gi12345 opened this issue May 6, 2022 · 17 comments
Assignees
Labels
bug This issue is a bug. closed-for-staleness needs-reproduction This issue needs reproduction. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@gi12345
Copy link

gi12345 commented May 6, 2022

Describe the bug

Segmentation fault in libaws-cpp-sdk-core.so on creation of Aws::Client::ClientConfiguration.

Stack trace and reproduction steps see below.

Expected Behavior

No segmentation fault

Current Behavior

Crash Trace:

03/05/2022 15:57:58.394 [WARNING]Catch dump signal [11]Segmentation fault
Obtained 10 stack frames:
[0]./VIGILCameraServer(_Z4dumpi+0x28) [0x4e4cb8]
[1]linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7f89faf5e4]
[2]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZN3Aws5Utils9Threading16ReaderWriterLock10LockReaderEv+0) [0x7f897f14a8]
[3]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZNK3Aws6Config32ConfigAndCredentialsCacheManager9GetConfigERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_+0x34) [0x7f898017d4]
[4]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZN3Aws6Config20GetCachedConfigValueERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x58) [0x7f89801958]
[5]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZN3Aws6Client38setLegacyClientConfigurationParametersERNS0_19ClientConfigurationE+0x2a0) [0x7f89801c40]
[6]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZN3Aws6Client19ClientConfigurationC1Ev+0x114) [0x7f89802204]
[7]./VIGILCameraServer(_ZN15CMotionUploaderC1Ev+0x44) [0x59713c]
[8]./VIGILCameraServer(_ZN18CVIGILCameraServer12CreateServerEv+0xb7c) [0x4e3364]
[9]./VIGILCameraServer(_ZN18CVIGILCameraServer10InitializeEv+0x64) [0x4e2134]

Reproduction Steps

---- MotionUploader.h file ---------------------

using namespace std;
class CMotionUploader : public Runable
{
public:
	CMotionUploader();
	~CMotionUploader();

public:
	virtual bool run();

private:
    Aws::SDKOptions m_awsSDKoptions;
    Aws::Client::ClientConfiguration m_cfg;
}

---- MotionUploader.cpp file --------------------

CMotionUploader::CMotionUploader()
{
    Aws::InitAPI(m_awsSDKoptions);
}
main()
{
CMotionUploader*    m_pMotionUploader;
m_pMotionUploader = new CMotionUploader();
}

Possible Solution

No response

Additional Information/Context

This code has been working before running daily for a couple of years. The AWS SDK used was about 2018.
The bug is most likely triggered by a design change inside AWS-SDK.
See also likely similar issue, but not for C++: Segmentation fault at Aws::Utils::Threading::ReaderWriterLock::LockReader () #1716

AWS CPP SDK version used

AWS-SDK-C++ version: new checkout and default build "S3-only" on April 18, 2022 OS: Built on Ubuntu-20 AARM64, run on AARM64-device

Compiler and Version used

Ubuntu20-gcc

Operating System and version

Ubuntu-20 AARM64

@gi12345 gi12345 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 6, 2022
@vudh1
Copy link

vudh1 commented May 17, 2022

Hi @gi12345 can you send the cmake command line that you used to build?

@vudh1 vudh1 added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label May 17, 2022
@gi12345
Copy link
Author

gi12345 commented May 17, 2022

This is part of a very large system. We do not use cmake, all is built through make.

@gi12345
Copy link
Author

gi12345 commented May 17, 2022

Also, look at this one:
Segmentation fault at Aws::Utils::Threading::ReaderWriterLock::LockReader () #1716
#1716

Very similar to this case I think.
But in our case I cannot change the change the initialization order. On creation of class CMotionUploader the c++ compiler will first create the class variable Aws::Client::ClientConfiguration m_cfg before calling the class constructor with Aws::InitAPI(m_awsSDKoptions).

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label May 18, 2022
@vudh1
Copy link

vudh1 commented May 23, 2022

You are setting the ClientConfiguration outside InitAPI(). I change the code and it works without showing the Segmentation problem. Please follow this code snippet or reopen if this is not helpful:

CMotionUploader() {
        InitAPI(options);
        {
            Aws::Client::ClientConfiguration clientConfig;
        }
    }

@vudh1 vudh1 closed this as completed May 23, 2022
@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.

@gi12345
Copy link
Author

gi12345 commented May 23, 2022

Hi Daniel,
The solution you suggest is not addressing our problem:

  1. We are working in C++ not C; in this specific case C is trivial, C++ is not (see solution to Segmentation fault at Aws::Utils::Threading::ReaderWriterLock::LockReader () #1716 above). Also take into account that the entire scenario happens during class instance creation mainly performed by the C++ compiler. And as in Segmentation fault at Aws::Utils::Threading::ReaderWriterLock::LockReader () #1716 above our code was working before with an older SDK version.
  2. The definition Aws::Client::ClientConfiguration m_cfg is a class member definition. It must be a class member definition so class methods can access this data structure! In your suggestion above client_config is a local method variable (scope); we must have a class variable so access from other class methods is possible.
  3. The method Aws::InitAPI(m_awsSDKoptions) is run inside the class constructor. This is the earliest time during C++ class creation when a user defined method can be called.

In my opinion the problem is caused by Aws::Client::ClientConfiguration m_cfg. I guess it is bound to an AWS internal constructor which runs prior to Aws::InitAPI(m_awsSDKoptions). C++ compiler performs class member variable handling prior to invoking class constructor method.

If the class member variable definition Aws::Client::ClientConfiguration m_cfg would automatically call Aws::InitAPI() the problem would be solved.
An other solution might be the definition of some "dummy" class variable which has a constructor bound and invokes Aws::InitAPI(); such "dummy" variable would be added to the class variable section prior to Aws::Client::ClientConfiguration m_cfg.

@gi12345
Copy link
Author

gi12345 commented May 23, 2022

Hi Daniel,
please re-open the issue as I do not consider it solved.

@gi12345
Copy link
Author

gi12345 commented May 24, 2022

As an experiment I have modified my code as follows:
...within C++ class constructor...

    printf("CSMU CMotionUploader::GetSecurityKeys: Point AAAAA1\n");
    Aws::SDKOptions k_awsSDKoptions;
    Aws::InitAPI(k_awsSDKoptions);
    printf("CSMU CMotionUploader::GetSecurityKeys: Point AAAAA2\n");
    {
    Aws::Client::ClientConfiguration m_cfg;  //xxx-gi
    printf("CSMU CMotionUploader::GetSevcurityKeys: Point AAAAA3\n");

Ouput:

CSMU CMotionUploader::GetSecurityKeys: Point AAAAA1
CSMU CMotionUploader::GetSecurityKeys: Point AAAAA2

Crash stack trace:

24/05/2022 14:25:56.101 [WARNING]Catch dump signal [11]Segmentation fault

Obtained 10 stack frames:

[0]./VIGILCameraServer(_Z4dumpi+0x28) [0x4e4dc4]
[1]linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7fafb455e4]
[2]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZNK3Aws8Internal21AWSHttpResourceClient34GetResourceWithAWSWebServiceResultB5cxx11ERKSt10shared_ptrINS_4Http11HttpRequestEE+0xa4) [0x7faf349d7c]
[3]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZNK3Aws8Internal17EC2MetadataClient16GetCurrentRegionB5cxx11Ev+0x34c) [0x7faf345e44]
[4]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZN3Aws6Client19ClientConfigurationC1Ev+0x228) [0x7faf398318]
[5]./VIGILCameraServer(_ZN15CMotionUploader15GetSecurityKeysEv+0x420) [0x5990b8]
[6]./VIGILCameraServer(_ZN15CMotionUploader18InitializeAWSS3EnvEv+0x3c4) [0x59a9e4]
[7]./VIGILCameraServer(_ZN15CMotionUploaderC1Ev+0x18c) [0x597774]
[8]./VIGILCameraServer(_ZN18CVIGILCameraServer12CreateServerEv+0xb88) [0x4e3440]
9]./VIGILCameraServer(_ZN18CVIGILCameraServer10InitializeEv+0x64) [0x4e21f4]

@gi12345
Copy link
Author

gi12345 commented May 25, 2022

Reproduced this way:

int main(int argc, char** argv)
{
    printf("Point qqqqqqqqqqqqqqqqqq1\n");
    Aws::SDKOptions k_awsSDKoptions;
    Aws::InitAPI(k_awsSDKoptions);
    printf("Point qqqqqqqqqqqqqqqqqqqqqq2\n");
    {
    Aws::Client::ClientConfiguration m_cfg;  //xxx-gi
    printf("Point qqqqqqqqqqqqqqqqqqqqqqq3\n");
    }

=========================================
Log output:

Point qqqqqqqqqqqqqqqqqq1
Point qqqqqqqqqqqqqqqqqqqqqq2
Segmentation fault
#

=========================================
Obtained 8 stack frames:

[0]./VIGILCameraServer(_Z4dumpi+0x28) [0x4e51f8]
[1]linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7fa30885e4]
[2]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZNK3Aws8Internal21AWSHttpResourceClient34GetResourceWithAWSWebServiceResultB5cxx11ERKSt10shared_ptrINS_4Http11HttpRequestEE+0xa4) [0x7fa288cd7c]
[3]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZNK3Aws8Internal17EC2MetadataClient16GetCurrentRegionB5cxx11Ev+0x34c) [0x7fa2888e44]
[4]/mnt/plugin/vigilcamera/lib/libaws-cpp-sdk-core.so(_ZN3Aws6Client19ClientConfigurationC1Ev+0x228) [0x7fa28db318]
[5]./VIGILCameraServer(main+0x5b4) [0x4e5f24]
[6]/lib/libc.so.6(__libc_start_main+0xe8) [0x7fa1b30d18]
[7]./VIGILCameraServer() [0x4da934]

==========================================
Question: Could it be that core.so depends on some .so library which it cannot locate?
We are running on Ubuntu20-aarm64. SDK was built on EC2 with Ubuntu20-aarm64.

@gi12345
Copy link
Author

gi12345 commented May 25, 2022

ubuntu@ip-172-31-23-16:~/environ_may20/aws/lib$ ldd libaws-cpp-sdk-core.so
	linux-vdso.so.1 (0x0000ffffb7274000)
	libpthread.so.0 => /lib/aarch64-linux-gnu/atomics/libpthread.so.0 (0x0000ffffb6e67000)
	libcurl.so.4 => /lib/aarch64-linux-gnu/libcurl.so.4 (0x0000ffffb6dd2000)
	libcrypto.so.1.1 => /home/ubuntu/kvssdk_may20/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/lib/libcrypto.so.1.1 (0x0000ffffb6b20000)
	libdl.so.2 => /lib/aarch64-linux-gnu/atomics/libdl.so.2 (0x0000ffffb6b0c000)
	libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffffb6927000)
	libm.so.6 => /lib/aarch64-linux-gnu/atomics/libm.so.6 (0x0000ffffb687d000)
	libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffb6859000)
	libc.so.6 => /lib/aarch64-linux-gnu/atomics/libc.so.6 (0x0000ffffb66e8000)
	/lib/ld-linux-aarch64.so.1 (0x0000ffffb7244000)
	libnghttp2.so.14 => /lib/aarch64-linux-gnu/libnghttp2.so.14 (0x0000ffffb66b1000)
	libidn2.so.0 => /lib/aarch64-linux-gnu/libidn2.so.0 (0x0000ffffb6683000)
	librtmp.so.1 => /lib/aarch64-linux-gnu/librtmp.so.1 (0x0000ffffb6657000)
	libssh.so.4 => /lib/aarch64-linux-gnu/libssh.so.4 (0x0000ffffb65dd000)
	libpsl.so.5 => /lib/aarch64-linux-gnu/libpsl.so.5 (0x0000ffffb65bc000)
	libssl.so.1.1 => /home/ubuntu/kvssdk_may20/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/lib/libssl.so.1.1 (0x0000ffffb651e000)
	libgssapi_krb5.so.2 => /lib/aarch64-linux-gnu/libgssapi_krb5.so.2 (0x0000ffffb64c6000)
	libldap_r-2.4.so.2 => /lib/aarch64-linux-gnu/libldap_r-2.4.so.2 (0x0000ffffb6464000)
	liblber-2.4.so.2 => /lib/aarch64-linux-gnu/liblber-2.4.so.2 (0x0000ffffb6445000)
	libbrotlidec.so.1 => /lib/aarch64-linux-gnu/libbrotlidec.so.1 (0x0000ffffb642a000)
	libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000ffffb6400000)
	libunistring.so.2 => /lib/aarch64-linux-gnu/libunistring.so.2 (0x0000ffffb6277000)
	libgnutls.so.30 => /lib/aarch64-linux-gnu/libgnutls.so.30 (0x0000ffffb6086000)
	libhogweed.so.5 => /lib/aarch64-linux-gnu/libhogweed.so.5 (0x0000ffffb6040000)
	libnettle.so.7 => /lib/aarch64-linux-gnu/libnettle.so.7 (0x0000ffffb5ffa000)
	libgmp.so.10 => /lib/aarch64-linux-gnu/libgmp.so.10 (0x0000ffffb5f73000)
	libkrb5.so.3 => /lib/aarch64-linux-gnu/libkrb5.so.3 (0x0000ffffb5e8b000)
	libk5crypto.so.3 => /lib/aarch64-linux-gnu/libk5crypto.so.3 (0x0000ffffb5e4e000)
	libcom_err.so.2 => /lib/aarch64-linux-gnu/libcom_err.so.2 (0x0000ffffb5e3a000)
	libkrb5support.so.0 => /lib/aarch64-linux-gnu/libkrb5support.so.0 (0x0000ffffb5e1d000)
	libresolv.so.2 => /lib/aarch64-linux-gnu/atomics/libresolv.so.2 (0x0000ffffb5df7000)
	libsasl2.so.2 => /lib/aarch64-linux-gnu/libsasl2.so.2 (0x0000ffffb5dcc000)
	libgssapi.so.3 => /lib/aarch64-linux-gnu/libgssapi.so.3 (0x0000ffffb5d7e000)
	libbrotlicommon.so.1 => /lib/aarch64-linux-gnu/libbrotlicommon.so.1 (0x0000ffffb5d4d000)
	libp11-kit.so.0 => /lib/aarch64-linux-gnu/libp11-kit.so.0 (0x0000ffffb5bff000)
	libtasn1.so.6 => /lib/aarch64-linux-gnu/libtasn1.so.6 (0x0000ffffb5bdc000)
	libkeyutils.so.1 => /lib/aarch64-linux-gnu/libkeyutils.so.1 (0x0000ffffb5bc7000)
	libheimntlm.so.0 => /lib/aarch64-linux-gnu/libheimntlm.so.0 (0x0000ffffb5bad000)
	libkrb5.so.26 => /lib/aarch64-linux-gnu/libkrb5.so.26 (0x0000ffffb5b11000)
	libasn1.so.8 => /lib/aarch64-linux-gnu/libasn1.so.8 (0x0000ffffb5a6a000)
	libhcrypto.so.4 => /lib/aarch64-linux-gnu/libhcrypto.so.4 (0x0000ffffb5a23000)
	libroken.so.18 => /lib/aarch64-linux-gnu/libroken.so.18 (0x0000ffffb59fd000)
	libffi.so.7 => /lib/aarch64-linux-gnu/libffi.so.7 (0x0000ffffb59e4000)
	libwind.so.0 => /lib/aarch64-linux-gnu/libwind.so.0 (0x0000ffffb59ab000)
	libheimbase.so.1 => /lib/aarch64-linux-gnu/libheimbase.so.1 (0x0000ffffb598a000)
	libhx509.so.5 => /lib/aarch64-linux-gnu/libhx509.so.5 (0x0000ffffb5930000)
	libsqlite3.so.0 => /lib/aarch64-linux-gnu/libsqlite3.so.0 (0x0000ffffb57fd000)
	libcrypt.so.1 => /lib/aarch64-linux-gnu/libcrypt.so.1 (0x0000ffffb57b4000)

@gi12345
Copy link
Author

gi12345 commented May 27, 2022

Code always crashes in this variable definition inside AWS SDK:
Aws::Client::ClientConfiguration m_cfg;

@gi12345
Copy link
Author

gi12345 commented May 30, 2022

in file AWSHttpResourceClient.cpp, Line 134:
std::shared_ptr response(m_httpClient->MakeRequest(httpRequest));
if m_httpClient is not initialized correctly above statement will crash!

@vudh1 vudh1 reopened this May 31, 2022
@gi12345
Copy link
Author

gi12345 commented Jun 6, 2022

The latest AWS-C++ SDK (started June 1 2022) has linkage errors not seen before in the core.so library:

cal -laws-crt-cpp -ls2n -laws-c-sdkutils -lKinesisVideoProducer -lcproducer -llog4cplus -lkvspicUtils -lkvspic -lglib-2.0 -lgobject-2.0 -lgstreamer-1.0 -lgstapp-1.0 -lgstbase-1.0 -lrecordingfs -lVIGILShared
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_easy_getinfo@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_global_init@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_easy_perform@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_slist_free_all@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_easy_strerror@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_easy_setopt@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_easy_init@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_slist_append@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_easy_cleanup@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_easy_pause@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_version_info@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_easy_reset@CURL_OPENSSL_4'
/usr/local/linaro-aarch64-2020.09-gcc10.2-linux5.4/bin/../lib/gcc/aarch64-linux-gnu/10.2.1/../../../../aarch64-linux-gnu/bin/ld: ./ThirdPart/ARM64/aws/lib/libaws-cpp-sdk-core.so: undefined reference to `curl_global_cleanup@CURL_OPENSSL_4'
collect2: error: ld returned 1 exit status
make: *** [Makefile:260: VIGILCameraServer] Error 1

@gi12345
Copy link
Author

gi12345 commented Jun 6, 2022

Hi Daniel,
any comments or help on any of these problems?
Thanks

@jmklix jmklix removed the needs-triage This issue or PR still needs to be triaged. label Jun 9, 2022
@lming88
Copy link

lming88 commented Jul 29, 2022

in file AWSHttpResourceClient.cpp, Line 134:
std::shared_ptr response(m_httpClient->MakeRequest(httpRequest));
if m_httpClient is not initialized correctly above statement will crash!

we see the same issue. use aws-sdk-cpp ver. 1.8.816, ubuntu20, use make, Intel 32bits App. The following lists the coredump backtrace and our codes

------ coredump backtrace ------

#0  0x00889578 in Aws::Internal::AWSHttpResourceClient::GetResourceWithAWSWebServiceResult () at ../AWSHttpResourceClient.cpp
#1  0x0088cb3e in Aws::Internal::EC2MetadataClient::GetCurrentRegion (this=0x139b12c) at .. AWSHttpResourceClient.cpp
#2  0x008c74ed in Aws::Client::ClientConfiguration::ClientConfiguration (this=0x1a7f000) at ../ClientConfiguration.cpp
#3  0x00ac60c2 in ApplicationState::addClientConfiguration () 

----- codes --------

class ApplicationState
{
public:
        static ApplicationState& getInstance();
        void   addClientConfiguration();
private:
        Aws::Client::ClientConfiguration* p_awsClientConfig;
}
 
ApplicationState &ApplicationState::getInstance() {
    static ApplicationState appState;
    return appState;
}
 
void ApplicationState::addClientConfiguration() {
    p_awsClientConfig = new Aws::Client::ClientConfiguration();
}
 
main() {
 
  Aws::SDKOptions options;
  Aws::InitAPI(options);
 
 ApplicationState::getInstance().addClientConfiguration();  // crash here !!! 
 
}

@vudh1 vudh1 assigned jmklix and unassigned vudh1 Sep 9, 2022
@jmklix jmklix added p2 This is a standard priority issue needs-reproduction This issue needs reproduction. labels Nov 18, 2022
@jmklix
Copy link
Member

jmklix commented Sep 6, 2023

Can you make sure that you are making all sdk calls inside the {}:

#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;
}

@jmklix jmklix added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label Sep 6, 2023
@github-actions
Copy link

github-actions bot commented Sep 9, 2023

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 9, 2023
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. closed-for-staleness needs-reproduction This issue needs reproduction. p2 This is a standard 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

4 participants