Adafruit_CircuitPython_MiniMQTT icon indicating copy to clipboard operation
Adafruit_CircuitPython_MiniMQTT copied to clipboard

behavior change, now I get timeouts on ping

Open schaefer01 opened this issue 1 year ago • 19 comments

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

schaefer01 avatar Aug 29 '23 17:08 schaefer01