ESP32 slow to boot after move to 2.20.0

I’ve noticed that my ESP32 is taking significantly longer to go through the boot process following an update to 2.20.0. It’s so significant that I’m no longer able to call mos commands immediately after a boot - I need to wait 10-15 seconds otherwise it either crashes the ESP32 or just times out.

Here’s an example boot script using 2.18.0:

[May  1 16:18:09.707] mgos_freertos.c:177     iParcelBox_SeedApp 2.1.0 (20220501-151602/ge1fe084-2.1-dirty)
[May  1 16:18:09.714] mgos_freertos.c:179     Mongoose OS 2.18.0 (20220501-151602/2.18.0-g24c520d)
[May  1 16:18:09.721] mgos_freertos.c:183     CPU: 240 MHz, FreeRTOS 8.2.0, heap: 4511664 total, 4412772 free
[May  1 16:18:09.729] mgos_freertos.c:185     Newlib 2.2.0
[May  1 16:18:09.732] esp32_main.c:116        ESP-IDF v3.3-r5
[May  1 16:18:09.736] esp32_main.c:119        Boot partition: app_0; flash: 8M
[May  1 16:18:09.741] mg_lwip_ev_mgr.c:76     Mongoose 6.18, LwIP 2.0.3
[May  1 16:18:09.745] mg_ssl_if_mbedtls.c:56  mbed TLS 2.16.6-cesanta1
[May  1 16:18:09.759] esp32_fs_crypt.c:82     FS encryption key set up, seed @ 0x0
[May  1 16:18:09.766] mgos_vfs_dev.c:73       fs_0: esp32part ({"label": "fs_0"}), size 393216
[May  1 16:18:09.772] mgos_vfs_dev.c:73       fs_1: esp32part ({"label": "fs_1"}), size 393216
[May  1 16:18:09.779] mgos_vfs.c:174          /: LFS @ fs_0, opts {"bs":4096,"is":128}
[May  1 16:18:09.801] mgos_vfs.c:347          /: size 393216, used: 196608, free: 196608
[May  1 16:18:09.820] mgos_sys_config.c:232   Loading conf3.json
[May  1 16:18:09.828] mgos_config_util.c:107  Extra key: [wifi.http]
[May  1 16:18:09.833] mgos_config_util.c:107  Extra key: [wifi.http.enable]
[May  1 16:18:09.838] mgos_config_util.c:107  Extra key: [wifi.http]
[May  1 16:18:09.870] mgos_sys_config.c:307   Switching debug to UART-1
[May  1 16:18:09.973] e[0;32mI (447) phy: phy_version: 4180, cb3948e, Sep 12 2019, 16:39:13, 0, 0e[0m
[May  1 16:18:10.700] pn_uart.c:42            UART Debug Enabled
[May  1 16:18:10.705] Feeding WatchDog
[May  1 16:18:10.707] mgos_init.c:36          Init done, RAM: 4510624 total, 4340404 free, 4340204 min free

And here’s the same thing using 2.20.0:

[May  1 16:06:11.917] mgos_freertos.c:155     iParcelBox_SeedApp 2.1.0 (20220501-150121/ge1fe084-2.1-dirty)
[May  1 16:06:11.924] mgos_freertos.c:157     Mongoose OS 2.20.0 (20220501-150121/2.20.0-g1885c0f-heads/2.20.0)
[May  1 16:06:11.932] mgos_freertos.c:161     CPU: 240 MHz, FreeRTOS 8.2.0, heap: 4526748 total, 4427936 free
[May  1 16:06:11.940] mgos_freertos.c:163     Newlib 3.0.0
[May  1 16:06:11.943] esp32_main.c:65         ESP-IDF 4.2-r8
[May  1 16:06:11.946] esp32_main.c:68         Boot partition: app_0; flash: 8M
[May  1 16:06:11.952] mongoose.c:15766        Mongoose 6.18, LwIP 2.1.3
[May  1 16:06:11.956] mongoose.c:4932         mbed TLS 2.16.11-cesanta1
[May  1 16:06:11.966] esp32_fs_crypt.c:82     FS encryption key set up, seed @ 0x0
[May  1 16:06:11.972] mgos_vfs_dev.c:73       nvs: esp32part ({"label": "nvs"}), size 16384
[May  1 16:06:11.978] mgos_vfs_dev.c:73       otadata: esp32part ({"label": "otadata"}), size 8192
[May  1 16:06:11.985] mgos_vfs_dev.c:73       fs_0: esp32part ({"label": "fs_0"}), size 393216
[May  1 16:06:11.991] mgos_vfs_dev.c:73       fs_1: esp32part ({"label": "fs_1"}), size 393216
[May  1 16:06:11.998] mgos_vfs.c:174          /: LFS @ fs_0, opts {"bs":4096,"is":128}
[May  1 16:06:14.770] mgos_vfs.c:347          /: size 393216, used: 192512, free: 200704
[May  1 16:06:17.176] mgos_sys_config.c:409   Switching debug to UART-1
[May  1 16:06:18.174] pn_uart.c:42            UART Debug Enabled
[May  1 16:06:18.179] Feeding WatchDog
[May  1 16:06:18.181] mgos_init.c:36          Init done, RAM: 4525452 total, 4316092 free, 4315884 min free

As you can see, the process has gone from under 2s to around 7-8 seconds (sometimes it takes much longer).

I’m also quite frequently seeing issues where the boot process then fails, due to Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).

Looks like something is going on with LFS when about to 50% full.
Try latest as it looks like the developers are working on an update to LFS there.