Skip to content

Crash while creating second MqttConnection #292

@elad-ep

Description

@elad-ep

Hi, we are using SDK version 1.12.3. we have SDK crash in the following scenario:
we try to connect to AWS using MqttConnection:

std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> mConnection;

in proxy configured environments we don't manage to connect in our first attempt. so we query the proxy and try again to connect again - we overwrite the mConnection variable when creating the second new connection:

mConnection = mMqttClient->NewConnection(*mConnectionConfig);

at this point the first connection shared_ptr is released and the SDK is crashing - see second stack below. in addition see the first stack below for additional crash in the same scenario.

logs sent to jkl@amazon.com.

Thanks

00 0323f104 77e2e4e3 ntdll!RtlFailFast2
01 0323f134 77de4a81 ntdll!RtlpHandleInvalidUserCallTarget+0x93
02 0323f1bc 002e7b72 ntdll!LdrpValidateUserCallTargetBitMapRet+0x44
03 0323f1d0 002e9ac4 	  !aws_mem_acquire+0x22 [aws-iot-device-sdk-cpp-v2\crt\aws-crt-cpp\crt\aws-c-common\source\allocator.c @ 120] 
04 0323f1ec 0047d8b6 	  !aws_string_new_from_array+0x34 [aws-iot-device-sdk-cpp-v2\crt\aws-crt-cpp\crt\aws-c-common\source\string.c @ 19] 
05 0323f240 002ef693 	  !aws_mqtt_client_connection_connect+0x106 [aws-iot-device-sdk-cpp-v2\crt\aws-crt-cpp\crt\aws-c-mqtt\source\client.c @ 1373] 
06 0323f2c4 0027876c 	  !Aws::Crt::Mqtt::MqttConnection::Connect+0x143 [aws-iot-device-sdk-cpp-v2\crt\aws-crt-cpp\source\mqtt\mqttclient.cpp @ 405] 




0383eee8 77e2e4e3 ntdll!RtlFailFast2
01 0383ef18 77dfd9f9 ntdll!RtlpHandleInvalidUserCallTarget+0x93
02 0383efa8 77dd2426 ntdll!RtlDispatchException+0x4dac1
03 0383efa8 77de4a2b ntdll!KiUserExceptionDispatcher+0x26
04 0383f41c 00487cf2 ntdll!LdrpValidateUserCallTargetBitMapCheck
05 0383f430 002ef264 	  !aws_ref_count_release+0x22 [aws-iot-device-sdk-cpp-v2\crt\aws-crt-cpp\crt\aws-c-common\source\ref_count.c @ 27] 
06 0383f460 002f0160 	  !Aws::Crt::Mqtt::MqttConnection::~MqttConnection+0x44 [aws-iot-device-sdk-cpp-v2\crt\aws-crt-cpp\source\mqtt\mqttclient.cpp @ 293] 
07 0383f480 00278307 	  !std::_Ref_count_resource<Aws::Crt::Mqtt::MqttConnection *,<lambda_3f159fec8052f10884a89e7bcc65f7ba> >::_Destroy+0x30 [c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\memory @ 925] 
08 (Inline) -------- 	  !std::_Ref_count_base::_Decref+0x1e [c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\memory @ 847] 
09 (Inline) -------- 	  !std::_Ptr_base<Aws::Crt::Mqtt::MqttConnection>::_Decref+0x20 [c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\memory @ 1120] 
0a (Inline) -------- 	  !std::shared_ptr<Aws::Crt::Mqtt::MqttConnection>::{dtor}+0x20 [c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\memory @ 1403] 
0b (Inline) -------- 	  !std::shared_ptr<Aws::Crt::Mqtt::MqttConnection>::operator=+0x7a [c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\memory @ 1421

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.pending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions