Bug: JSON.parse(undefined) reboots the ESP8266 #6282
Replies: 1 comment
-
Posted at 2019-08-25 by AkosLukacs (argh, forum ate a longer response, so just a short answer now:) Works on my machine :) My machine now includes ESP8266, ESP32, nRF52. JSON.parse(undefined) doesn't cause a reboot. Even tried this on an ESP8266 (with save to flash)
Output:
And works just fine. Posted at 2019-08-25 by @allObjects @maze1980, it is very difficult to respond to conversations with such titles and with no details / context of the code and even less of the hardware... Main issue with most platforms - and especially non-Espruino boards - is that it matters what the setup is and happened before you issue save(), for example: is there level 0 code that creates things other than code objects... It is always good practice to have nothing set - such as pin modes - or activated - such as timeouts, intervals, connects, etc - except in onInit(). A tanking - rebooting -ESP866 has usually two root causes:
Posted at 2019-08-25 by maze1980 I flashed the device with "espruino_2v04_esp8266_4mb_combined_4096.bin".
Posted at 2019-08-25 by AkosLukacs Ok, looks like the 2v04 "_4mb" build crashes.
-> works
-> works
-> crashes
-> works Posted at 2019-08-25 by @allObjects Interesting... and even the board matters... (assuming the commit is for the built code..., which is the same for the latter two). Posted at 2019-08-25 by @allObjects I know that this conversation is in the 8266 realm, but - for curiosity - I just tested on a PICO, and that is what I get:
...comparable what the (Chrome) browser JS Engine throws at me: see attached screen shot (...but is for sure not a crash of the system / HW). Workaround is asking if undefined before parsing... (try catch does not help)... Attachments: Posted at 2019-08-26 by maze1980 I've now included a test for undefined in my code,it is fixed for me. Another bug is this one (directly after erase and flash):
Do you have the same on the ESP8266 4MB build? It doesn't affect the JSON.parse. Posted at 2019-08-27 by @gfwilliams @MaBecker could this be related to the compile flags used in the 4MB ESP8266 build? Posted at 2019-08-27 by @MaBecker Just checked - Yes - reopened #1679 to fix it. Posted at 2019-08-28 by @gfwilliams Thanks! I've just applied that fix so cutting edge builds should now work ok |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-08-25 by maze1980
I had similar code in
onInit()
:Instantly after
save()
my ESP8266 went into a reset loop.Is it a specific ESP8266 bug, or is it a general bug?
Beta Was this translation helpful? Give feedback.
All reactions