packet: only copy bloom filter into beacon when available#162
Merged
Conversation
The bloom filter is recomputed in the gateway main loop while beacons are built in the radio slot ISR. Copying mid-recompute puts a partial bloom on the air, and a joined node that fails the membership test on such a beacon leaves with MARI_PEER_LOST_BLOOM. Gate the copy on availability so a beacon is not populated from a filter that is mid-recompute. AI-assisted: Claude Opus 4.8
This was referenced Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The gateway recomputes its bloom filter in the main loop, but beacons are
built in the radio slot ISR. When a beacon is built while a recompute is in
flight, it copies a half-rebuilt filter onto the air. A joined node that fails
the membership test on such a beacon concludes it has been evicted and leaves
with
MARI_PEER_LOST_BLOOM.Under a join storm this is frequent: the gateway sets the filter dirty and
recomputes after every join, so the recompute window is open much of the time,
and a single bad beacon can drop already-joined nodes. They rejoin, trigger
another recompute, and the network bounces instead of settling.
This regressed when the bloom became a mandatory beacon field in
8d20a54,which dropped the prior
mr_bloom_gateway_is_available()guard around the copy.Change
Restore the guard: only copy the filter into the beacon when it is available,
so a beacon is never populated from a filter that is mid-recompute.
Validation
On the testbed, the reason-6 (
MARI_PEER_LOST_BLOOM) disconnects observedduring network formation no longer occur.
Known limitation / follow-up
When the filter is unavailable the copy is skipped, which leaves the beacon's
bloom_filterfield zeroed, and the node side has no empty-filter guard yet.A node-side "treat an all-zero filter as no-info, skip the check" guard (or
gateway-side double-buffering) is a planned follow-up to close that remaining
window fully.