adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT

client.loop if the MQTT Broker goes down the loop crashes with OSError: [Errno 104] ECONNRESET

Open
#194 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
81
Forks
52
PR merge metrics
No merged PRs in 30d

Description

In the mqtt_client.loop if the MQTT Broker goes down the loop crashes with OSError: [Errno 104] ECONNRESET. This leaves no way to handle the error in the program. It should return with regular error handling so the program can either wait for the broker to come back online or exit gracefully.

Running:
Adafruit CircuitPython 8.2.9 on 2023-12-06; Adafruit QT Py ESP32-S3 no psram with ESP32S3
Library : adafruit-circuitpython-bundle-8.x-mpy-20231215

Error:
Published to test/qtpy32/status/publish with PID 1
OK Message sent to MQTT Server!

Traceback (most recent call last):
File "code.py", line 201, in
File "adafruit_minimqtt/adafruit_minimqtt.py", line 788, in publish
OSError: [Errno 104] ECONNRESET

See attached txt file for code.py
[code.txt](https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/files/13746213/code.txt)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the publish path around line 788 of adafruit_minimqtt/adafruit_minimqtt.py and reproduce the broker disconnect using the attached code.py. Done means an ECONNRESET during the MQTT operation follows the library's regular error-handling path instead of crashing the program, allowing the caller to recover or exit gracefully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.