espressif / esp-aws-iot

AWS IoT SDK for ESP32 based chipsets
Apache License 2.0
256 stars 154 forks source link

MQTT_Connect function trigger task watchdog (CA-283) #174

Open zhouyu2021 opened 1 year ago

zhouyu2021 commented 1 year ago

If network condition not good, “MQTT_Connect” will cost more time, it wait for ack in block mode, no doubt it will trigger the task watchdog.

SolidStateLEDLighting commented 1 year ago

I have this call at the top of a code block which is runs in a task loop -- and I have never had a watchdog timeout at this location. I think you'll not see a WD timeout if you just handle the return code. However, I do want to point out that I don't wait around inside that call. The more often you are servicing the process loop, the faster you can receive or send your messages.

{ mqttStatus = MQTT_ProcessLoop(&_mqttContext, 0);

// handle all the possible results here or move to next mode of operation to send...etc. vTaskDelay(pdMS_TO_TICKS(50)); }

In my experience, the MQTT_Connect() call will return with something like -- MQTTRecvFailed if you are somehow disconnected by the network.