Crash in (I think) wifi accesspoint scan()

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
markxr
Posts: 62
Joined: Wed Jun 01, 2016 3:41 pm

Crash in (I think) wifi accesspoint scan()

Post by markxr » Sat Jun 04, 2016 7:45 pm

Hi,

My device is crashing and rebooting, although not very often, possibly inside the scan() function.

I can't reproduce this when it's just sitting at home, it obviously happens in certain geographical locations more than others. Perhaps there is a bad wifi packet which is killing it. Perhaps a some accesspoints send back a bad response which confuses it.

In each case, the device reboots with a reset_cause of exception (I think).

Is there any way I can easily debug it? I can't make this happen in a controlled environment.

One possibility is to attach a 2nd esp8266 (or something else) with the rx/tx swapped and have it log the output (or from uart 1?) into its flash, but that doesn't help if I don't get useful debug info.

The thing which crashes it, might of course not be inside scan(), but some asynchronous wifi callback thing.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Crash in (I think) wifi accesspoint scan()

Post by pfalcon » Sun Jun 05, 2016 9:09 am

Unless it's strlen() issue which you fixed, it may be another manifestation of https://github.com/micropython/micropython/issues/1946 . We need a better crash handler, e.g. port one from esp-open-rtos. If you're up to *real* reverse engineering, mind the tools specifically made for that: https://github.com/pfalcon/ScratchABit , https://github.com/pfalcon/ScratchABlock
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

markxr
Posts: 62
Joined: Wed Jun 01, 2016 3:41 pm

Re: Crash in (I think) wifi accesspoint scan()

Post by markxr » Sun Jun 05, 2016 1:07 pm

It does not appear to be the strlen() issue. I think it's probably the same as #1946.

The strlen() issue did overrun the buffer, but usually only by a few bytes and not into an illegal area of memory, so I don't think it often caused a problem (except for returning incorrect data, of course). Plus there aren't many accesspoints with 32 byte ssid.

I'll see if I can simulate a large number of accesspoints and reproduce it.

markxr
Posts: 62
Joined: Wed Jun 01, 2016 3:41 pm

Re: Crash in (I think) wifi accesspoint scan()

Post by markxr » Mon Jun 06, 2016 6:19 pm

In the latest version of the SDK, release notes, it says they (Expressif) have apparently fixed this issue:

" The ESP8266 maybe reset if connected to a special router."

http://bbs.espressif.com/viewtopic.php?f=46&t=2198

This could well be the same thing, and for micropython bug #1946

Post Reply