This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC3220SF: MQTT Re-connection issue after Bridge disconnection

Part Number: CC3220SF

Tool/software: TI-RTOS

Hello,

       - We are using simplelink_cc32xx_sdk_2_10_00_04 for our application. We are using MQTT client in our application to communicate with our server. But we are getting frequent Bridge Disconnection issues with small interruption (1 or 2Sec) on internet connectivity also. We tried all the possible ways to disconnect and reconnect MQTT handlers, but we couldn't. When we debug we are not able to come out of MQTT_Stop() function called across 'Bridge Disconnection' event, we observed that it is because of mutex locks. 

       - We are able to replicate the issue on MQTT client example also.

       - Please suggest how to recover from this case. Is there any possibility to force delete MQTT client and reinitialize?

      

  

 

  • Hi Vivek,

    Testing the mqtt client example with an IBM Watson broker, I do not seem to run into the same issue you are seeing. The way I am testing this is that I am letting my CC3220 connect to the broker, then I remove the WAN connection of my AP so that the CC3220 is disconnected from the broker.
    When I do that, the code executes Mqtt_Stop() without issues and then attempts to restart the connection to the broker. If I restore internet connectivity to my AP, the reconnect succeeds and everything seems to function correctly. As far as I can tell, the mqtt stop/restart process implemented in mqtt_client_app.c should function correctly.

    When you are testing, where do you get stuck in Mqtt_Stop()? If you could show your callstack that would be helpful. Also, what modifications have you made to the mqtt_client example?

    Regards,
    Michael
  • Hi Michael,

             Thank you for your response.

            We are getting LOCAL_CLIENT_DISCONNECTION event when we remove and reconnect internet connection for 3 to 4 Sec on the Wi-Fi Router . But Mqtt_Stop() Function did not called written on mainthread(), So we called Mqtt_Stop() across 'case LOCAL_CLIENT_DISCONNECTION:' . Once or twice it got recovered and finally we received 'Queue is full' messages multiple times and it gets hanged. Please guide us how to recover from this case.

    Regards

    Vivek

          

  • Hi Vivek,

    Are you getting a BRIDGE DISCONNECTION message? If you lose internet connectivity, then once the MQTT keepalive fails you should quickly get that event. Once that occurs, Mqtt_Stop() will be called and the code will reset the MQTT client state and reconnect.

    Also, how quickly are you toggling the internet connection during your test? On my end, if I toggle it on/off every 15-20 seconds or so it seems to work correctly, with the bridge disconnection message received quickly after connectivity is lost.

    One last thought:. What events are you getting in MqttClientCallback()? Are you not getting the MQTTClient_DISCONNECT_CB_EVENT event at any point?

    Regards,
    Michael
  • Hi Vivek,

    I assume that you have resolved your issue since I have not heard back from you. If not, feel free to post a response to this thread, or open a new thread regarding this issue.

    Regards,
    Michael