File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,3 +122,26 @@ Due to limitations of the ESP8266 chip the internal real-time clock (RTC)
122122will overflow every 7:45h. If a long-term working RTC time is required then
123123``time() `` or ``localtime() `` must be called at least once within 7 hours.
124124MicroPython will then handle the overflow.
125+
126+ Sockets and WiFi buffers overflow
127+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128+
129+ Socket instances remain active until they are explicitly closed. This has two
130+ consequences. Firstly they occupy RAM, so an application which opens sockets
131+ without closing them may eventually run out of memory. Secondly not properly
132+ closed socket can cause the low-level part of the vendor WiFi stack to emit
133+ ``Lmac `` errors. This occurs if data comes in for a socket and is not
134+ processed in a timely manner. This can overflow the WiFi stack input queue
135+ and lead to a deadlock. The only recovery is by a hard reset.
136+
137+ The above may also happen after an application terminates and quits to the REPL
138+ for any reason including an exception. Subsequent arrival of data provokes the
139+ failure with the above error message repeatedly issued. So, sockets should be
140+ closed in any case, regardless whether an application terminates successfully
141+ or by an exeption, for example using try/finally::
142+
143+ sock = socket(...)
144+ try:
145+ # Use sock
146+ finally:
147+ s.close()
You can’t perform that action at this time.
0 commit comments