adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT

behavior change, now I get timeouts on ping

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

Description

Hi,
I've got a v7 running on a red featherwing, loaded with minimqtt from the v7 bundle around december 2022
and a v8 running on a black featherwing, loaded with minimqtt from the v8 bundle

The v7 with an earlier version of minimqtt runs w/o ping timeouts if I'm waiting and doing nothing

The v8 does this, after a short period of time:
File "code.py", line 1776, in
File "adafruit_minimqtt/adafruit_minimqtt.py", line 1007, in loop
File "adafruit_minimqtt/adafruit_minimqtt.py", line 1030, in _wait_for_msg
File "adafruit_minimqtt/adafruit_minimqtt.py", line 1126, in _sock_exact_recv
MMQTTException: Unable to receive 1 bytes within 60 seconds.

The problem I see is that the exception, in response to a ping should be handled in the ping,
which has its own timeout handling code, which is never reached but even if it were,
would also raise an unhandled exception if it did.
Or in the loop that contains the ping and return an error code for the app to receive and
figure out what to do.

questions:
1. why does the earlier version of minimqtt not have this problem?
2. in any case, why aren't ping timeout exceptions handled and rather than return an exception
thatis, return an error code that can be handled as to whether the app wants to restart or not,
and be accurate in that the problem is a ping timeout rather than an "expected 1 byte(s)" timeout

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in adafruit_minimqtt/adafruit_minimqtt.py at loop(), _wait_for_msg(), and _sock_exact_recv(), then compare the v7 and v8 behavior described in the report. Reproduce the idle ping timeout and define done as handling it with an accurate, application-visible result rather than the generic receive exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.