Random syntax error on boot (gpy, others?)



  • Hi,

    We're having problems with GPy. Sometimes on boot, a random file will get an "SyntaxError: invalid syntax".

    Example:
    rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (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:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:1728
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14584
    entry 0x400a059c
    VERSION gb-2.0
    Traceback (most recent call last):
    File "boot.py", line 14, in <module>
    ...(more files)
    File "/flash/lib/mqtt.py", line 194
    SyntaxError: invalid syntax
    MicroPython v1.8.6-849-83e2f7f on 2018-03-19; GPy with ESP32

    • This only happens occasionally and after a manual reset the next boot will work again.
    • For us this happens on average every 3 hours (approx 180 deep sleep cycles measuring data every minute), but it can be anything from a few minutes to several days.
    • Usually it's a different file each time having a syntax error, sometimes on line-numbers that doesn't exist (beyond eof).
    • We've tried pc/usb-powered, battery-powered, wall-adapter-powered, makes no difference.

    It seems to be similar with this issue (LoPy):
    https://forum.pycom.io/topic/2876/random-syntax-error-while-booting

    Any idea what's going on? Any workarounds? (We've tried setting a WDT in boot.py, but we're guessing it's only a matter of time (weeks, months?) before boot.py is the file that will have a syntax error and the device will need a manual reset to work again)



  • @xykon that's good news. What is the root cause of the issue?



  • @geir We're still investigating the issue.

    @Xykon any update on the intermittent file read errors?
    I'm observing the issue with v1.18.1.r1.



  • @xykon That's good news :)


  • administrators

    @sympatron The device we tested goes into deepsleep for 60 seconds and then wakes up, which is identical to a reset. With the stable firmware we saw the issue within an hour which is less than 60 resets. The device with the development firmware has now reset 4889 times without presenting the issue.



  • @xykon We only had this issue after resets. Not while running. Maybe because the root cause were wrong reads from flash which is only done once.

    Did you try resetting the device often to see if it always comes up correctly?


  • administrators

    @Sympatron @geir I've now had the LoPy4 running for several days on the development firmware and it hasn't shown the syntax error so far, so I'm cautiously optimistic that the issue has been fixed. We're working on making the development firmware support both FATfs and LittleFS so users can choose at which point they migrate the fs rather than being forced to use LittleFS with the development firmware.


  • administrators

    @sympatron @geir I was now able to replicate the error with a LoPy4 (using LoRa) with the stable firmware 1.18.0. On the other hand using a WiPy3 with WiFi has been working without problems so far. I'm doing the same test with the development firmware, as it's possible this is a bug in the IDF that was fixed recently (the development firmware is using a newer version of the esp-idf sdk). I'll keep you updated.



  • This happend to me multiple times during development (LoPy4). The code does not seem to matter. It just prints a random syntax error although there is none and a reset always fixes it.


  • administrators

    @geir We're still investigating the issue.

    The current workaround is to use the Watchdog Timer. The WDT can be automatically enabled on boot in the pycom module and then reset in main.py

    While you can't disable the WDT once enabled, you can increase the timeout in main.py. This way if the main.py doesn't execute properly for whatever reason, the WDT will expire and force a reset of the board.


 

Hello World?

Pylife on Kickstarter - November 2018








Back Us On Kickstarter >

Pycom on Twitter