lfs2: crash in lfs2_pair_cmp
I'm getting sometimes persistent crashes on an esp32 running master post v1.13. It happens when closing a just-written file. I'm not sure what to do about it yet, posting here in case others bump into the same thing.
The backtrace is:
PC: 0x401c1a7f: lfs2_pair_cmp at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../lib/littlefs/lfs2.c:267
BT-0: 0x401c1a7c: lfs2_pair_cmp at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../lib/littlefs/lfs2.c:266
BT-1: 0x400ff4c2: lfs2_dir_commit at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../lib/littlefs/lfs2.c:1829 (discriminator 1)
BT-2: 0x400fff69: lfs2_file_rawsync at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../lib/littlefs/lfs2.c:2841
BT-3: 0x400fff91: lfs2_file_rawclose at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../lib/littlefs/lfs2.c:2622
BT-4: 0x401007c1: lfs2_file_close at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../lib/littlefs/lfs2.c:5091
BT-5: 0x400f5e40: mp_vfs_lfs2_file_ioctl at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../extmod/vfs_lfsx_file.c:190
BT-6: 0x400e9add: mp_stream_close at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../py/stream.c:422
BT-7: 0x400e387a: fun_builtin_1_call at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../py/objfun.c:71
BT-8: 0x400df8cd: mp_call_function_n_kw at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../py/runtime.c:650
BT-9: 0x400df9fa: mp_call_method_n_kw at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../py/runtime.c:666
BT-10: 0x400ed4e9: mp_execute_bytecode at /home/src/esp32/mpy-1.13/micropython/ports/esp32/../../py/vm.c:1085
The exception is (LoadProhibited). Exception was unhandled. and the exception address is 0x17f8
Micropython 1.19.1 crashes on ESP32
I'm running MicroPython v1.19.1 on a ESP32 board. Sometimes, after a soft-reset of the device, the device start running but immediately crashes with the following message. The second reboot succeeds.
The device has an sdcard module (SPI), and I2S board connected. It uses the bluetooth (although I'm not sure if it kicks in before it shuts down). Other connections seem harmless (switches, leds, ...). The code will basically read WAV files from the sdcard and play through I2S.
The crash doesn't happen all the times, and I couldn't replicate exactly, but I suspect it has something to do with open filehandles. I'm basically deinit-ing SPI and I2S before shutting down, but if it seems related I can double check that there is no other exception flow that I'm missing.
The main problem is that I don't understand this message so have no idea where to look for solutions. Can anyone help understanding what's going on?
/home/micropython/esp-idf-v4.2/components/freertos/queue.c:1462 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x40097282 on core 1
Backtrace:0x40093b5e:0x3ffcc9c0 0x400942d5:0x3ffcc9e0 0x40097f26:0x3ffcca00 0x40097282:0x3ffcca70 0x400d5ca9:0x3ffccab0 0x400ea8d0:0x3ffccae0 0x400eab52:0x3ffccb10 0x400eac06:0x3ffccb30 0x400dbdd3:0x3ffccb50 0x400e2679:0x3ffccb80 0x400e27a9:0x3ffccba0 0x40084789:0x3ffccbc0 0x400dbd66:0x3ffccc60 0x400e2679:0x3ffccc90 0x400e27a9:0x3ffcccb0 0x40084789:0x3ffcccd0 0x400dbd66:0x3ffccd70 0x400e2679:0x3ffccda0 0x400846f6:0x3ffccdc0 0x400dbd66:0x3ffcce60 0x400e2679:0x3ffccec0 0x400e27a9:0x3ffccee0 0x40084789:0x3ffccf00 0x400dbd66:0x3ffccfa0 0x400e2679:0x3ffcd010 0x400e27a9:0x3ffcd030 0x40084789:0x3ffcd050 0x400dbd66:0x3ffcd0f0 0x400e2679:0x3ffcd120 0x400e27a9:0x3ffcd140 0x40084789:0x3ffcd160 0x400dbd66:0x3ffcd200 0x400e2679:0x3ffcd260 0x400e26a2:0x3ffcd280 0x400efbca:0x3ffcd2a0 0x400eff71:0x3ffcd330 0x400d4cea:0x3ffcd350
ELF file SHA256: 00495403985fb7e0
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12344
ho 0 tail 12 room 4
load:0x40080400,len:4124
entry 0x40080680