MQTT TLS reboot error #23217
-
Hello, i have an sudden issue with sonoff/nodemcu devices using tasmota firmware. I use a hivemq mqtt tls server at port 8883 for years without problem, but suddenly last day devices started to reset themselves . i entered on console on each device and it shows it tries to connect and says TLS error 0. Unable to connect to server rc-2. Sometimes it will connect but after many reboots. I updated to latest 14.5.0 but to no avail. The strange is that after first try and failure to connect it seems to restart itself. heres a log:
|
Beta Was this translation helpful? Give feedback.
Replies: 14 comments 14 replies
-
As per documentation, error It's simply that Tasmota can't reach the port on the server, TCP failed. |
Beta Was this translation helpful? Give feedback.
-
Default connection timeout is too short for cloud based broker. You may have been Lucky in the past |
Beta Was this translation helpful? Give feedback.
-
I agree and thank you with your comments. i increased mqttwifitimeout to 1000 and seems not to correct the issue. I think the main issue is that after the connection error device reboots and doesnt retry after 20 or 30 sec, like it has encountered somekind of an exception and restarts. Is it possible to debug it ? |
Beta Was this translation helpful? Give feedback.
-
it happens on nodemcu and sonoff devices, where they worked properly for some years. sometime long a go i upgraded the firmware because it didnt connect and then all went well for 2 years. devices work 24/7. I will try nodemcu and connect to serial interface and post the error. |
Beta Was this translation helpful? Give feedback.
-
Serial DUMP: 00:00:13.339 MQT: TLS connection error: 0 --------------- CUT HERE FOR EXCEPTION DECODER --------------- Exception (9):
ctx: cont --------------- CUT HERE FOR EXCEPTION DECODER --------------- ets Jan 8 2013,rst cause:4, boot mode:(3,6) wdt reset 00:00:00.001 HDW: ESP8266EX --------------- CUT HERE FOR EXCEPTION DECODER --------------- Exception (9):
ctx: cont --------------- CUT HERE FOR EXCEPTION DECODER --------------- ets Jan 8 2013,rst cause:4, boot mode:(3,6) wdt reset 00:00:00.001 HDW: ESP8266EX How can i help? |
Beta Was this translation helpful? Give feedback.
-
it happens on clean configuration. the problem i think is on broker |
Beta Was this translation helpful? Give feedback.
-
I wiresharked tls handshake and saw that hivemq serves two certificates rsa 2048bit. Is it possible that esp8266 runs out of memory because of this? also in compilation i see that iram is almost full "Used static IRAM: 31388 bytes ( 1380 remain, 95.8 % used)". Should i upgrade to esp32 because running out of resources? |
Beta Was this translation helpful? Give feedback.
-
MQTT TLS with HiveMQ is not working since days - nothing changed #23234 |
Beta Was this translation helpful? Give feedback.
-
sometimes it connects but after many retries: Also i noted in wireshark after sending client hello packet, server hello message takes some time to receive (sometimes takes 7-8 sec). I believe the problem lies in hivemq server taking too long to respond. In file \lib\lib_ssl\tls_mini\src\WiFiClientSecureLightBearSSL.h there is a property at line 140 uint32_t _loopTimeout=5000; I digged and i think that tls connection routine has a hardlimited timeout of 5sec to reach SENDAPP state. I think its tls handshake timeout. |
Beta Was this translation helpful? Give feedback.
-
Is the problem easy to reproduce with HiveMQ ? If so I will open an account |
Beta Was this translation helpful? Give feedback.
-
Yes - very easy. As you wish |
Beta Was this translation helpful? Give feedback.
-
Unfortunately I cannot reproduce. I took a stock ESP32 firmware and got the following:
My connection time is much shorter than what was seen above. I suspect that the error and the crash come from a timeout that is not well handled. |
Beta Was this translation helpful? Give feedback.
-
Update: The crash happens when the _loopTimeout time expires before ServerHello Message from server in TLS exchange. Here is the backtrace: xtensa-esp32s3-elf-addr2line -pfiaC -e firmware.elf -a 0x4019a90b:0x3ffb2050 0x401961b1:0x3ffb20d0 0x4019c12d:0x3ffb2100 0x40175aca:0x3ffb2130 0x40175c45:0x3ffb2160 0x40175965:0x3ffb2180 0x4018bb3a:0x3ffb21a0 0x4018d3bf:0x3ffb21c0 0x400f478b:0x3ffb21f0 0x4014a64e:0x3ffb2210 0x400dfa8c:0x3ffb2230 0x400dbd5e:0x3ffb2250 0x400dbdcf:0x3ffb2270 0x401959a6:0x3ffb2290 0x4019a90b: br_ssl_hs_client_run at :? |
Beta Was this translation helpful? Give feedback.
-
It should be fixed now with #23249 |
Beta Was this translation helpful? Give feedback.
It should be fixed now with #23249