robjordan / gpslogger-esp32

Low-power GPS tracker using ESP32 microcontroller. Unfinished project.
7 stars 1 forks source link

Crash on the (last?) MGA-ANO message, which appears to be short #25

Open robjordan opened 6 years ago

robjordan commented 6 years ago

I (14357) gpslogger: MGA-ANO: 18/04/07: type=0 version=0 svId=26 gnssId=0 I (14357) gpslogger: gps_handle_ubx_message: 78 W (14367) gpslogger: Message id: 0x20 0x13 incomplete.

Guru Meditation Error: Core 0 panic'ed (LoadProhibited) . Exception was unhandled. Core 0 register dump: PC : 0x40130243 PS : 0x00060533 A0 : 0x800e39e8 A1 : 0x3ffba590
0x40130243: find_value at /home/jordan/esp/esp-idf/components/pthread/./pthread_local_storage.c:164

A2 : 0xbfc50a80 A3 : 0x00000002 A4 : 0x3ffc6028 A5 : 0x3ffc6044
A6 : 0x3ffbc839 A7 : 0x3ffc6045 A8 : 0x80089fcb A9 : 0x3ffba570
A10 : 0x3ffbacac A11 : 0x3ffc6028 A12 : 0x00019b6c A13 : 0x3ffc61fc
A14 : 0x3ffc6055 A15 : 0x00000000 SAR : 0x00000019 EXCCAUSE: 0x0000001c
EXCVADDR: 0xbfc50a80 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000000

Backtrace: 0x40130243:0x3ffba590 0x400e39e5:0x3ffba5b0 0x40128b8d:0x3ffba5d0 0x401176db:0x3ffba5f0 0x40117ab5:0x3ffba610 0x4011a52f:0x3ffba650 0x4011aab5:0x3ffba6d0 0x4011ab26:0x3ffba700 0x400ea0b9:0x3ffba720 0x4000bdbb:0x3ffba740 0x400017ea:0x3ffba760 0x400d3264:0x3ffba780 0x400d329d:0x3ffbabe0 0x400d2e26:0x060b13c8 0x40130243: find_value at /home/jordan/esp/esp-idf/components/pthread/./pthread_local_storage.c:164

0x400e39e5: pthread_getspecific at /home/jordan/esp/esp-idf/components/pthread/./pthread_local_storage.c:179

0x40128b8d: sys_thread_sem_get at /home/jordan/esp/esp-idf/components/lwip/port/freertos/sys_arch.c:548

0x401176db: tcpip_apimsg at /home/jordan/esp/esp-idf/components/lwip/api/api_lib.c:830 (discriminator 4)

0x40117ab5: netconn_recved at /home/jordan/esp/esp-idf/components/lwip/api/api_lib.c:830 (discriminator 4)

0x4011a52f: lwip_recvfrom at /home/jordan/esp/esp-idf/components/lwip/api/sockets.c:3309

0x4011aab5: lwip_recvfrom_r at /home/jordan/esp/esp-idf/components/lwip/api/sockets.c:3309

0x4011ab26: lwip_read_r at /home/jordan/esp/esp-idf/components/lwip/api/sockets.c:3309

0x400ea0b9: esp_vfs_read at /home/jordan/esp/esp-idf/components/vfs/./vfs.c:464

0x400d3264: http_get_task at /home/jordan/esp/gpslogger-esp32/main/./http_request.c:227

0x400d329d: http_get_main at /home/jordan/esp/gpslogger-esp32/main/./http_request.c:243

0x400d2e26: app_main at /home/jordan/esp/gpslogger-esp32/main/./main.c:24

robjordan commented 6 years ago

The reason is that a full UBX message was not read on one iteration. Hence the next one didn't start with the signature 0xb5, and the value read from "length" was invalid, causing a read into unallocated storage.

I have prevented the crash (by checking for the 0xb5 signature, but not yet implemented code to re-sync on a proper message start.