8000 Occasional MemoryError during Adafruit IO loop() · Issue #101 · adafruit/Adafruit_CircuitPython_MiniMQTT · GitHub
[go: up one dir, main page]

Skip to content
Occasional MemoryError during Adafruit IO loop() #101
Closed
@calcut

Description

@calcut

Adafruit CircuitPython 7.1.1 on 2022-01-14; Adafruit Feather ESP32S2 with ESP32S2

Circup freeze:
Found device at /Volumes/CIRCUITPY, running CircuitPython 7.1.1.
adafruit_datetime==1.1.6
adafruit_htu31d==1.1.3
adafruit_requests==1.10.6
adafruit_ticks==1.0.1
neopixel==6.2.4
adafruit_bus_device==5.1.4
adafruit_io==5.6.1
adafruit_logging==3.7.5
adafruit_minimqtt==5.2.1
adafruit_register==1.9.8

ERROR Traceback (most recent call last):
  File "mcu.py", line 304, in aio_receive
  File "adafruit_io/adafruit_io.py", line 233, in loop
  File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 805, in loop
  File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 854, in _wait_for_msg
  File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 906, in _sock_exact_recv
MemoryError: memory allocation failed, allocating 4294953983 bytes

I'm running io.loop(timeout=0.1) in mcy.py, line 304
Normally this works fine, but every few minutes I get the above exception.
If I ignore the exception, the code continues to run with no obvious issues, but I wanted to report it anyway.

digging into adafruit_minimqtt.py, and adding a print(bufsize) shows me that the error on line 906 occurs when bufsize is less than zero. e.g. -13313. So I can see how the code ended up trying to allocate ~4GB of memory (2^32-13313)

I also notice that the bufsize immediately before the negative one is large and positive e.g. 13365

I could try harder to make a minimum reproducable example if needed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0