wiced_aws_disconnect results in memory leak

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BiM_4640481
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Hi,

I am working on Murata1LD board

In my code, call to wiced_aws_disconnect causes program to hang. I suspect a memory leak. I followed the solution in below thread. But the issue is not yet solved.

https://community.cypress.com/t5/WICED-Studio-Wi-Fi-Combo/Proper-AWS-sequence-on-intermittent-WiFi-c...

Whenver , wifi connection is interrupted, the code hangs there.  Apart from the solution mentioned in above thread, is there anything to be done. 

 

Thanks,

Binsy M S

0 Likes
5 Replies
Murali_R
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 100 solutions authored

@BiM_4640481 

An issue was reported where there was a memory leak after multiple connections and disconnections to the AWS. Can you do the below changes and see if it fixes the issue?

Add the below lines in /43xxx_Wi-Fi/libraries/protocols/AWS/aws_mqtt.c in the function aws_internal_mqtt_disconnect() after the line ret = wiced_mqtt_disconnect( mqtt );
wiced_mqtt_deinit(mqtt); //Memory Leak fix
free(mqtt); //Memory Leak fix
mqtt = NULL;

Add the below line in /43xxx_Wi-Fi/libraries/protocols/AWS/wiced_aws.c in the function wiced_result_t wiced_aws_deinit( void ) after the tls_deinit
free(g_aws_thing.tls_identity);

 

Thanks

0 Likes

Hi,

I have already tried the below solution.

Add the below lines in /43xxx_Wi-Fi/libraries/protocols/AWS/aws_mqtt.c in the function aws_internal_mqtt_disconnect() after the line ret = wiced_mqtt_disconnect( mqtt );
wiced_mqtt_deinit(mqtt); //Memory Leak fix
free(mqtt); //Memory Leak fix
mqtt = NULL;

And the other one you mentioned is already present in the files of WICED-Studio-6.4

Add the below line in /43xxx_Wi-Fi/libraries/protocols/AWS/wiced_aws.c in the function wiced_result_t wiced_aws_deinit( void ) after the tls_deinit
free(g_aws_thing.tls_identity);

 

But the issue is not resolved with these solutions

 

Thanks,

Binsy M S

0 Likes
Murali_R
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 100 solutions authored

Which is the application that you are using?
When does it hang?

Can you give me the steps to reproduce this?

0 Likes

I am trying to develop an application by modifying publisher project in wiced-studio.  with qos =1, when it fails to get the publish acknowledgement , wiced_aws_disconnect is called to forcefully disconnect. After this when it again tries to connect , the program gets hung. 

/* Published - Check if we want an acknowledgment */
if (qos > WICED_AWS_QOS_ATMOST_ONCE)
{
ret = wiced_rtos_get_semaphore(&event_semaphore, APP_AWS_PUBLISH_ACK_TIMEOUT);
if (ret != WICED_SUCCESS)
{
WPRINT_APP_INFO(("[Application/AWS] Error Receiving Publish Ack(ret: %d)\n", ret));
/* if we are still connected; Force a Disconnect */
if (is_connected)
{
wiced_aws_disconnect(aws_connection);
}
is_connected = 0;
}
}

 

Thanks,

Binsy M S

0 Likes
Murali_R
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 100 solutions authored

I don't seem to be able to reproduce the issue that you are reporting. Can you give out your application and the steps for me to reproduce the issue?

0 Likes