Skip to content

Commit 6ede921

Browse files
peterhinchpfalcon
authored andcommitted
eps8266/general: Add known issue of WiFi RX buffers overflow.
1 parent 8c9e22c commit 6ede921

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/esp8266/general.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,26 @@ Due to limitations of the ESP8266 chip the internal real-time clock (RTC)
122122
will 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.
124124
MicroPython 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()

0 commit comments

Comments
 (0)