Azure / azure-iot-arduino

Azure IoT library for the Arduino
Other
168 stars 95 forks source link

ESP8266 LmacRxBlk:1 errors when too many messages are received #75

Open marcinjahn opened 6 years ago

marcinjahn commented 6 years ago

IoT-Hub has a feature of messages retention, which makes it possible to deliver messages even if the receiving device was switched off during messages sending process. Unfortunately it creates a possibility to "crash" the device if it receives too many messages at once.

I'm using ESP8266 (Sparkfun Thing Dev), which is a low-power microcontroller. If I send to it more than around 10 messages when it is switched off, after I power it on, it will crash. Then I can see in a console a messgae: "LmacRxBlk:1" printed every second. The control over device is lost, the only way to fix it is restarting the microcontroller. Unfortunatley after the restart it can again go into "LmacRxBlk:1" loop if there are still some messages uncollected.

Is there any solution for this? I thought that maybe there is some possiblity to change the way of receiving the messages. Instead of setting callback for all messages, maybe it is possible to set callback only for 1 message - after this message would be received the callback would be set again for 1 message, and so on...

Hopefully it is possible to solve it.

JetstreamRoySprowl commented 6 years ago

The SDK queues messages until it can send them, so you may be running out of memory. You can keep the SDK memory consumption lower by not letting the SDK queue messages, and you can do this by waiting for the send complete callback of each message before sending another one.