meshmonitor icon indicating copy to clipboard operation
meshmonitor copied to clipboard

[BUG] random node disconnects since 4.11.x

Open kokoshell opened this issue 5 months ago • 2 comments

Hi Yeraze,

I am experiencing frequent Meshtastic node disconnects since 4.11.x releases ... Disconnects are visible only n TX operation (message TX, traceroute etc.) 4.9.3 for same node works perfectly however!

Best regards, Kokoshell

[INFO] ✅ All module config requests sent [ERROR] ⚠️ Failed to sync favorite to device for node 3493134740: Error: Not connected to Meshtastic node at MeshtasticManager.sendRemoveFavoriteNode (file:///root/meshmonitor/dist/server/meshtasticManager.js:10824:19) at file:///root/meshmonitor/dist/server/server.js:1307:38 at process.processTicksAndRejections (node:internal/process/task_queues:103:5) [INFO] [DatabaseService] markDMMessagesAsRead called: local=!f66b7390, remote=!69856704, userId=2 [INFO] ⚠️ No device config available yet - returning null [ERROR] Error sending traceroute: Error: Not connected to Meshtastic node at MeshtasticManager.sendTraceroute (file:///root/meshmonitor/dist/server/meshtasticManager.js:7494:19) at file:///root/meshmonitor/dist/server/routes/meshRequestRoutes.js:24:28 at process.processTicksAndRejections (node:internal/process/task_queues:103:5) [INFO] ⚠️ No device config available yet - returning null

kokoshell avatar Jun 22 '26 08:06 kokoshell

Thanks for the detailed report, @kokoshell — the log snippet is exactly what's needed to pinpoint this.

Root cause

This is a regression introduced in 4.11.0 (commit f65bd96), which added requestAllModuleConfigs() to fetch all 15 module config types from the device for the new backup capability. The fetch runs ~50 seconds after initial config capture and sends 15 admin messages in sequence with a 1-second gap between each.

The bug is in the error-handling loop inside requestAllModuleConfigs(): when the device closes the TCP connection mid-fetch (WiFi hiccup, power management cycle, etc.), each remaining request throws "Not connected to Meshtastic node" — but the loop catches and swallows those errors and continues. This means:

  1. Device connects → config completes → module config fetch starts (~50s later)
  2. Device drops TCP mid-fetch → isConnected = false
  3. Remaining 10–14 requests all fail silently; the loop finishes
  4. ✅ All module config requests sent appears (misleading — they all failed)
  5. moduleConfigsEverFetched = true is set — so MeshMonitor never retries the fetch on subsequent reconnections
  6. User tries to TX anything → "Not connected to Meshtastic node" (the connection is lost/recovering)

The timing in your logs — ✅ All module config requests sent immediately before the TX failures — is the fingerprint of exactly this sequence.

Fix

The fix propagates connectivity errors out of the loop instead of swallowing them, so moduleConfigsEverFetched stays false and the fetch is properly retried on the next reconnection. It also adds a pre-iteration isConnected guard to bail out early rather than hammering a disconnected device with more requests.

A PR is being prepared now.


Generated by Claude Code

Yeraze avatar Jun 22 '26 09:06 Yeraze

Fixed in #3638 (merged). Root cause: requestAllModuleConfigs() (added in 4.11.0 for device-backup capability) swallowed mid-fetch Not connected errors and then set moduleConfigsEverFetched = true regardless, so after any brief disconnect during the ~15s config-fetch window the module configs stayed permanently incomplete (and "No device config available yet" persisted) until a full process restart. The fix aborts the fetch on connectivity loss and re-throws so it cleanly retries on the next reconnect.

Two things we ruled out during review, for the record: the auto-favorite sweep is already guarded (supportsFavorites() && isConnected), and the all-module-configs request uses GET (not SET) requests, so it doesn't hit the firmware's set-handler reboot path.

@kokoshell — once you're on a build with this fix, could you confirm whether the TX-time disconnects actually subside? If they persist, please reopen with your node's firmware version and a longer log excerpt around a disconnect — that would point to a separate connection-state issue beyond this regression.

Yeraze avatar Jun 22 '26 11:06 Yeraze