ESP8266 mDash

The ESP8266 crashes when using the library “api_aws.js” or “api_mqtt.js” after successfully connecting to the AWS IoT server and receiving a “curve 3” response. This only happens when you register the device with mDash using “api_dash.js”

NB The are no such problems with any combination of these libraries using the ESP32.

[May 17 11:21:07.313] SW ECDH curve 3
[May 17 11:21:14.014] E:M 32 (5 blocks)
[May 17 11:21:14.016]
[May 17 11:21:14.016] Exception 29 @ 0x4000e1b2, vaddr 0x00000000
[May 17 11:21:14.020] A0: 0x402919ab A1: 0x3ffff7a0 A2: 0x00000000 A3: 0x00000000
[May 17 11:21:14.026] A4: 0x00000020 A5: 0x00000000 A6: 0x00000020 A7: 0x00000002
[May 17 11:21:14.031] A8: 0x3ffe83cc A9: 0x00000190 A10: 0x00000000 A11: 0x0000007c
[May 17 11:21:14.037] A12: 0x00000000 A13: 0x00000020 A14: 0x00000001 A15: 0x3ffff830
[May 17 11:21:14.047]
[May 17 11:21:14.047] (exc SP: 0x3ffff600)
[May 17 11:21:14.047]
[May 17 11:21:14.047] — BEGIN CORE DUMP —
[May 17 11:21:14.047] mos: catching core dump

This also happens when you use the demo code (https://github.com/mongoose-os-apps/demo-js) and compile with Mongoose OS command line tool Version: 2.13.1

Does anyone have any solutions for this situation?

[May 17 11:21:14.014] E:M 32 (5 blocks)

You are out of RAM.
Before connecting to AWS, make sure you have at minimum ~30k free RAM.

Thanks, we will free up some ram and test.

Hi, SO we have installed the Mongoose demo code on the ESP8266 and we are still getting issues with the core dump.

[May 19 21:58:13.583] mgos_net.c:101 WiFi STA: ready, IP 192.168.254.174, GW 192.168.254.254, DNS 192.168.254.254
[May 19 21:58:13.592] mgos_provision_state:43 Current state: 1 -> 2
[May 19 21:58:13.599] mgos_rpc_channel_ws:260 0x3fff0e14 Connecting to wss://dash.mongoose-os.com/api/v2/rpc, SSL? 1
[May 19 21:58:13.618] mgos_mqtt.c:427 MQTT connecting to a1k3q7ebae2sxe-ats.iot.us-east-1.amazonaws.com:8883
[May 19 21:58:13.660] mgos_mongoose.c:66 New heap free LWM: 19800
[May 19 21:58:13.886] mgos_mongoose.c:66 New heap free LWM: 17432
[May 19 21:58:13.894] mg_ssl_if_mbedtls.c:35 0x3fff3184 ciphersuite: TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256
[May 19 21:58:14.376] E:M 264 (34 blocks)
[May 19 21:58:14.376]
[May 19 21:58:14.376] Exception 29 @ 0x4000e1b2, vaddr 0x00000000
[May 19 21:58:14.383] A0: 0x402972b3 A1: 0x3ffff1b0 A2: 0x00000000 A3: 0x00000000
[May 19 21:58:14.389] A4: 0x00000108 A5: 0x00000000 A6: 0x00000100 A7: 0x00000010
[May 19 21:58:14.393] A8: 0x3ffe83cc A9: 0x00000190 A10: 0x00000000 A11: 0x0000007c
[May 19 21:58:14.398] A12: 0x00000000 A13: 0x00000108 A14: 0x00000003 A15: 0x3ffff240
[May 19 21:58:14.410]
[May 19 21:58:14.410] (exc SP: 0x3ffff010)
[May 19 21:58:14.410]
[May 19 21:58:14.410] — BEGIN CORE DUMP —
[May 19 21:58:14.410] mos: catching core dump
[May 19 21:58:17.249] …read err EOF

Confirmed, the pre-built demo-js firmware crashes with out-of-memory when connecting to AWS IoT.
Apparently, some latest changes in Mongoose OS libraries increased RAM consumption. Could you dump a list of libraries you’re using in your firmware please?

Hi,
I am getting the memory error on the unmodified demo.js example found here:

Here are the unaltered libraries that the demo mos.yml
libs:

Here are the unaltered APIs that are loaded in the demos init.js

load(‘api_aws.js’);
load(‘api_azure.js’);
load(‘api_config.js’);
load(‘api_dash.js’);
load(‘api_events.js’);
load(‘api_gcp.js’);
load(‘api_gpio.js’);
load(‘api_mqtt.js’);
load(‘api_shadow.js’);
load(‘api_timer.js’);
load(‘api_sys.js’);
load('api_watson.js’);

Here us a dump of the file system:
$ mos ls
api_adc.js
api_arch_uart.js
api_aws.js
api_aws.jsc
api_azure.js
api_azure.jsc
api_bitbang.js
api_config.js
api_config.jsc
api_dash.js
api_dash.jsc
api_dataview.js
api_dht.js
api_esp8266.js
api_events.js
api_events.jsc
api_file.js
api_gcp.js
api_gcp.jsc
api_gpio.js
api_gpio.jsc
api_http.js
api_i2c.js
api_log.js
api_math.js
api_math.jsc
api_mqtt.js
api_mqtt.jsc
api_neopixel.js
api_net.js
api_ota.js
api_pwm.js
api_rpc.js
api_shadow.js
api_shadow.jsc
api_spi.js
api_sys.js
api_sys.jsc
api_timer.js
api_timer.jsc
api_uart.js
api_watson.js
api_watson.jsc
api_wifi.js
ca.pem
conf0.json
init.js
init.jsc

Yeah, that’s clear, thank you! We’re looking at the issue.

The problem was tracked down to the AWS IoT cloud being changed on-site certificates, which increased the RAM consumption on a device during TLS handshake.
So that was unrelated to any device-side changes.
However, optimised RAM usage during handshake, and that fixed an issue.