espressif / esp-mqtt

ESP32 mqtt component
Apache License 2.0
603 stars 255 forks source link

esp_mqtt_client_stop waits indefinitely (IDFGH-3710) #163

Closed AshUK closed 4 years ago

AshUK commented 4 years ago

Calling esp_mqtt_client_stop inside an MQTT eventloop handle causes the event loop to block.

Its useful to be able to stop and destroy an mqtt instance after a certain event. The work around for now is to notify another task from the MQTT event loop of an event and then call esp_mqtt_client_stop from there.

ESP-Marius commented 4 years ago

Hi @AshUK

I agree that ideally we should be able to call these functions from the event handler. Unfortunately not being able to call stop/destroy functions like this is a limitation for several of components that uses event handlers.

For now we can at least update our documentation to reflect this and implement a check to stop it from deadlocking.

Thanks for reporting this.