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

shadow connect possible memory leak #16

Closed
dfszb opened this issue Apr 25, 2016 · 3 comments
Closed

shadow connect possible memory leak #16

dfszb opened this issue Apr 25, 2016 · 3 comments

Comments

@dfszb
Copy link

dfszb commented Apr 25, 2016

It looks like the documentation does not describe the scenario when on startup the AWS connect call fails (because of network not being available for example).
I used a connect loop similar to the one mentioned in #13 however it looks like this will leak the handles that are supposed to be cleaned by iot_tls_destroy.
If add this call to
IoT_Error_t aws_iot_mqtt_connect(MQTTConnectParams *pParams) {
...
pahoRc = MQTTConnect(&c, &data);
if(MQTT_NETWORK_ALREADY_CONNECTED_ERROR == pahoRc) {
rc = NETWORK_ALREADY_CONNECTED;
} else if(SUCCESS != pahoRc) {
// this is a hack, but otherwise we'll leak those buffers on every connection attempt
iot_tls_destroy(NULL);
rc = CONNECTION_ERROR;
}
return rc;
...
, then the memory leak goes away (i.e. memory usage no longer increases, and valgrind also seems to be reasonably happy).

@chaurah
Copy link
Contributor

chaurah commented Apr 25, 2016

Hi,
That is a very good suggestion. We have been tracking this issue internally as well. We already have a fix in place that is included with the next release of the Embedded C SDK. Please let us know if you have any further questions about this issue.
Thank you for using AWS IoT and the Embedded C SDK.

Rahul

@dfszb
Copy link
Author

dfszb commented Apr 26, 2016

Thx, looking forward to seeing the changes (I assume they'll solve the problem in a cleaner way compared to my small hack).

@chaurah
Copy link
Contributor

chaurah commented May 9, 2016

Hi,
This has been fixed in v2.x of the SDK. Please download the latest release and let us know if you continue to see memory leaks.

Rahul

@chaurah chaurah closed this as completed May 9, 2016
aggarw13 added a commit to aggarw13/aws-iot-device-sdk-embedded-C that referenced this issue Nov 29, 2019
Pull changes from public repository and tweak the Foundry SDK to accommodate those changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants