ESP32-C6 stop responding #16133
Replies: 4 comments
-
If your MQTT connection is not handled properly (e.g., no keep-alive mechanism), the connection might drop after some time without sending heartbeats. |
Beta Was this translation helpful? Give feedback.
-
Use the |
Beta Was this translation helpful? Give feedback.
-
There are a few reasons why an MQTT link can die. The handling of MQTT PING packets is one which can cause the broke to disconnect (as per @bidrohini). Another cause is that WiFi links can suffer brief outages - the official MQTT clients do not recover after an outage. This asynchronous client does. |
Beta Was this translation helpful? Give feedback.
-
Sorry for this late response... I was facing WiFi network problems. Once it got the WiFi fixed, then the problem disappeared. It is running for over 15 hours now and, in the last 85,000 reads from the serial and sent via MQTT, I didn't have any problem so far. So, is is more like that the MQTT client does not deal well with network problems. My MQTT send message function, that is called from main() loop, was:
As it can be seen, I call it, send the message and close it for every single message. In my mind, this would prevent any "memory leak" the MQTT client could have. Anyway, even having a mistake on the code, it should print an error message if the MQTT client fails somehow. This brings the question is: if I have an try/except on the function, why it does catch when something goes wrong? |
Beta Was this translation helpful? Give feedback.
-
On my main.py I got a "while True" where I read RS485 data, send it via MQTT and write them to a file every 15 minutes. I Also print some of the information on the REPL. I do one RS485 read per second. Now, after running for a while it will stop printing data but will keep sending MQTT. After one or two hours it will also stop sending MQTT messages. However, in my code I have:
While it is not printing/sending MQTT message, if I press just "ctrl + c" it starts working again as if it "wake-up" from sleeping process.
I am running: release='1.24.0-preview', version='v1.24.0-preview.449.g1b89c503d on a ESP32-C6.
Anyone got a suggestion on what the problem could be?
Beta Was this translation helpful? Give feedback.
All reactions