添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hello everybody,


I am using Synergy Netx duo MQTT client on my SK-S7G2 board. I am experiencing connection loss after a while, so i decided to reconnect when there is disconnection. So in MQTT_Disconnect_Notify function i am trying to connect by calling MQTT disconnect for the client and then MQTT Connect. This way am able to connect back but the board is not able to ping the broker, so this connection will be lost very soon, and hence this reconnection is not stable.

Has anybody faced disconnection on MQTT?

If so how to reconnect to the same broker with the same MQTT client?

Any help would be great.

I know, this question was asked almost one year ago, but I assume I have the same problem right now. My problem is showing up as follows:
- Suddenly, my disconnect Callback is called
- I try to reconnect immediately (not in the callback but in a Thread that is informed about the disconnect)
- Connecting is successful
- Subscribe to topic is also successful
- disconnect callback is called again, and guess what happens?
Finally I could reproduce the behavior by disconnecting ethernet. While debugging, I found out that there is a variable "nxd_mqtt_ping_not_responded" on the mqtt instance. This variable was set to 1 and never reset when this happened. By looking into the (protected) code I realized, that this might be the problem. So I simply tried the following: Before reconnecting, I set the variable "g_mqtt_client0.nxd_mqtt_ping_not_responded" to zero. And now it was able to reconnect!
Could you test if this is also helping you?
Best, Pi
Is there anybody from Renesas who could help here? Is this a known bug? Is my workaround feasible?
Thanks!
Hi Jeremy
Is there already some feedback from SSP developers? I am especially interested if the workaround I describe is a possible solution...
Best, Pi.

No, there has been no response for the SSP developers. However, form looikng at the SSP MQTT source code, I would it is a valid workaround until it is fixed in the Expresslogic MQTT client code.

On the inital connect nxd_mqtt_ping_not_responded will be zero.

part of the process of connecting involves creating a threadx timer (_nxd_mqtt_periodic_timer_entry) to periodically check if the ping response has been received :-

When reconnecting after a disconnect because a ping was not received, nxd_mqtt_ping_not_responded will be true and the timer _nxd_mqtt_periodic_timer_entry will potentially signal a disconnect. Setting _nxd_mqtt_periodic_timer_entry to NX_FALSE (0) before the recoonection, means the periodic timer will not signal a disconnect until a ping is not received for that particular connection (rather than the failed ping that caused the previous disconnect).

The offical fix might also do some more cleaning up than just setting _nxd_mqtt_periodic_timer_entry to NX_FALSE (0)

Hi Jeremy
Thanks for your feedback, this helped me a lot. So my fix is working and I can go ahead with it until the problem is fixed within SSP.
But something is confusing me. You write that "_nxd_mqtt_periodic_timer_entry" should be set to NX_FALSE before reconnecting. But this is the timer callback function as I understand? Did I miss something? Or did you mix up the names?
Regards, Pi