Skip to content

Answer a flooded post or command with a fresh path, so rooms and repeaters recover a broken one 🤖🤖 - #3935

Open
hamsolodev wants to merge 3 commits into
meshcore-dev:devfrom
hamsolodev:fix/flood-reply-fresh-path
Open

hamsolodev wants to merge 3 commits into
meshcore-dev:devfrom
hamsolodev:fix/flood-reply-fresh-path

Conversation

@hamsolodev

@hamsolodev hamsolodev commented Nov 24, 2026 •

Copy link
Copy Markdown

The problem. A room server ACKs a post, and a room or repeater replies to a CLI command, along the path it holds to the sender, even when the post or command came by flood (examples/simple_room_server/MyMesh.cpp:495-511 and :533 on dev, examples/simple_repeater/MyMesh.cpp:848 and :877). A client floods when it has no path, which is how it recovers once its path has broken. So once a repeater on the way goes, the room's ACKs and the repeater's replies keep going down the dead path and never arrive, and the room's pushes go the same way (simple_room_server/MyMesh.cpp:99). A flooded login or request is answered with a PATH return, which refreshes the path; a flooded post or command is not.

The change. When a post or command comes by flood, forget the stored path and answer with a flooded PATH return, as BaseChatMesh does for a flooded message (src/helpers/BaseChatMesh.cpp:256):

  • a post's PATH carries its ACK (as does a legacy plain-text CLI command's, on the repeater);
  • a command gets a PATH with nothing attached, and its reply floods, sent with the PATH so the two go out back to back before a repeater on the way forwards either.

The client takes the path and answers with its reciprocal PATH, which gives the room or repeater a fresh one. Direct posts and commands are handled as before.

Compatibility. Members' and admins' companions are unchanged: they already take a PATH return with or without an ACK in it (BaseChatMesh::onContactPathRecv) and answer a flooded one with a reciprocal PATH (src/Mesh.cpp:173-178).

Measured on MeshBench: room server and repeater v1.18.0 built against meshcore-native main, with companions and the repeaters on the way unchanged. Links are about 80% delivery a hop, and the unpatched arm was run twice to gauge noise. "Swapped" means the client's repeater on the way stopped mid-session and another took over.

Unpatched → patched
Room, repeater swapped (10 seeds): posts ACKed after the swap 0 / 0 → 82 of 90
Room, repeater swapped: pushes delivered after the swap 0 / 0 → 45 of 90
Room, 2-repeater chain (10 seeds): posts ACKed 74 / 73 → 93 of 100
Repeater, repeater swapped (12 seeds): commands answered, in the 7 seeds where it held the dead path 0 → 45 of 56
Repeater, repeater swapped: seeds in which it recovered 5 → 12 of 12 (median 85 s after the swap)
Repeater, chains of 1 to 4 repeaters (8 to 16 seeds): commands answered within ±3 of 48–96, inside the noise

The bench has no fading, the fixtures are small (1 to 4 repeaters, not a busy mesh), and I haven't run this on hardware.

Costs.

  • Airtime goes up when a client floods, as the PATH goes out and a command's reply floods instead of going down the held path. Room: +8% on the chain, +10% in the swap runs. Repeater: +8–9% at 1 to 3 repeaters, +16% at 4, and +17–29% in the swap runs (which also answered far more).
  • Until the client's reciprocal PATH arrives, the room's pushes and the repeater's replies to it flood, as after a flooded login.
  • A command's reply goes out with its PATH. On MeshBench (one repeater away, 12 seeds) 72 of 72 first replies arrived, against 59 with the reply 400 ms behind.

Related: #3260 floods the ACK for a retried message. This acts on any flooded post or command, and also replaces the stored path, so pushes and later replies stop using the dead one.

Checked on dev ae28381: built for the host and for the RAK4631 and Heltec v3 room servers and repeaters, with no new warnings under -Wall -Wextra. Flash grows by 160 and 216 bytes for the room server (RAK4631, Heltec v3) and by 160 and 204 bytes for the repeater; RAM is unchanged.

Smoke test on the host build: an unchanged v1.18.0 companion, one repeater away, reset its path and then flooded a post to the patched room and the command ver to the patched repeater (4 runs). Each answered with a flooded PATH, the room's carrying the ACK, and the companion's next post or command went direct and was answered. The repeater's reply first arrived in 2 of the 4 runs; both misses were MeshBench's, whose fixture timed frames at SF7 4/8 against the builds' SF8 4/5. Rerun with the reply sent with its PATH and the settings matched, 4 of 4 arrived. Unpatched dev (one run) answered along the held path with no PATH, and the next post or command flooded again.

A member floods a post when it has no path to the room, as clients do
once their path has failed. The room still ACKed the post, and sent a
command's reply, down the out_path it held, often that same broken
path, so the ACK never arrived and pushes kept going down it too. When
a post or command comes by flood, forget the stored out_path and answer
with a flooded PATH return (carrying the ACK, for a post), as
BaseChatMesh does for a flooded message. The member's reciprocal PATH
then gives the room a fresh out_path.
An admin floods a command when it has no path to the repeater, as
clients do once their path has failed, but the repeater sent its reply
down the out_path it still held, so once that path broke no reply
arrived. When a command comes by flood, forget the stored out_path,
send a flooded PATH return ahead of the reply (carrying the ACK, for a
legacy plain-text command), and flood the reply. The admin's
reciprocal PATH gives the repeater a fresh out_path. Requests already
answer a flood with PATH+RESPONSE.
With the PATH at 200 ms and the reply at 600, a repeater on the way
often forwarded the PATH as the reply went out, or the reply waited
and met the admin's reciprocal PATH there, so about one first reply
in five was lost. Queue the reply with the PATH, so the two go out
back to back before anything forwards either.
@hamsolodev

Copy link
Copy Markdown
Author

I've pushed a1a3fcf: a flooded command's reply now goes out with its PATH return, back to back, instead of 400 ms behind it.

The smoke test's two missed replies were MeshBench's own. Its fixtures time frames at SF7 4/8 while the host builds run SF8 4/5, so its receiver model put the reply's start too early and dropped a frame that began 9 ms after another. With the fixture matched to the radios, every reply that came right behind another frame arrived.

The real cost was smaller but there: 59 of 72 first replies arrived (12 seeds, 6 flooded commands each, one repeater away). The rest were lost when the repeater on the way forwarded the PATH just as the reply went out, or when the reply waited and then met the admin's reciprocal PATH at that repeater. Delaying the reply made it worse, as it lands on the reciprocal PATH: 5 of 72 at 1.7 s, 17 of 72 at 600 ms plus two PATH airtimes. Sent with the PATH, 72 of 72 arrived. The next command went direct 71 of 72 times; the other time the PATH was lost, and that command flooded and was answered. Stale-path recovery is unchanged (74 of 96 commands answered after the swap, 12 of 12 seeds), and airtime is +2.5%. Rerun at the new head with matched settings, the smoke test got 4 of 4 replies, and each next command went direct and was answered.

Builds for the host and the RAK4631 and Heltec v3 repeaters and room servers show no new warnings under -Wall -Wextra against the previous head. The repeater's flash is unchanged on the RAK4631 and 8 bytes larger on the Heltec v3.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant