uMQTTBroker
uMQTTBroker copied to clipboard
ESP8266 crashing on data received
Hello, I am having trouble with my ESP8266 crashing when data is received by the broker.
Here is all the information I have, if you need anything more specific let me know, any help would be appreciated.
Payload
{
"o": "AA",
"d": "AA",
"s": "AAA",
"p": "AAA"
}
Exception
Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
PC: 0x40209805: uMQTTBroker::_onData(unsigned int*, char const*, unsigned int, char const*, unsigned int) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 30
EXCVADDR: 0x00000012
Decoding stack results
0x402097f5: uMQTTBroker::_onData(unsigned int*, char const*, unsigned int, char const*, unsigned int) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 29
0x4021c542: new_linkoutput at glue-lwip/lwip-git.c line 260
0x4021cae4: ethernet_output at netif/ethernet.c line 312
0x40215340: uMQTTBroker::onAuth(String, String, String) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 59
0x40100c6f: free(void*) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 398
0x402097cc: uMQTTBroker::_onData(unsigned int*, char const*, unsigned int, char const*, unsigned int) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 26
0x40236c58: publish_topic at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\mqtt_server.c line 65
0x40100ca4: malloc(size_t) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 552
0x40237d34: find_topic at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\mqtt_topiclist.c line 73
0x40236c1c: publish_topic at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\mqtt_server.c line 58
0x40237984: MQTT_ClientCon_recv_cb at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\mqtt_server.c line 351
0x402267bc: mem_malloc at core/mem.c line 210
0x40225d10: ip4_output_if_opt at core/ipv4/ip4.c line 1577
0x40221101: tcp_create_segment at core/tcp_out.c line 190
0x40225d36: ip4_output_if at core/ipv4/ip4.c line 1550
0x402268c7: ip_chksum_pseudo at core/inet_chksum.c line 395
0x40221e16: tcp_output at core/tcp_out.c line 1361
0x4010017c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 177
0x4010017c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 177
0x4023f12f: espconn_sent at glue-lwip/espconn.c line 421
0x4010015b: ets_intr_unlock() at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 163
0x40220299: pbuf_free_LWIP2 at core/pbuf.c line 726
0x4021c551: new_linkoutput at glue-lwip/lwip-git.c line 265
0x4010017c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 177
0x4021c2b5: glue2esp_linkoutput at glue-esp/lwip-esp.c line 301
0x4021c542: new_linkoutput at glue-lwip/lwip-git.c line 260
0x4021cae4: ethernet_output at netif/ethernet.c line 312
0x40224280: etharp_output_to_arp_index at core/ipv4/etharp.c line 770
0x4010017c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 177
0x402244d4: etharp_output_LWIP2 at core/ipv4/etharp.c line 885
0x4010017c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 177
0x4010017c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 177
0x401009eb: umm_free_core(void*) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 351
0x40100c6f: free(void*) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 398
0x40100ca4: malloc(size_t) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 552
0x402267dc: mem_free at core/mem.c line 237
0x40100f02: calloc(size_t, size_t) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 908
0x4023fad5: espconn_server_recv at glue-lwip/espconn_tcp.c line 1189
0x4021ffc8: tcp_input at core/tcp_in.c line 501
0x4010060c: pvPortMalloc(size_t, char const*, int) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\heap.cpp line 271
0x40225a66: ip4_input at core/ipv4/ip4.c line 1467
0x40100c6f: free(void*) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 398
0x4021ca59: ethernet_input_LWIP2 at netif/ethernet.c line 188
0x4021c6f4: esp2glue_ethernet_input at glue-lwip/lwip-git.c line 469
0x4023e3de: ethernet_input at glue-esp/lwip-esp.c line 365
0x4023e3ef: ethernet_input at glue-esp/lwip-esp.c line 373
0x4010060c: pvPortMalloc(size_t, char const*, int) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\heap.cpp line 271
0x4021c2b5: glue2esp_linkoutput at glue-esp/lwip-esp.c line 301
0x40100ca4: malloc(size_t) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 552
0x4021c542: new_linkoutput at glue-lwip/lwip-git.c line 260
0x4021cae4: ethernet_output at netif/ethernet.c line 312
0x40223f78: etharp_raw at core/ipv4/etharp.c line 1165
0x4022416e: etharp_request at core/ipv4/etharp.c line 1202
0x402207e2: netif_issue_reports at core/netif.c line 916
0x40220888: netif_set_addr_LWIP2 at core/netif.c line 717
Sample class
class TestMqttBroker: public uMQTTBroker
{
public:
virtual bool onConnect(IPAddress addr, uint16_t client_count) {
// Serial.println(addr.toString()+" connected");
return true;
}
virtual void onDisconnect(IPAddress addr, String client_id) {
// Serial.println(addr.toString()+" ("+client_id+") disconnected");
}
virtual void onData(String topic, const char *data, uint32_t length) {
}
};
Maybe a stack issue - could you try to replace the _onData function in uMQTTBroker.cpp with this version:
void uMQTTBroker::_onData(uint32_t *args, const char* topic, uint32_t topic_len, const char *data, uint32_t length) {
char *topic_str;
if ((topic_str = (char *)malloc(topic_len+1)) == NULL)
return;
os_memcpy(topic_str, topic, topic_len);
topic_str[topic_len] = '\0';
TheBroker->onData((String)topic_str, data, length);
free(topic_str);
}
Same-ish error
Ill keep looking on my end.
Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
PC: 0x40209292: uMQTTBroker::_onData(unsigned int*, char const*, unsigned int, char const*, unsigned int) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 33
EXCVADDR: 0x666e6f6f
Decoding stack results
0x40209282: uMQTTBroker::_onData(unsigned int*, char const*, unsigned int, char const*, unsigned int) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 32
0x40209254: uMQTTBroker::_onData(unsigned int*, char const*, unsigned int, char const*, unsigned int) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 25
0x40209274: uMQTTBroker::_onData(unsigned int*, char const*, unsigned int, char const*, unsigned int) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 28
0x4021c67c: ethernet_output at netif/ethernet.c line 312
0x40101238: umm_poison_free_fl(void*, char const*, int) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc/umm_local.c line 149
0x40209254: uMQTTBroker::_onData(unsigned int*, char const*, unsigned int, char const*, unsigned int) at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\uMQTTBroker.cpp line 25
0x402367f0: publish_topic at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\mqtt_server.c line 65
0x40100f49: check_poison_neighbors(uint16_t) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc/umm_local.c line 71
0x40101005: umm_malloc_core(size_t) at C:\Users\agierens\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 458
0x402378cc: find_topic at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\mqtt_topiclist.c line 73
0x402367b4: publish_topic at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\mqtt_server.c line 58
0x4023751c: MQTT_ClientCon_recv_cb at C:\Users\agierens\Documents\Arduino\libraries\uMQTTBroker-master\src\mqtt_server.c line 351
Seems to be in the copying of the topic string. Anything special with your topic str?
Nope, I just call subscribe("configure")
hi Andrew, which tool are you using to decode the stack? I have the some tool 'ESP decoder' (sorry, don't have the name at hand now) which seems to work for esp32, but maybe not usable for esp8266 stacks. thanks in advance, pottendo
I use https://github.com/me-no-dev/EspExceptionDecoder
Seems to look to work for ESP8266? Let me know if you want anymore info, sorry just a bit confused by your question
Hi, i am also facing the same issue, could you please share how you resolved the issue? thanks
Hi,I've changed the architecture and use a RPi as Broker now.The 8266 ist the just the mqtt client, which works reasonably stable.Bye martinAm 10.03.2022 09:48 schrieb navdeepssidhu @.***>: Hi, i am also facing the same issue, could you please share how you resolved the issue? thanks
—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>
Thanks for the suggestion. I am interested in ESP broker (connected to cloud through GSM module) and would like to connect couple of Tasmota devices. Any help would be appreciated. Thanks
hi,
as the 8266 broker wasn't too stable, I've evaluated a public offering: https://myqtthub.com/en
depending on the volume, it's free (which worked for me for a while). It offers secure connections; though the memory footprint on your uController is then severely challenged, as it a 30k+ usage when using mqtts over WiFiClientSecure. This can be an issue on the esp8266.
As you're connected via GSM, this may be an alternative.
At the time (1+ year ago), I didn't find an emebedded mqtt-broker in the arduino framework other than martin's. Unfortunately porting this to e.g. an esp32 (to be more flexible wrt. memory) is not straight forward and the 8266 version isn't stable enough for production - at least in my case.
As already said; I've put a RPi (std. distro) in the same WiFi acting as mqtt-broker (mosquitto) and have all uControllers connect as mqtt clients; there are plenty clients around; normally i use the simple (very stable) PubSubClient.
If you use a public cloud service, you may check if one can't host a mqtt-broker there.
bye, martin
On 3/10/22 15:04, navdeepssidhu wrote:
Thanks for the suggestion. I am interested in ESP broker (connected to cloud through GSM module) and would like to connect couple of Tasmota devices. Any help would be appreciated. Thanks
— Reply to this email directly, view it on GitHub https://github.com/martin-ger/uMQTTBroker/issues/51#issuecomment-1064097748, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO43X2NQHWM7VSPYH7WJJCLU7H6ODANCNFSM4VVAZGFA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
Hi, i am also facing the same issue, could you please share how you resolved the issue? thanks
Hi, i am also facing the same issue, could you please share how you resolved the issue? thanks )))))