Description
We have an implementation of MiniMQTT that has been quite stable in CircuitPython 8 but started to display multiple issues when we tested in CircuitPython 9 (9.0.3 and below) on multiple ESP32-S3 boards.
The code base sends some API requests over HTTP GET/POST using the Adafruit_CircuitPython_Requests
library (with no issues) and then continues on to connect to the MQTT server over SSL to send sensor observations every few seconds. We tried updating to use adafruit_connection_manager
for socket_pool
and ssl_context
but this does not seem to fix the issue. We also tried to run a reconnect()
on errors as described in #194 but no luck. It is interesting because sometimes the code runs fine for an hour or more but then most often it causes errors within the first few minutes if not immediately.
We tried various bundles both with *.py
source code, *.mpy
bundle pre-built and self-built *.mpy
variations with no luck and similar observations. The bundle dates we have tried out are : 20240402
, 20240307
and 20240224
.
The most common errors seen (but not necessarily together) are :
OSError(11,)
OSError(104,)
MemoryError()
MMQTTException('Repeated connect failures',)
Less Common Errors (maybe stemming from the common errors above ? ) :
OSError(128,)
<WatchDogTimeout>
gaierror(-2, 'Name or service not known')
Sample Code :
import wifi
import adafruit_minimqtt.adafruit_minimqtt as MQTT
radio = wifi.radio
pool = adafruit_connection_manager.get_radio_socketpool(radio)
ssl_context = adafruit_connection_manager.get_radio_ssl_context(radio)
mqtt = MQTT.MQTT(
broker=...,
port=...,
is_ssl=True,
socket_pool=pool,
ssl_context=ssl_context,
username=...,
password=...,
)
try:
mqtt.publish(topic, message)
except:
mqtt.reconnect()
Are there any additional debugging steps that we can try out or are there other things we should consider when upgrading to CP9? Thank you!