eclipse / paho.mqtt.embedded-c

Paho MQTT C client library for embedded systems. Paho is an Eclipse IoT project (https://iot.eclipse.org/)

Home Page:https://eclipse.org/paho

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Synchronous publish always forces watchdog reset on NodeMCU (split of issue #200)

pirlite2 opened this issue · comments

Hi
I have been using Paho C++ via MQTTClient within PlatformIO to produce a NodeMCU-based system to communicate synchronously with a mosquitto broker on a Linux Mint PC.

The NodeMCU soft watchdog triggers after 20 (and always 20) outbound messages for all QoS levels, 0 to 2. I have liberally scattered the code with dog feeding statements and the issue seems to be the blocking publish method not returning (soon enough?) on the 20th invocation. This sounds like a full buffer problem? To repeat: this happens for all QoSs so even for messages that are getting delivered.

Anybody any comments/suggestions on this?

Peter

OK. I have run down this problem (but it's raised another one - posted in another issue).

My problem was that I have a loop that i) checks the MQTT client is connected, if not reconnects, ii) publishes something, iii) waits 2 seconds, and repeats. What was happening was that every time round the loop the connection is dropped and reconnect is called every single time. (I am surprised by this! Is this the expected behaviour?)

Basically, after 14-16 attempts at reconnecting, the while-loop in sendPacket gets stuck and the NodeMCU watchdog trips. Simple fix to add a feed for the NodeMCU watchdog in the while-loop and then this is free to follow the intended behaviour of timing out. Except after 14-16 good connections, it fails to connect to the broker and times out. One problem down (the watchdog tripping). Next problem: why is the connect failing?