MQTT with Secure connection disconnection issue with IDFv3.0
Posted: Wed May 23, 2018 7:16 am
Hello,
I have ported eclipse paho mqtt client library as below link,
https://github.com/eclipse/paho.mqtt.embedded-c
and added modifications for secure connection options with mbedTLS.
I tested it with IDFv2.1 and IDFv3.0 stable release and found some issues as listed below with Disconnect event of MQTT connection,
with IDF3.0 only.
first of all my part of code snippet is as below,
Now the issue is with IDFv3.0,
when connection is lost (STA is disconnected from ESP), MQTTYield() in above code snippet does not return until STA gets connected again. SO until STA is connected again, MQTTYield() is running forever. I am suspecting timer does not expires in implementation of MQTT library.
But changing back to the IDFv2.1,
MQTTYield() returns after 1sec as expected and gives "disconnected..." log on console.
This issue is only with IDF3.0. With IDF2.1 MQTTYield() returns as soon as STA gets dis-connected. and as per my functionality it disconnect network and again try to connect to the network.
Hope I explained issue good enough to have idea about it.
It will be a great help if anybody have come across the same issue and have the resolution.
Is there any change in IDF3.0 which is causing this issue. As looking at MQTTYield(), its based on gettimeofday() dependent which is again dependent on freertos ticks. In IDF3.0, tick source for both CPUs separated. Is there any way that its coming into picture. well its just a guess.
if anybody have any idea, it would be a great help.
thanks.
I have ported eclipse paho mqtt client library as below link,
https://github.com/eclipse/paho.mqtt.embedded-c
and added modifications for secure connection options with mbedTLS.
I tested it with IDFv2.1 and IDFv3.0 stable release and found some issues as listed below with Disconnect event of MQTT connection,
with IDF3.0 only.
first of all my part of code snippet is as below,
Code: Select all
NetworkConnect()
MQTTConnect()
while (1)
{
MQTTYield(&client, 1000);
if (!MQTTIsConnected(&client))
{
ESP_LOGE(TAG,"Disconnected.......");
break;
}
}
DisconnectNetwork()
NetworkConnect()
MQTTConnect()
when connection is lost (STA is disconnected from ESP), MQTTYield() in above code snippet does not return until STA gets connected again. SO until STA is connected again, MQTTYield() is running forever. I am suspecting timer does not expires in implementation of MQTT library.
But changing back to the IDFv2.1,
MQTTYield() returns after 1sec as expected and gives "disconnected..." log on console.
This issue is only with IDF3.0. With IDF2.1 MQTTYield() returns as soon as STA gets dis-connected. and as per my functionality it disconnect network and again try to connect to the network.
Hope I explained issue good enough to have idea about it.
It will be a great help if anybody have come across the same issue and have the resolution.
Is there any change in IDF3.0 which is causing this issue. As looking at MQTTYield(), its based on gettimeofday() dependent which is again dependent on freertos ticks. In IDF3.0, tick source for both CPUs separated. Is there any way that its coming into picture. well its just a guess.
if anybody have any idea, it would be a great help.
thanks.