The cause proved to be simple. On breaking into the program (and on occasions when it failed with an exception) the socket was not closed. It emerged that an open socket persists even when it is out of scope. In my case, after some time at the REPL, it received data from a test script: since no application was running to access the data the Espressif WiFi stack's buffer filled, provoking the error. This is readily solved with code along these lines:
Code: Select all
try:
my_app.main()
except:
raise # Get debug traceback
finally:
my_app.sock.close()
This behaviour is now referenced in the official docs http://docs.micropython.org/en/latest/e ... neral.html - section "Sockets and WiFi buffers overflow".