Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: MQTT enabled with custom server/auth causes a reboot loop #3703

Open
acidvegas opened this issue Apr 22, 2024 · 6 comments
Open

[Bug]: MQTT enabled with custom server/auth causes a reboot loop #3703

acidvegas opened this issue Apr 22, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@acidvegas
Copy link

Category

WiFi

Hardware

T-Deck

Firmware Version

2.3.6.7

Description

Enabling wifi and mqtt with a custom mqtt server that uses auth and tls is causing the device to get stuck in a reboot loop.

Relevant log output

No response

@acidvegas acidvegas added the bug Something isn't working label Apr 22, 2024
@oherrala
Copy link

@acidvegas Can you observe same things as documented in issue #3496 ?

@acidvegas
Copy link
Author

@oherrala not I cant observe anything. as soon as I set a custom mqtt server with tls and auth, it just loop reboots over and over

@oherrala
Copy link

@acidvegas I don't know if there's documentation about debugging this stuff. I've been trying to figure these on my own. A quick guide:

Set device.debug_log_enabled to true (e.g. mestastic --set device.debug_log_enabled true) or from App.

After that you can open serial connection to the device via USB (e.g. screen /dev/tty.usb<something>) or try using the serial monitor on https://flasher.meshtastic.org/.

It should give you a log of what device is doing before it reboots.

@acidvegas
Copy link
Author

acidvegas commented May 5, 2024

@acidvegas I don't know if there's documentation about debugging this stuff. I've been trying to figure these on my own. A quick guide:

Set device.debug_log_enabled to true (e.g. mestastic --set device.debug_log_enabled true) or from App.

After that you can open serial connection to the device via USB (e.g. screen /dev/tty.usb<something>) or try using the serial monitor on https://flasher.meshtastic.org/.

It should give you a log of what device is doing before it reboots.

The logs from the serial monitor stop at:
INFO | 01:11:47 25 [WebServerThread] Attempting to connect directly to MQTT server mqtt.redacted.com, port: 1883, username: acidvegas, password: redacted

So I really can't debug past this point :(

Here is the relevant line of code for that log line, so it must be around here somewhere...

firmware/src/mqtt/MQTT.cpp

Lines 330 to 354 in 70712d8

LOG_INFO("Attempting to connect directly to MQTT server %s, port: %d, username: %s, password: %s\n", serverAddr,
serverPort, mqttUsername, mqttPassword);
auto myStatus = (statusTopic + owner.id);
bool connected = pubSub.connect(owner.id, mqttUsername, mqttPassword, myStatus.c_str(), 1, true, "offline");
if (connected) {
LOG_INFO("MQTT connected\n");
enabled = true; // Start running background process again
runASAP = true;
reconnectCount = 0;
publishStatus();
sendSubscriptions();
} else {
#if HAS_WIFI && !defined(ARCH_PORTDUINO)
reconnectCount++;
LOG_ERROR("Failed to contact MQTT server directly (%d/%d)...\n", reconnectCount, reconnectMax);
if (reconnectCount >= reconnectMax) {
needReconnect = true;
wifiReconnect->setIntervalFromNow(0);
reconnectCount = 0;
}
#endif
}
#endif

My mosquito MQTT server is throwing:

714932188: Bad socket read/write on client <unknown>: Invalid arguments provided.
1714932225: New connection from REDACTED_IP:59348 on port 1883.

This is from testing without TLS (cause I didn't know if this was a TLS issue or not...)

@acidvegas
Copy link
Author

acidvegas commented May 5, 2024

I should also mention the T3-S3's and Heltecs are having this same issue. So it's not even a T-deck related issue.

Is anyone using a custom MQTT server with TLS & auth successfully?

ALSO, you can fix your device by running meshtastic --set mqtt.enabled false RIGHT after it boots. This will stop the reboot loop so you don't have to reflash the device to make it stop.

@acidvegas acidvegas changed the title [Bug]: MQTT enabled with custom server/auth causes a reboot loop on T-deck [Bug]: MQTT enabled with custom server/auth causes a reboot loop May 5, 2024
@acidvegas
Copy link
Author

I have gotten a connect to my MQTT server (finally, was an ACL issue in moquito), but TLS causes a reboot loop still

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants