feat: MQTT retry (clamped) exponential backoff? #167

Closed
opened 2026-10-05 02:01:33 +02:00 by adam · 0 comments
Owner

LetsMesh EU seems to be having problems (for me) today, and I see the reconnect notification constantly...

    "2026-04-28 05:33:04 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n  File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n    async with aiomqtt.Client(**client_kwargs) as client:\n               ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n    raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded",
    "2026-04-28 05:34:04 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n  File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n    async with aiomqtt.Client(**client_kwargs) as client:\n               ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n    raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded",
    "2026-04-28 05:35:04 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n  File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n    async with aiomqtt.Client(**client_kwargs) as client:\n               ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n    raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded",
...
    "2026-04-28 16:12:29 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n  File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n    async with aiomqtt.Client(**client_kwargs) as client:\n               ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n    raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded",
    "2026-04-28 16:13:29 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n  File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n    async with aiomqtt.Client(**client_kwargs) as client:\n               ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n    raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded"

Retrying a few times with minute intervals sounds fine to handle spurious issues.
But when there's extended downtime, every minute gets rather tiresome.

LetsMesh EU seems to be having problems (for me) today, and I see the reconnect notification constantly... ``` "2026-04-28 05:33:04 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n async with aiomqtt.Client(**client_kwargs) as client:\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded", "2026-04-28 05:34:04 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n async with aiomqtt.Client(**client_kwargs) as client:\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded", "2026-04-28 05:35:04 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n async with aiomqtt.Client(**client_kwargs) as client:\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded", ... "2026-04-28 16:12:29 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n async with aiomqtt.Client(**client_kwargs) as client:\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded", "2026-04-28 16:13:29 - app.fanout.mqtt_base - WARNING - Community MQTT [LetsMesh (EU)] connection error. This is usually transient network noise; if it self-resolves, it is generally not a concern: WebSocket handshake error, connection not upgraded (reconnecting in 60s). If this error persists, check your network connection and MQTT broker status.\nTraceback (most recent call last):\n File \"/app/app/fanout/mqtt_base.py\", line 216, in _connection_loop\n async with aiomqtt.Client(**client_kwargs) as client:\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.13/site-packages/aiomqtt/client.py\", line 783, in __aenter__\n raise MqttError(str(exc)) from None\naiomqtt.exceptions.MqttError: WebSocket handshake error, connection not upgraded" ``` Retrying a few times with minute intervals sounds fine to handle spurious issues. But when there's extended downtime, every minute gets rather tiresome. <!-- github-sync-id:4344665886 -->
adam closed this issue 2026-10-05 02:01:33 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Remote-Terminal-for-MeshCore#167